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.
This commit is contained in:
parent
1d6b2d2b4a
commit
64e7d9dddc
9 changed files with 51 additions and 2 deletions
|
@ -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 */
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue