70 #define LTPY_REQUIRE_VALID(lt_obj, symtab) \ 72 symtab = symtab_object_to_symtab (get_symtab (lt_obj)); \ 75 PyErr_SetString (PyExc_RuntimeError, \ 76 _("Symbol Table in line table is invalid."));\ 96 return (PyObject *) ltable;
115 return (PyObject *) obj;
137 for (i = 0; i < pcs.size (); ++i)
144 else if (PyTuple_SetItem (tuple.
get (), i, obj.
release ()) != 0)
161 std::vector<CORE_ADDR> pcs;
199 PyErr_SetString (PyExc_RuntimeError,
200 _(
"Linetable information not found in symbol table"));
207 if (item->
line == py_line)
230 PyErr_SetString (PyExc_RuntimeError,
231 _(
"Linetable information not found in symbol table"));
236 if (source_dict == NULL)
252 if (PyDict_SetItem (source_dict.
get (),
line.get (), Py_None) == -1)
257 return PyDict_Keys (source_dict.
get ());
285 Py_TYPE (
self)->tp_free (
self);
358 if (ltpy_iter_obj == NULL)
362 ltpy_iter_obj->
source =
self;
365 return (PyObject *) ltpy_iter_obj;
405 PyErr_SetNone (PyExc_StopIteration);
413 while (item->
line < 1)
420 PyErr_SetNone (PyExc_StopIteration);
454 "line (lineno) -> Tuple\n\ 455 Return executable locations for a given source line." },
457 "has_line (lineno) -> Boolean\n\ 458 Return TRUE if this line has executable information, FALSE if not." },
460 "source_lines () -> List\n\ 461 Return a list of all executable source lines." },
463 "is_valid () -> Boolean.\n\ 464 Return True if this LineTable is valid, False if not." },
489 "GDB line table object",
510 "is_valid () -> Boolean.\n\ 511 Return True if this LineTable iterator is valid, False if not." },
517 "gdb.LineTableIterator",
535 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_ITER,
536 "GDB line table iterator object",
549 "The line number in the source file.", NULL },
551 "The memory address for this line number.", NULL },
557 "gdb.LineTableEntry",
576 "GDB line table entry object",
static void ltpy_iterator_dealloc(PyObject *obj)
int gdb_pymodule_addobject(PyObject *module, const char *name, PyObject *object)
PyObject_HEAD PyObject * symtab
PyTypeObject ltpy_iterator_object_type
PyTypeObject linetable_entry_object_type CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF("linetable_entry_object")
#define LTPY_REQUIRE_VALID(lt_obj, symtab)
PyObject_HEAD int current_index
static PyObject * ltpy_get_all_source_lines(PyObject *self, PyObject *args)
static PyObject * ltpy_entry_get_pc(PyObject *self, void *closure)
PyTypeObject linetable_entry_object_type
PyObject * symtab_to_linetable_object(PyObject *symtab)
static PyObject * ltpy_get_pcs_for_line(PyObject *self, PyObject *args)
#define PyVarObject_HEAD_INIT(type, size)
PyTypeObject linetable_object_type
std::vector< CORE_ADDR > find_pcs_for_symtab_line(struct symtab *symtab, int line, struct linetable_entry **best_item)
#define GDB_PY_HANDLE_EXCEPTION(Exception)
static PyObject * ltpy_is_valid(PyObject *self, PyObject *args)
#define CATCH(EXCEPTION, MASK)
static PyObject * ltpy_entry_get_line(PyObject *self, void *closure)
PyObject * gdb_py_object_from_longest(LONGEST l)
struct symtab * symtab_object_to_symtab(PyObject *obj)
static gdb_PyGetSetDef linetable_entry_object_getset[]
static PyMethodDef ltpy_iterator_methods[]
static PyObject * ltpy_iter(PyObject *self)
static PyObject * ltpy_iternext(PyObject *self)
static PyObject * get_symtab(PyObject *linetable)
static void ltpy_dealloc(PyObject *self)
static PyObject * ltpy_iterator(PyObject *self)
int gdbpy_initialize_linetable(void)
static PyObject * ltpy_iter_is_valid(PyObject *self, PyObject *args)
static PyObject * build_linetable_entry(int line, CORE_ADDR address)
static PyObject * ltpy_has_line(PyObject *self, PyObject *args)
#define SYMTAB_LINETABLE(symtab)
static PyMethodDef linetable_object_methods[]
static PyObject * build_line_table_tuple_from_pcs(int line, const std::vector< CORE_ADDR > &pcs)