From 29703da4b1a5b80034c3f33b0c8f34ce6e1f08d5 Mon Sep 17 00:00:00 2001 From: Phil Muldoon Date: Thu, 17 Mar 2011 09:36:17 +0000 Subject: 2011-03-17 Phil Muldoon * 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 * 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 * 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. --- gdb/python/py-infthread.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'gdb/python/py-infthread.c') diff --git a/gdb/python/py-infthread.c b/gdb/python/py-infthread.c index 059422d..b37c53c 100644 --- a/gdb/python/py-infthread.c +++ b/gdb/python/py-infthread.c @@ -222,7 +222,20 @@ thpy_is_exited (PyObject *self, PyObject *args) Py_RETURN_FALSE; } +/* Implementation of gdb.InfThread.is_valid (self) -> Boolean. + Returns True if this inferior Thread object still exists + in GDB. */ +static PyObject * +thpy_is_valid (PyObject *self, PyObject *args) +{ + thread_object *thread_obj = (thread_object *) self; + + if (! thread_obj->thread) + Py_RETURN_FALSE; + + Py_RETURN_TRUE; +} /* Implementation of gdb.selected_thread () -> gdb.InferiorThread. Returns the selected thread object. */ @@ -269,6 +282,9 @@ static PyGetSetDef thread_object_getset[] = static PyMethodDef thread_object_methods[] = { + { "is_valid", thpy_is_valid, METH_NOARGS, + "is_valid () -> Boolean.\n\ +Return true if this inferior thread is valid, false if not." }, { "switch", thpy_switch, METH_NOARGS, "switch ()\n\ Makes this the GDB selected thread." }, -- cgit v1.1