aboutsummaryrefslogtreecommitdiff
path: root/gdb/python
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2012-02-07 19:42:27 +0000
committerTom Tromey <tromey@redhat.com>2012-02-07 19:42:27 +0000
commit64e7d9dddc00228cdbcecdd4c053cf83cf6608b7 (patch)
tree81e5d325950872985aca39c9bf8ea390c04261b1 /gdb/python
parent1d6b2d2b4a864c478fb6a46e15a29859641fe788 (diff)
downloadgdb-64e7d9dddc00228cdbcecdd4c053cf83cf6608b7.zip
gdb-64e7d9dddc00228cdbcecdd4c053cf83cf6608b7.tar.gz
gdb-64e7d9dddc00228cdbcecdd4c053cf83cf6608b7.tar.bz2
PR python/13599:
* python/py-symbol.c (sympy_line): New function. (symbol_object_getset): Add "line". gdb/doc * gdb.texinfo (Symbols In Python): Document Symbol.line. gdb/testsuite * gdb.python/py-symbol.c (qq): New global. * gdb.python/py-symbol.exp: Add test for frame-less lookup_symbol. * gdb.python/py-symtab.exp: Fix line number.
Diffstat (limited to 'gdb/python')
-rw-r--r--gdb/python/py-symbol.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/gdb/python/py-symbol.c b/gdb/python/py-symbol.c
index 9d32a71..d44014c 100644
--- a/gdb/python/py-symbol.c
+++ b/gdb/python/py-symbol.c
@@ -183,6 +183,19 @@ sympy_is_variable (PyObject *self, void *closure)
|| class == LOC_OPTIMIZED_OUT));
}
+/* Implementation of gdb.Symbol.line -> int.
+ Returns the line number at which the symbol was defined. */
+
+static PyObject *
+sympy_line (PyObject *self, void *closure)
+{
+ struct symbol *symbol = NULL;
+
+ SYMPY_REQUIRE_VALID (self, symbol);
+
+ return PyInt_FromLong (SYMBOL_LINE (symbol));
+}
+
/* Implementation of gdb.Symbol.is_valid (self) -> Boolean.
Returns True if this Symbol still exists in GDB. */
@@ -460,6 +473,8 @@ to display demangled or mangled names.", NULL },
"True if the symbol is a function or method." },
{ "is_variable", sympy_is_variable, NULL,
"True if the symbol is a variable." },
+ { "line", sympy_line, NULL,
+ "The source line number at which the symbol was defined." },
{ NULL } /* Sentinel */
};