diff options
author | Siva Chandra Reddy <sivachandra@sourceware.org> | 2012-06-27 00:21:21 +0000 |
---|---|---|
committer | Siva Chandra Reddy <sivachandra@sourceware.org> | 2012-06-27 00:21:21 +0000 |
commit | ee0bf529c3da511fd32d4a997bf958a6af28b582 (patch) | |
tree | 9587312091dd0f122683506414693a5f8f0fafc8 /gdb/python | |
parent | f7ccda615a4867b2f0f7cc0e68ba773562984da6 (diff) | |
download | gdb-ee0bf529c3da511fd32d4a997bf958a6af28b582.zip gdb-ee0bf529c3da511fd32d4a997bf958a6af28b582.tar.gz gdb-ee0bf529c3da511fd32d4a997bf958a6af28b582.tar.bz2 |
2012-06-26 Siva Chandra Reddy <sivachandra@google.com>
New attribute 'last' for gdb.Symtab_and_line.
* NEWS (Python Scripting): Add entry about the new attribute.
* python/py-symtab.c (salpy_get_last): New function which
implements the get method for the 'last' attribute of
gdb.Symtab_and_line.
(sal_object_getset): Add entry for the 'last' attribute.
doc/
* gdb.texinfo (Symbol Tables In Python): Add description about
the new 'last' attribute of gdb.Symtab_and line.
testsuite/
* gdb.python/py-symtab.exp: Add tests to test the new attribute
'last' of gdb.Symtab_and_line.
* gdb.python/py-symbol.c: Move break point comment to enable
testing of gdb.Symtab_and_line.last.
Diffstat (limited to 'gdb/python')
-rw-r--r-- | gdb/python/py-symtab.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/gdb/python/py-symtab.c b/gdb/python/py-symtab.c index e9e38b2..b6f45e6 100644 --- a/gdb/python/py-symtab.c +++ b/gdb/python/py-symtab.c @@ -237,6 +237,22 @@ salpy_get_pc (PyObject *self, void *closure) return gdb_py_long_from_ulongest (sal->pc); } +/* Implementation of the get method for the 'last' attribute of + gdb.Symtab_and_line. */ + +static PyObject * +salpy_get_last (PyObject *self, void *closure) +{ + struct symtab_and_line *sal = NULL; + + SALPY_REQUIRE_VALID (self, sal); + + if (sal->end > 0) + return gdb_py_long_from_ulongest (sal->end - 1); + else + Py_RETURN_NONE; +} + static PyObject * salpy_get_line (PyObject *self, void *closure) { @@ -556,6 +572,8 @@ static PyTypeObject symtab_object_type = { static PyGetSetDef sal_object_getset[] = { { "symtab", salpy_get_symtab, NULL, "Symtab object.", NULL }, { "pc", salpy_get_pc, NULL, "Return the symtab_and_line's pc.", NULL }, + { "last", salpy_get_last, NULL, + "Return the symtab_and_line's last address.", NULL }, { "line", salpy_get_line, NULL, "Return the symtab_and_line's line.", NULL }, {NULL} /* Sentinel */ |