aboutsummaryrefslogtreecommitdiff
path: root/gdb/python/py-objfile.c
diff options
context:
space:
mode:
authorPhil Muldoon <pmuldoon@redhat.com>2011-03-17 09:36:17 +0000
committerPhil Muldoon <pmuldoon@redhat.com>2011-03-17 09:36:17 +0000
commit29703da4b1a5b80034c3f33b0c8f34ce6e1f08d5 (patch)
treec0999d1a168f21196c3c8ba5b1401f05b00236d3 /gdb/python/py-objfile.c
parenta6363bfc3832f13436cb744783aa96eaec972006 (diff)
downloadgdb-29703da4b1a5b80034c3f33b0c8f34ce6e1f08d5.zip
gdb-29703da4b1a5b80034c3f33b0c8f34ce6e1f08d5.tar.gz
gdb-29703da4b1a5b80034c3f33b0c8f34ce6e1f08d5.tar.bz2
2011-03-17 Phil Muldoon <pmuldoon@redhat.com>
* python/py-symtab.c: Populate symtab_object_methods, sal_object_methods. (stpy_is_valid): New function. (salpy_is_valid): Ditto. * python/py-symbol.c: Declare symbol_object_methods. Populate. (sympy_is_valid): New function. * python/py-objfile.c: Declare objfile_object_methods. Populate. (objfpy_is_valid): New function. * python/py-inferior.c: Populate inferior_object_methods. (infpy_is_valid): New function. * python/py-infthread.c: Populate thread_object_methods. (thpy_is_valid): New function. * python/py-block.c: Declare block_object_methods. Populate. Declare block_iterator_object_methods. Populate. (blpy_is_valid): New function. (blpy_iter_is_valid): Ditto. 2010-03-17 Phil Muldoon <pmuldoon@redhat.com> * gdb.python/Makefile.in: Add py-objfile. * gdb.python/py-objfile.exp: New file. * gdb.python/py-objfile.c: New file. * gdb.python/py-block.exp: Add is_valid tests. * gdb.python/py-inferior.exp: Ditto. * gdb.python/py-infthread.exp: Ditto. * gdb.python/py-symbol.exp: Ditto. * gdb.python/py-symtab.exp: Ditto. 2011-03-17 Phil Muldoon <pmuldoon@redhat.com> * gdb.texinfo (Blocks In Python): Add is_valid method description. (Inferiors In Python): Likewise. (Threads In Python): Likewise. (Symbols In Python): Likewise. (Objfiles In Python): Likewise. (Symbol Tables In Python): Likewise.
Diffstat (limited to 'gdb/python/py-objfile.c')
-rw-r--r--gdb/python/py-objfile.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/gdb/python/py-objfile.c b/gdb/python/py-objfile.c
index 7f9d9ee..f9821f5 100644
--- a/gdb/python/py-objfile.c
+++ b/gdb/python/py-objfile.c
@@ -118,6 +118,20 @@ objfpy_set_printers (PyObject *o, PyObject *value, void *ignore)
return 0;
}
+/* Implementation of gdb.Objfile.is_valid (self) -> Boolean.
+ Returns True if this object file still exists in GDB. */
+
+static PyObject *
+objfpy_is_valid (PyObject *self, PyObject *args)
+{
+ objfile_object *obj = (objfile_object *) self;
+
+ if (! obj->objfile)
+ Py_RETURN_FALSE;
+
+ Py_RETURN_TRUE;
+}
+
/* Clear the OBJFILE pointer in an Objfile object and remove the
@@ -181,6 +195,15 @@ gdbpy_initialize_objfile (void)
+static PyMethodDef objfile_object_methods[] =
+{
+ { "is_valid", objfpy_is_valid, METH_NOARGS,
+ "is_valid () -> Boolean.\n\
+Return true if this object file is valid, false if not." },
+
+ { NULL }
+};
+
static PyGetSetDef objfile_getset[] =
{
{ "filename", objfpy_get_filename, NULL,
@@ -220,7 +243,7 @@ static PyTypeObject objfile_object_type =
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
- 0, /* tp_methods */
+ objfile_object_methods, /* tp_methods */
0, /* tp_members */
objfile_getset, /* tp_getset */
0, /* tp_base */