mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-05-23 02:06:48 +08:00
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:
@ -263,6 +263,36 @@ blpy_block_syms_dealloc (PyObject *obj)
|
||||
Py_XDECREF (iter_obj->source);
|
||||
}
|
||||
|
||||
/* Implementation of gdb.Block.is_valid (self) -> Boolean.
|
||||
Returns True if this block object still exists in GDB. */
|
||||
|
||||
static PyObject *
|
||||
blpy_is_valid (PyObject *self, PyObject *args)
|
||||
{
|
||||
struct block *block;
|
||||
|
||||
block = block_object_to_block (self);
|
||||
if (block == NULL)
|
||||
Py_RETURN_FALSE;
|
||||
|
||||
Py_RETURN_TRUE;
|
||||
}
|
||||
|
||||
/* Implementation of gdb.BlockIterator.is_valid (self) -> Boolean.
|
||||
Returns True if this block iterator object still exists in GDB */
|
||||
|
||||
static PyObject *
|
||||
blpy_iter_is_valid (PyObject *self, PyObject *args)
|
||||
{
|
||||
block_syms_iterator_object *iter_obj =
|
||||
(block_syms_iterator_object *) self;
|
||||
|
||||
if (iter_obj->source->block == NULL)
|
||||
Py_RETURN_FALSE;
|
||||
|
||||
Py_RETURN_TRUE;
|
||||
}
|
||||
|
||||
/* Return the innermost lexical block containing the specified pc value,
|
||||
or 0 if there is none. */
|
||||
PyObject *
|
||||
@ -342,6 +372,13 @@ gdbpy_initialize_blocks (void)
|
||||
|
||||
|
||||
|
||||
static PyMethodDef block_object_methods[] = {
|
||||
{ "is_valid", blpy_is_valid, METH_NOARGS,
|
||||
"is_valid () -> Boolean.\n\
|
||||
Return true if this block is valid, false if not." },
|
||||
{NULL} /* Sentinel */
|
||||
};
|
||||
|
||||
static PyGetSetDef block_object_getset[] = {
|
||||
{ "start", blpy_get_start, NULL, "Start address of the block.", NULL },
|
||||
{ "end", blpy_get_end, NULL, "End address of the block.", NULL },
|
||||
@ -381,11 +418,18 @@ PyTypeObject block_object_type = {
|
||||
0, /* tp_weaklistoffset */
|
||||
blpy_iter, /* tp_iter */
|
||||
0, /* tp_iternext */
|
||||
0, /* tp_methods */
|
||||
block_object_methods, /* tp_methods */
|
||||
0, /* tp_members */
|
||||
block_object_getset /* tp_getset */
|
||||
};
|
||||
|
||||
static PyMethodDef block_iterator_object_methods[] = {
|
||||
{ "is_valid", blpy_iter_is_valid, METH_NOARGS,
|
||||
"is_valid () -> Boolean.\n\
|
||||
Return true if this block iterator is valid, false if not." },
|
||||
{NULL} /* Sentinel */
|
||||
};
|
||||
|
||||
static PyTypeObject block_syms_iterator_object_type = {
|
||||
PyObject_HEAD_INIT (NULL)
|
||||
0, /*ob_size*/
|
||||
@ -415,5 +459,5 @@ static PyTypeObject block_syms_iterator_object_type = {
|
||||
0, /*tp_weaklistoffset */
|
||||
blpy_block_syms_iter, /*tp_iter */
|
||||
blpy_block_syms_iternext, /*tp_iternext */
|
||||
0 /*tp_methods */
|
||||
block_iterator_object_methods /*tp_methods */
|
||||
};
|
||||
|
Reference in New Issue
Block a user