aboutsummaryrefslogtreecommitdiff
path: root/gdb/python
diff options
context:
space:
mode:
authorDoug Evans <dje@google.com>2014-09-18 10:09:12 -0700
committerDoug Evans <dje@google.com>2014-09-18 10:09:12 -0700
commit2b4fd423cf503beb6264590f0517d35f17a6ab8d (patch)
tree6cd77a3fb9668459b2262f83874cd31e3c361281 /gdb/python
parent92c9bcd479e4cb388a7f286fc42414b115cfc656 (diff)
downloadgdb-2b4fd423cf503beb6264590f0517d35f17a6ab8d.zip
gdb-2b4fd423cf503beb6264590f0517d35f17a6ab8d.tar.gz
gdb-2b4fd423cf503beb6264590f0517d35f17a6ab8d.tar.bz2
New "producer" attribute of python gdb.Symtab.
gdb/ChangeLog: * NEWS: Mention new "producer" attribute of gdb.Symtab. * python/py-symtab.c (stpy_get_producer): New function. (symtab_object_getset): Add "producer" attribute. gdb/doc/ChangeLog: * python.texi (Symbol Tables In Python): Document "producer" attribute of gdb.Symtab objects. gdb/testsuite/ChangeLog: * gdb.dwarf2/symtab-producer.exp: New file.
Diffstat (limited to 'gdb/python')
-rw-r--r--gdb/python/py-symtab.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/gdb/python/py-symtab.c b/gdb/python/py-symtab.c
index 8f4208d..1065ba3 100644
--- a/gdb/python/py-symtab.c
+++ b/gdb/python/py-symtab.c
@@ -126,6 +126,25 @@ stpy_get_objfile (PyObject *self, void *closure)
return result;
}
+/* Getter function for symtab.producer. */
+
+static PyObject *
+stpy_get_producer (PyObject *self, void *closure)
+{
+ struct symtab *symtab = NULL;
+
+ STPY_REQUIRE_VALID (self, symtab);
+ if (symtab->producer != NULL)
+ {
+ const char *producer = symtab->producer;
+
+ return PyString_Decode (producer, strlen (producer),
+ host_charset (), NULL);
+ }
+
+ Py_RETURN_NONE;
+}
+
static PyObject *
stpy_fullname (PyObject *self, PyObject *args)
{
@@ -530,6 +549,8 @@ static PyGetSetDef symtab_object_getset[] = {
"The symbol table's source filename.", NULL },
{ "objfile", stpy_get_objfile, NULL, "The symtab's objfile.",
NULL },
+ { "producer", stpy_get_producer, NULL,
+ "The name/version of the program that compiled this symtab.", NULL },
{NULL} /* Sentinel */
};