aboutsummaryrefslogtreecommitdiff
path: root/gdb/python
diff options
context:
space:
mode:
authorDoug Evans <dje@google.com>2011-08-12 22:21:57 +0000
committerDoug Evans <dje@google.com>2011-08-12 22:21:57 +0000
commit457e09f0601b9b3bbad55110af858bf25b02a69e (patch)
tree64b827bdb71bc4ea492d84638b378930b5413793 /gdb/python
parent505b88fb5d0725884d473d5a208e604bbda54c4f (diff)
downloadgdb-457e09f0601b9b3bbad55110af858bf25b02a69e.zip
gdb-457e09f0601b9b3bbad55110af858bf25b02a69e.tar.gz
gdb-457e09f0601b9b3bbad55110af858bf25b02a69e.tar.bz2
* 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.
Diffstat (limited to 'gdb/python')
-rw-r--r--gdb/python/py-symbol.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/gdb/python/py-symbol.c b/gdb/python/py-symbol.c
index 046d78c..8a8510e 100644
--- a/gdb/python/py-symbol.c
+++ b/gdb/python/py-symbol.c
@@ -66,6 +66,22 @@ sympy_str (PyObject *self)
}
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)
{
struct symbol *symbol = NULL;
@@ -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,