GDB (xrefs)

Classes | Macros | Functions | Variables
py-linetable.c File Reference
`#include "defs.h"`
`#include "python-internal.h"`
`#include "py-ref.h"`

Go to the source code of this file.

## Classes
struct | linetable_entry_object
struct | linetable_object
struct | ltpy_iterator_object

## Macros
#define | LTPY_REQUIRE_VALID(lt_obj, symtab)

## Functions
PyTypeObject linetable_entry_object_type | CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("linetable_entry_object")
PyTypeObject linetable_object_type | CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("linetable_object")
PyTypeObject ltpy_iterator_object_type | CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("ltpy_iterator_object")
static PyObject * | get_symtab (PyObject *linetable)
PyObject * | symtab_to_linetable_object (PyObject *symtab)
static PyObject * | build_linetable_entry (int line, CORE_ADDR address)
static PyObject * | build_line_table_tuple_from_pcs (int line, const std::vector< CORE_ADDR > &pcs)
static PyObject * | ltpy_get_pcs_for_line (PyObject *self, PyObject *args)
static PyObject * | ltpy_has_line (PyObject *self, PyObject *args)
static PyObject * | ltpy_get_all_source_lines (PyObject *self, PyObject *args)
static PyObject * | ltpy_is_valid (PyObject *self, PyObject *args)
static void | ltpy_dealloc (PyObject *self)
int | gdbpy_initialize_linetable (void)
static PyObject * | ltpy_entry_get_line (PyObject *self, void *closure)
static PyObject * | ltpy_entry_get_pc (PyObject *self, void *closure)
static PyObject * | ltpy_iter (PyObject *self)
static void | ltpy_iterator_dealloc (PyObject *obj)
static PyObject * | ltpy_iterator (PyObject *self)
static PyObject * | ltpy_iternext (PyObject *self)
static PyObject * | ltpy_iter_is_valid (PyObject *self, PyObject *args)

## Variables
static PyMethodDef | linetable_object_methods []
PyTypeObject | linetable_object_type
static PyMethodDef | ltpy_iterator_methods []
PyTypeObject | ltpy_iterator_object_type
static gdb_PyGetSetDef | linetable_entry_object_getset []
PyTypeObject | linetable_entry_object_type

## Macro Definition Documentation

## ◆ LTPY_REQUIRE_VALID

#define LTPY_REQUIRE_VALID | ( |  | lt_obj,
|  |  | symtab
| ) |  |

Value:
do { \
symtab = symtab_object_to_symtab (get_symtab (lt_obj)); \
if (symtab == NULL) \
{ \
PyErr_SetString (PyExc_RuntimeError, \
_("Symbol Table in line table is invalid."));\
return NULL; \
} \
} while (0)
_
#define _(String)
Definition: gdb_locale.h:35
symtab_object_to_symtab
struct symtab * symtab_object_to_symtab(PyObject *obj)
Definition: py-symtab.c:462
symtab
Definition: symtab.h:1291
get_symtab
static PyObject * get_symtab(PyObject *linetable)
Definition: py-linetable.c:63

Definition at line 70 of file py-linetable.c.

Referenced by ltpy_get_all_source_lines(), ltpy_get_pcs_for_line(), ltpy_has_line(), ltpy_iter(), ltpy_iterator(), and ltpy_iternext().

## Function Documentation

## ◆ build_line_table_tuple_from_pcs()

static PyObject* build_line_table_tuple_from_pcs | ( | int | line,
|  | const std::vector< CORE_ADDR > & | pcs
| ) |  |
| static

Definition at line 125 of file py-linetable.c.

References build_linetable_entry(), gdb::ref_ptr< T, Policy >::get(), and gdb::ref_ptr< T, Policy >::release().

Referenced by ltpy_get_pcs_for_line().

## ◆ build_linetable_entry()

static PyObject* build_linetable_entry | ( | int | line,
|  | CORE_ADDR | address
| ) |  |
| static

Definition at line 103 of file py-linetable.c.

References linetable_entry_object::line, linetable_entry_object_type, and linetable_entry_object::pc.

Referenced by build_line_table_tuple_from_pcs(), and ltpy_iternext().

## ◆ CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF() [1/3]

PyTypeObject linetable_entry_object_type CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF | ( | "linetable_entry_object" |  | ) |

## ◆ CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF() [2/3]

PyTypeObject linetable_object_type CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF | ( | "linetable_object" |  | ) |

## ◆ CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF() [3/3]

PyTypeObject ltpy_iterator_object_type CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF | ( | "ltpy_iterator_object" |  | ) |

## ◆ gdbpy_initialize_linetable()

int gdbpy_initialize_linetable | ( | void |  | ) |

Definition at line 292 of file py-linetable.c.

References gdb_module, gdb_pymodule_addobject(), linetable_entry_object_type, linetable_object_type, and ltpy_iterator_object_type.

Referenced by do_start_initialization().

## ◆ get_symtab()

static PyObject* get_symtab | ( | PyObject * | linetable | ) |
| static

Definition at line 63 of file py-linetable.c.

References linetable_object::symtab.

Referenced by ltpy_is_valid(), and ltpy_iter_is_valid().

## ◆ ltpy_dealloc()

static void ltpy_dealloc | ( | PyObject * | self | ) |
| static

Definition at line 280 of file py-linetable.c.

References Py_DECREF, Py_TYPE, and linetable_object::symtab.

## ◆ ltpy_entry_get_line()

static PyObject* ltpy_entry_get_line | ( | PyObject * | self,
|  | void * | closure
| ) |  |
| static

Definition at line 326 of file py-linetable.c.

References gdb_py_object_from_longest(), and linetable_entry_object::line.

## ◆ ltpy_entry_get_pc()

static PyObject* ltpy_entry_get_pc | ( | PyObject * | self,
|  | void * | closure
| ) |  |
| static

Definition at line 337 of file py-linetable.c.

References gdb_py_object_from_longest(), and linetable_entry_object::pc.

## ◆ ltpy_get_all_source_lines()

static PyObject* ltpy_get_all_source_lines | ( | PyObject * | self,
|  | PyObject * | args
| ) |  |
| static

Definition at line 220 of file py-linetable.c.

References _, gdb_py_object_from_longest(), gdb::ref_ptr< T, Policy >::get(), linetable_entry::line, LTPY_REQUIRE_VALID, and SYMTAB_LINETABLE.

## ◆ ltpy_get_pcs_for_line()

static PyObject* ltpy_get_pcs_for_line | ( | PyObject * | self,
|  | PyObject * | args
| ) |  |
| static

Definition at line 156 of file py-linetable.c.

References build_line_table_tuple_from_pcs(), CATCH, END_CATCH, find_pcs_for_symtab_line(), GDB_PY_HANDLE_EXCEPTION, GDB_PY_LL_ARG, LTPY_REQUIRE_VALID, RETURN_MASK_ALL, and TRY.

## ◆ ltpy_has_line()

static PyObject* ltpy_has_line | ( | PyObject * | self,
|  | PyObject * | args
| ) |  |
| static

Definition at line 186 of file py-linetable.c.

References _, GDB_PY_LL_ARG, linetable_entry::line, LTPY_REQUIRE_VALID, and SYMTAB_LINETABLE.

## ◆ ltpy_is_valid()

static PyObject* ltpy_is_valid | ( | PyObject * | self,
|  | PyObject * | args
| ) |  |
| static

Definition at line 264 of file py-linetable.c.

References get_symtab(), and symtab_object_to_symtab().

## ◆ ltpy_iter()

static PyObject* ltpy_iter | ( | PyObject * | self | ) |
| static

Definition at line 349 of file py-linetable.c.

References ltpy_iterator_object::current_index, ltpy_iterator_object_type, LTPY_REQUIRE_VALID, and ltpy_iterator_object::source.

## ◆ ltpy_iter_is_valid()

static PyObject* ltpy_iter_is_valid | ( | PyObject * | self,
|  | PyObject * | args
| ) |  |
| static

Definition at line 437 of file py-linetable.c.

References get_symtab(), ltpy_iterator_object::source, and symtab_object_to_symtab().

## ◆ ltpy_iterator()

static PyObject* ltpy_iterator | ( | PyObject * | self | ) |
| static

Definition at line 379 of file py-linetable.c.

References LTPY_REQUIRE_VALID, and ltpy_iterator_object::source.

## ◆ ltpy_iterator_dealloc()

static void ltpy_iterator_dealloc | ( | PyObject * | obj | ) |
| static

Definition at line 369 of file py-linetable.c.

References Py_DECREF, and ltpy_iterator_object::source.

## ◆ ltpy_iternext()

static PyObject* ltpy_iternext | ( | PyObject * | self | ) |
| static

Definition at line 394 of file py-linetable.c.

References build_linetable_entry(), ltpy_iterator_object::current_index, linetable_entry::line, LTPY_REQUIRE_VALID, linetable_entry::pc, ltpy_iterator_object::source, and SYMTAB_LINETABLE.

## ◆ symtab_to_linetable_object()

PyObject* symtab_to_linetable_object | ( | PyObject * | symtab | ) |

Definition at line 86 of file py-linetable.c.

References linetable_object_type, and linetable_object::symtab.

Referenced by stpy_get_linetable().

## Variable Documentation

## ◆ linetable_entry_object_getset

gdb_PyGetSetDef linetable_entry_object_getset[]
| static

Initial value:
= {
{ "line", ltpy_entry_get_line, NULL,
"The line number in the source file.", NULL },
{ "pc", ltpy_entry_get_pc, NULL,
"The memory address for this line number.", NULL },
{ NULL }
}
ltpy_entry_get_pc
static PyObject * ltpy_entry_get_pc(PyObject *self, void *closure)
Definition: py-linetable.c:337
ltpy_entry_get_line
static PyObject * ltpy_entry_get_line(PyObject *self, void *closure)
Definition: py-linetable.c:326

Definition at line 547 of file py-linetable.c.

## ◆ linetable_entry_object_type

PyTypeObject linetable_entry_object_type

Definition at line 555 of file py-linetable.c.

Referenced by build_linetable_entry(), and gdbpy_initialize_linetable().

## ◆ linetable_object_methods

PyMethodDef linetable_object_methods[]
| static

Initial value:
= {
{ "line", ltpy_get_pcs_for_line, METH_VARARGS,
"line (lineno) -> Tuple\n\
Return executable locations for a given source line." },
{ "has_line", ltpy_has_line, METH_VARARGS,
"has_line (lineno) -> Boolean\n\
Return TRUE if this line has executable information, FALSE if not." },
{ "source_lines", ltpy_get_all_source_lines, METH_NOARGS,
"source_lines () -> List\n\
Return a list of all executable source lines." },
{ "is_valid", ltpy_is_valid, METH_NOARGS,
"is_valid () -> Boolean.\n\
Return True if this LineTable is valid, False if not." },
{NULL}
}
ltpy_get_all_source_lines
static PyObject * ltpy_get_all_source_lines(PyObject *self, PyObject *args)
Definition: py-linetable.c:220
ltpy_get_pcs_for_line
static PyObject * ltpy_get_pcs_for_line(PyObject *self, PyObject *args)
Definition: py-linetable.c:156
ltpy_is_valid
static PyObject * ltpy_is_valid(PyObject *self, PyObject *args)
Definition: py-linetable.c:264
ltpy_has_line
static PyObject * ltpy_has_line(PyObject *self, PyObject *args)
Definition: py-linetable.c:186

Definition at line 452 of file py-linetable.c.

## ◆ linetable_object_type

PyTypeObject linetable_object_type

Definition at line 468 of file py-linetable.c.

Referenced by gdbpy_initialize_linetable(), and symtab_to_linetable_object().

## ◆ ltpy_iterator_methods

PyMethodDef ltpy_iterator_methods[]
| static

Initial value:
= {
{ "is_valid", ltpy_iter_is_valid, METH_NOARGS,
"is_valid () -> Boolean.\n\
Return True if this LineTable iterator is valid, False if not." },
{NULL}
}
ltpy_iter_is_valid
static PyObject * ltpy_iter_is_valid(PyObject *self, PyObject *args)
Definition: py-linetable.c:437

Definition at line 508 of file py-linetable.c.

## ◆ ltpy_iterator_object_type

PyTypeObject ltpy_iterator_object_type

Initial value:
= {
PyVarObject_HEAD_INIT (NULL, 0)
"gdb.LineTableIterator",
sizeof (ltpy_iterator_object),
0,
ltpy_iterator_dealloc,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_ITER,
"GDB line table iterator object",
0,
0,
0,
0,
ltpy_iterator,
ltpy_iternext,
ltpy_iterator_methods
}
ltpy_iterator_dealloc
static void ltpy_iterator_dealloc(PyObject *obj)
Definition: py-linetable.c:369
PyVarObject_HEAD_INIT
#define PyVarObject_HEAD_INIT(type, size)
Definition: python-internal.h:133
ltpy_iterator_object
Definition: py-linetable.c:46
ltpy_iterator_methods
static PyMethodDef ltpy_iterator_methods[]
Definition: py-linetable.c:508
ltpy_iternext
static PyObject * ltpy_iternext(PyObject *self)
Definition: py-linetable.c:394
ltpy_iterator
static PyObject * ltpy_iterator(PyObject *self)
Definition: py-linetable.c:379

Definition at line 515 of file py-linetable.c.

Referenced by gdbpy_initialize_linetable(), and ltpy_iter().