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.
This commit is contained in:
Phil Muldoon
2011-03-17 09:36:17 +00:00
parent a6363bfc38
commit 29703da4b1
19 changed files with 427 additions and 8 deletions

View File

@ -167,6 +167,21 @@ sympy_is_variable (PyObject *self, void *closure)
|| class == LOC_OPTIMIZED_OUT));
}
/* Implementation of gdb.Symbol.is_valid (self) -> Boolean.
Returns True if this Symbol still exists in GDB. */
static PyObject *
sympy_is_valid (PyObject *self, PyObject *args)
{
struct symbol *symbol = NULL;
symbol = symbol_object_to_symbol (self);
if (symbol == NULL)
Py_RETURN_FALSE;
Py_RETURN_TRUE;
}
/* Given a symbol, and a symbol_object that has previously been
allocated and initialized, populate the symbol_object with the
struct symbol data. Also, register the symbol_object life-cycle
@ -420,6 +435,13 @@ to display demangled or mangled names.", NULL },
{ NULL } /* Sentinel */
};
static PyMethodDef symbol_object_methods[] = {
{ "is_valid", sympy_is_valid, METH_NOARGS,
"is_valid () -> Boolean.\n\
Return true if this symbol is valid, false if not." },
{NULL} /* Sentinel */
};
PyTypeObject symbol_object_type = {
PyObject_HEAD_INIT (NULL)
0, /*ob_size*/
@ -449,7 +471,7 @@ PyTypeObject symbol_object_type = {
0, /*tp_weaklistoffset */
0, /*tp_iter */
0, /*tp_iternext */
0, /*tp_methods */
symbol_object_methods, /*tp_methods */
0, /*tp_members */
symbol_object_getset /*tp_getset */
};