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