diff options
author | Phil Muldoon <pmuldoon@redhat.com> | 2011-03-17 09:36:17 +0000 |
---|---|---|
committer | Phil Muldoon <pmuldoon@redhat.com> | 2011-03-17 09:36:17 +0000 |
commit | 29703da4b1a5b80034c3f33b0c8f34ce6e1f08d5 (patch) | |
tree | c0999d1a168f21196c3c8ba5b1401f05b00236d3 /gdb/python/py-symtab.c | |
parent | a6363bfc3832f13436cb744783aa96eaec972006 (diff) | |
download | gdb-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-symtab.c')
-rw-r--r-- | gdb/python/py-symtab.c | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/gdb/python/py-symtab.c b/gdb/python/py-symtab.c index 5c1c6bb..107cdec 100644 --- a/gdb/python/py-symtab.c +++ b/gdb/python/py-symtab.c @@ -138,6 +138,21 @@ stpy_fullname (PyObject *self, PyObject *args) Py_RETURN_NONE; } +/* Implementation of gdb.Symtab.is_valid (self) -> Boolean. + Returns True if this Symbol table still exists in GDB. */ + +static PyObject * +stpy_is_valid (PyObject *self, PyObject *args) +{ + struct symtab *symtab = NULL; + + symtab = symtab_object_to_symtab (self); + if (symtab == NULL) + Py_RETURN_FALSE; + + Py_RETURN_TRUE; +} + static PyObject * salpy_str (PyObject *self) { @@ -212,6 +227,21 @@ salpy_get_symtab (PyObject *self, void *closure) return (PyObject *) self_sal->symtab; } +/* Implementation of gdb.Symtab_and_line.is_valid (self) -> Boolean. + Returns True if this Symbol table and line object still exists GDB. */ + +static PyObject * +salpy_is_valid (PyObject *self, PyObject *args) +{ + struct symtab_and_line *sal; + + sal = sal_object_to_symtab_and_line (self); + if (sal == NULL) + Py_RETURN_FALSE; + + Py_RETURN_TRUE; +} + static void salpy_dealloc (PyObject *self) { @@ -441,6 +471,9 @@ static PyGetSetDef symtab_object_getset[] = { }; static PyMethodDef symtab_object_methods[] = { + { "is_valid", stpy_is_valid, METH_NOARGS, + "is_valid () -> Boolean.\n\ +Return true if this symbol table is valid, false if not." }, { "fullname", stpy_fullname, METH_NOARGS, "fullname () -> String.\n\ Return the symtab's full source filename." }, @@ -489,6 +522,13 @@ static PyGetSetDef sal_object_getset[] = { {NULL} /* Sentinel */ }; +static PyMethodDef sal_object_methods[] = { + { "is_valid", salpy_is_valid, METH_NOARGS, + "is_valid () -> Boolean.\n\ +Return true if this symbol table and line is valid, false if not." }, + {NULL} /* Sentinel */ +}; + static PyTypeObject sal_object_type = { PyObject_HEAD_INIT (NULL) 0, /*ob_size*/ @@ -518,7 +558,7 @@ static PyTypeObject sal_object_type = { 0, /*tp_weaklistoffset */ 0, /*tp_iter */ 0, /*tp_iternext */ - 0, /*tp_methods */ + sal_object_methods, /*tp_methods */ 0, /*tp_members */ sal_object_getset /*tp_getset */ }; |