* NEWS: Mention new "type" attribute of python gdb.Symbol objects.
* python/py-symbol.c (sympy_get_type): New function. (symbol_object_getset): Add "type". doc/ * gdb.texinfo (Symbols In Python): Document symbol.type. testsuite/ * gdb.python/py-symbol.exp: Add test for symbol.type.
This commit is contained in:
parent
505b88fb5d
commit
457e09f060
7 changed files with 45 additions and 0 deletions
|
@ -65,6 +65,22 @@ sympy_str (PyObject *self)
|
|||
return result;
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
sympy_get_type (PyObject *self, void *closure)
|
||||
{
|
||||
struct symbol *symbol = NULL;
|
||||
|
||||
SYMPY_REQUIRE_VALID (self, symbol);
|
||||
|
||||
if (SYMBOL_TYPE (symbol) == NULL)
|
||||
{
|
||||
Py_INCREF (Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
|
||||
return type_to_type_object (SYMBOL_TYPE (symbol));
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
sympy_get_symtab (PyObject *self, void *closure)
|
||||
{
|
||||
|
@ -412,6 +428,8 @@ gdbpy_initialize_symbols (void)
|
|||
|
||||
|
||||
static PyGetSetDef symbol_object_getset[] = {
|
||||
{ "type", sympy_get_type, NULL,
|
||||
"Type of the symbol.", NULL },
|
||||
{ "symtab", sympy_get_symtab, NULL,
|
||||
"Symbol table in which the symbol appears.", NULL },
|
||||
{ "name", sympy_get_name, NULL,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue