aboutsummaryrefslogtreecommitdiff
path: root/gdb/python/py-objfile.c
diff options
context:
space:
mode:
authorDoug Evans <dje@google.com>2014-12-08 08:50:48 -0800
committerDoug Evans <dje@google.com>2014-12-08 08:50:48 -0800
commita0be3e44c7f510df608e4a480dd05c173ce280ce (patch)
tree639476193625c02332874a058e10ca327fad7007 /gdb/python/py-objfile.c
parent137d04f77229e4e61098c5595a1edf70c3bc4d28 (diff)
downloadgdb-a0be3e44c7f510df608e4a480dd05c173ce280ce.zip
gdb-a0be3e44c7f510df608e4a480dd05c173ce280ce.tar.gz
gdb-a0be3e44c7f510df608e4a480dd05c173ce280ce.tar.bz2
New "owner" attribute for gdb.Objfile.
gdb/ChangeLog: * NEWS: Mention gdb.Objfile.owner. * python/py-objfile.c (objfpy_get_owner): New function. (objfile_getset): Add "owner". gdb/doc/ChangeLog: * python.texi (Objfiles In Python): Document Objfile.owner. gdb/testsuite/ChangeLog: * gdb.python/py-objfile.exp: Add tests for objfile.owner.
Diffstat (limited to 'gdb/python/py-objfile.c')
-rw-r--r--gdb/python/py-objfile.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/gdb/python/py-objfile.c b/gdb/python/py-objfile.c
index 292d310..51cf47c 100644
--- a/gdb/python/py-objfile.c
+++ b/gdb/python/py-objfile.c
@@ -80,6 +80,25 @@ objfpy_get_filename (PyObject *self, void *closure)
Py_RETURN_NONE;
}
+/* If SELF is a separate debug-info file, return the "backlink" field.
+ Otherwise return None. */
+
+static PyObject *
+objfpy_get_owner (PyObject *self, void *closure)
+{
+ objfile_object *obj = (objfile_object *) self;
+ struct objfile *objfile = obj->objfile;
+ struct objfile *owner;
+
+ OBJFPY_REQUIRE_VALID (obj);
+
+ owner = objfile->separate_debug_objfile_backlink;
+
+ if (owner != NULL)
+ return objfile_to_objfile_object (owner);
+ Py_RETURN_NONE;
+}
+
/* An Objfile method which returns the objfile's build id, or None. */
static PyObject *
@@ -442,6 +461,9 @@ static PyGetSetDef objfile_getset[] =
"The __dict__ for this objfile.", &objfile_object_type },
{ "filename", objfpy_get_filename, NULL,
"The objfile's filename, or None.", NULL },
+ { "owner", objfpy_get_owner, NULL,
+ "The objfile owner of separate debug info objfiles, or None.",
+ NULL },
{ "build_id", objfpy_get_build_id, NULL,
"The objfile's build id, or None.", NULL },
{ "progspace", objfpy_get_progspace, NULL,