mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-05-29 23:36:06 +08:00
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:
@ -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 */
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user