Add gdb.Objfile.username.
gdb/ChangeLog: * NEWS: Mention gdb.Objfile.username. * python/py-objfile.c (objfpy_get_username): New function. (objfile_getset): Add "username". gdb/doc/ChangeLog: * python.texi (Objfiles In Python): Document Objfile.username. gdb/testsuite/ChangeLog: * gdb.python/py-objfile.exp: Add tests for objfile.username. Add test for objfile.filename, objfile.username after objfile has been unloaded.
This commit is contained in:
parent
1b5493961a
commit
3a8b707add
7 changed files with 68 additions and 0 deletions
|
@ -81,6 +81,25 @@ objfpy_get_filename (PyObject *self, void *closure)
|
|||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
/* An Objfile method which returns the objfile's file name, as specified
|
||||
by the user, or None. */
|
||||
|
||||
static PyObject *
|
||||
objfpy_get_username (PyObject *self, void *closure)
|
||||
{
|
||||
objfile_object *obj = (objfile_object *) self;
|
||||
|
||||
if (obj->objfile)
|
||||
{
|
||||
const char *username = obj->objfile->original_name;
|
||||
|
||||
return PyString_Decode (username, strlen (username),
|
||||
host_charset (), NULL);
|
||||
}
|
||||
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
/* If SELF is a separate debug-info file, return the "backlink" field.
|
||||
Otherwise return None. */
|
||||
|
||||
|
@ -613,6 +632,8 @@ static PyGetSetDef objfile_getset[] =
|
|||
"The __dict__ for this objfile.", &objfile_object_type },
|
||||
{ "filename", objfpy_get_filename, NULL,
|
||||
"The objfile's filename, or None.", NULL },
|
||||
{ "username", objfpy_get_username, NULL,
|
||||
"The name of the objfile as provided by the user, or None.", NULL },
|
||||
{ "owner", objfpy_get_owner, NULL,
|
||||
"The objfile owner of separate debug info objfiles, or None.",
|
||||
NULL },
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue