From 5b6074611edfdd1590e8da1ca443950b47942bbb Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Sat, 20 Nov 2021 08:40:12 -0500 Subject: gdb: remove SYMTAB_LINETABLE macro, add getter/setter Add a getter and a setter for a symtab's linetable. Remove the corresponding macro and adjust all callers. Change-Id: I159183fc0ccd8e18ab937b3c2f09ef2244ec6e9c --- gdb/python/py-linetable.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'gdb/python') diff --git a/gdb/python/py-linetable.c b/gdb/python/py-linetable.c index dfd4cbe..8e545fe 100644 --- a/gdb/python/py-linetable.c +++ b/gdb/python/py-linetable.c @@ -192,16 +192,16 @@ ltpy_has_line (PyObject *self, PyObject *args) if (! PyArg_ParseTuple (args, GDB_PY_LL_ARG, &py_line)) return NULL; - if (SYMTAB_LINETABLE (symtab) == NULL) + if (symtab->linetable () == NULL) { PyErr_SetString (PyExc_RuntimeError, _("Linetable information not found in symbol table")); return NULL; } - for (index = 0; index < SYMTAB_LINETABLE (symtab)->nitems; index++) + for (index = 0; index < symtab->linetable ()->nitems; index++) { - struct linetable_entry *item = &(SYMTAB_LINETABLE (symtab)->item[index]); + struct linetable_entry *item = &(symtab->linetable ()->item[index]); if (item->line == py_line) Py_RETURN_TRUE; } @@ -223,7 +223,7 @@ ltpy_get_all_source_lines (PyObject *self, PyObject *args) LTPY_REQUIRE_VALID (self, symtab); - if (SYMTAB_LINETABLE (symtab) == NULL) + if (symtab->linetable () == NULL) { PyErr_SetString (PyExc_RuntimeError, _("Linetable information not found in symbol table")); @@ -234,9 +234,9 @@ ltpy_get_all_source_lines (PyObject *self, PyObject *args) if (source_dict == NULL) return NULL; - for (index = 0; index < SYMTAB_LINETABLE (symtab)->nitems; index++) + for (index = 0; index < symtab->linetable ()->nitems; index++) { - item = &(SYMTAB_LINETABLE (symtab)->item[index]); + item = &(symtab->linetable ()->item[index]); /* 0 is used to signify end of line table information. Do not include in the source set. */ @@ -399,13 +399,13 @@ ltpy_iternext (PyObject *self) LTPY_REQUIRE_VALID (iter_obj->source, symtab); - if (iter_obj->current_index >= SYMTAB_LINETABLE (symtab)->nitems) + if (iter_obj->current_index >= symtab->linetable ()->nitems) { PyErr_SetNone (PyExc_StopIteration); return NULL; } - item = &(SYMTAB_LINETABLE (symtab)->item[iter_obj->current_index]); + item = &(symtab->linetable ()->item[iter_obj->current_index]); /* Skip over internal entries such as 0. 0 signifies the end of line table data and is not useful to the API user. */ @@ -414,12 +414,12 @@ ltpy_iternext (PyObject *self) iter_obj->current_index++; /* Exit if the internal value is the last item in the line table. */ - if (iter_obj->current_index >= SYMTAB_LINETABLE (symtab)->nitems) + if (iter_obj->current_index >= symtab->linetable ()->nitems) { PyErr_SetNone (PyExc_StopIteration); return NULL; } - item = &(SYMTAB_LINETABLE (symtab)->item[iter_obj->current_index]); + item = &(symtab->linetable ()->item[iter_obj->current_index]); } obj = build_linetable_entry (item->line, item->pc); -- cgit v1.1