aboutsummaryrefslogtreecommitdiff
path: root/gdb/python
diff options
context:
space:
mode:
authorDoug Evans <dje@google.com>2014-12-04 12:01:22 -0800
committerDoug Evans <dje@google.com>2014-12-04 12:01:22 -0800
commit86e4ed39595933e04a9dcbc7dec18c1056c9cbe1 (patch)
tree35be0a27159e91369849f0f9a31aa2212b60b948 /gdb/python
parent7c50a93137df660f7b2d9d68c0db748a9cb7868f (diff)
downloadgdb-86e4ed39595933e04a9dcbc7dec18c1056c9cbe1.zip
gdb-86e4ed39595933e04a9dcbc7dec18c1056c9cbe1.tar.gz
gdb-86e4ed39595933e04a9dcbc7dec18c1056c9cbe1.tar.bz2
New python method gdb.Objfile.add_separate_debug_file.
gdb/ChangeLog: * NEWS: Mention gdb.Objfile.add_separate_debug_file. * python/py-objfile.c (objfpy_add_separate_debug_file): New function. (objfile_getset): Add "add_separate_debug_file". gdb/doc/ChangeLog: * python.texi (Objfiles In Python): Document Objfile.add_separate_debug_file. gdb/testsuite/ChangeLog: * gdb.python/py-objfile.exp: Add tests for objfile.add_separate_debug_file.
Diffstat (limited to 'gdb/python')
-rw-r--r--gdb/python/py-objfile.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/gdb/python/py-objfile.c b/gdb/python/py-objfile.c
index 05a7c21..292d310 100644
--- a/gdb/python/py-objfile.c
+++ b/gdb/python/py-objfile.c
@@ -334,6 +334,33 @@ objfpy_is_valid (PyObject *self, PyObject *args)
Py_RETURN_TRUE;
}
+/* Implementation of gdb.Objfile.add_separate_debug_file (self) -> Boolean. */
+
+static PyObject *
+objfpy_add_separate_debug_file (PyObject *self, PyObject *args, PyObject *kw)
+{
+ static char *keywords[] = { "file_name", NULL };
+ objfile_object *obj = (objfile_object *) self;
+ const char *file_name;
+ int symfile_flags = 0;
+ volatile struct gdb_exception except;
+
+ OBJFPY_REQUIRE_VALID (obj);
+
+ if (!PyArg_ParseTupleAndKeywords (args, kw, "s", keywords, &file_name))
+ return NULL;
+
+ TRY_CATCH (except, RETURN_MASK_ALL)
+ {
+ bfd *abfd = symfile_bfd_open (file_name);
+
+ symbol_file_add_separate (abfd, file_name, symfile_flags, obj->objfile);
+ }
+ GDB_PY_HANDLE_EXCEPTION (except);
+
+ Py_RETURN_NONE;
+}
+
/* Clear the OBJFILE pointer in an Objfile object and remove the
@@ -401,6 +428,11 @@ static PyMethodDef objfile_object_methods[] =
"is_valid () -> Boolean.\n\
Return true if this object file is valid, false if not." },
+ { "add_separate_debug_file", (PyCFunction) objfpy_add_separate_debug_file,
+ METH_VARARGS | METH_KEYWORDS,
+ "add_separate_debug_file (file_name).\n\
+Add FILE_NAME to the list of files containing debug info for the objfile." },
+
{ NULL }
};