[RFC - Python Scripting] Add 'end' attribute to gdb.Symtab_and_line

Doug Evans dje@google.com
Fri Jun 22 21:12:00 GMT 2012


On Fri, Jun 22, 2012 at 10:12 AM, Tom Tromey <tromey@redhat.com> wrote:
>>>>>> "Siva" == Siva Chandra <sivachandra@google.com> writes:
>
> Siva> +static PyObject *
> Siva> +salpy_get_last (PyObject *self, void *closure)
> Siva> +{
> Siva> +  struct symtab_and_line *sal = NULL;
> Siva> +
> Siva> +  SALPY_REQUIRE_VALID (self, sal);
> Siva> +
> Siva> +  return gdb_py_long_from_ulongest (sal->end - 1);
>
> It seems that sal->end can be == 0.
> For example I think gdb.decode_line can create sals like this.
> In this case I think "- 1" will yield weird results.
> Perhaps a None return would be better?

Good point.  None "works for me".



More information about the Gdb-patches mailing list