69#define LTPY_REQUIRE_VALID(lt_obj, symtab) \
71 symtab = symtab_object_to_symtab (get_symtab (lt_obj)); \
74 PyErr_SetString (PyExc_RuntimeError, \
75 _("Symbol Table in line table is invalid."));\
136 for (i = 0; i < pcs.size (); ++i)
138 CORE_ADDR pc = pcs[i];
143 else if (PyTuple_SetItem (tuple.get (), i, obj.release ()) != 0)
147 return tuple.release ();
160 std::vector<CORE_ADDR> pcs;
171 catch (
const gdb_exception &except)
197 PyErr_SetString (PyExc_RuntimeError,
198 _(
"Linetable information not found in symbol table"));
205 if (item->
line == py_line)
227 PyErr_SetString (PyExc_RuntimeError,
228 _(
"Linetable information not found in symbol table"));
233 if (source_dict == NULL)
249 if (PyDict_SetItem (source_dict.get (), line.get (), Py_None) == -1)
254 return PyDict_Keys (source_dict.get ());
282 Py_TYPE (self)->tp_free (self);
355 if (ltpy_iter_obj == NULL)
359 ltpy_iter_obj->
source = self;
370 Py_DECREF (iter_obj->
source);
371 Py_TYPE (obj)->tp_free (obj);
402 PyErr_SetNone (PyExc_StopIteration);
411 while (item->
line < 1)
418 PyErr_SetNone (PyExc_StopIteration);
455 "line (lineno) -> Tuple\n\
456Return executable locations for a given source line." },
458 "has_line (lineno) -> Boolean\n\
459Return TRUE if this line has executable information, FALSE if not." },
461 "source_lines () -> List\n\
462Return a list of all executable source lines." },
464 "is_valid () -> Boolean.\n\
465Return True if this LineTable is valid, False if not." },
470 PyVarObject_HEAD_INIT (NULL, 0)
490 "GDB line table object",
511 "is_valid () -> Boolean.\n\
512Return True if this LineTable iterator is valid, False if not." },
517 PyVarObject_HEAD_INIT (NULL, 0)
518 "gdb.LineTableIterator",
537 "GDB line table iterator object",
550 "The line number in the source file.", NULL },
552 "The memory address for this line number.", NULL },
557 PyVarObject_HEAD_INIT (NULL, 0)
558 "gdb.LineTableEntry",
577 "GDB line table entry object",
static PyObject * ltpy_entry_get_pc(PyObject *self, void *closure)
static PyObject * ltpy_iterator(PyObject *self)
#define LTPY_REQUIRE_VALID(lt_obj, symtab)
PyObject * symtab_to_linetable_object(PyObject *symtab)
static void ltpy_dealloc(PyObject *self)
PyTypeObject linetable_object_type
static void ltpy_iterator_dealloc(PyObject *obj)
static PyMethodDef ltpy_iterator_methods[]
static PyObject * ltpy_get_all_source_lines(PyObject *self, PyObject *args)
static PyObject * get_symtab(PyObject *linetable)
static gdb_PyGetSetDef linetable_entry_object_getset[]
static PyObject * ltpy_iter(PyObject *self)
static PyObject * ltpy_get_pcs_for_line(PyObject *self, PyObject *args)
static PyObject * build_linetable_entry(int line, CORE_ADDR address)
static PyObject * ltpy_is_valid(PyObject *self, PyObject *args)
static PyObject * ltpy_iter_is_valid(PyObject *self, PyObject *args)
static PyMethodDef linetable_object_methods[]
static PyObject * ltpy_entry_get_line(PyObject *self, void *closure)
static PyObject * ltpy_has_line(PyObject *self, PyObject *args)
static PyObject * ltpy_iternext(PyObject *self)
static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION gdbpy_initialize_linetable(void)
PyTypeObject linetable_entry_object_type
PyTypeObject ltpy_iterator_object_type
static PyObject * build_line_table_tuple_from_pcs(int line, const std::vector< CORE_ADDR > &pcs)
gdb::ref_ptr< T, gdbpy_ref_policy< T > > gdbpy_ref
struct symtab * symtab_object_to_symtab(PyObject *obj)
gdbpy_ref gdb_py_object_from_longest(LONGEST l)
int gdb_pymodule_addobject(PyObject *module, const char *name, PyObject *object)
gdbpy_ref gdb_py_object_from_ulongest(ULONGEST l)
#define CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF(ARG)
#define CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
#define GDBPY_INITIALIZE_FILE(INIT,...)
#define GDB_PY_HANDLE_EXCEPTION(Exception)
struct objfile * objfile() const
CORE_ADDR pc(const struct objfile *objfile) const
PyObject_HEAD PyObject * symtab
struct linetable_entry item[1]
PyObject_HEAD int current_index
struct compunit_symtab * compunit() const
const struct linetable * linetable() const
std::vector< CORE_ADDR > find_pcs_for_symtab_line(struct symtab *symtab, int line, const linetable_entry **best_item)