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

Tom Tromey tromey@redhat.com
Fri Jun 22 17:12:00 GMT 2012


>>>>> "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?

Tom



More information about the Gdb-patches mailing list