if (subfile->line_vector)
{
/* Reallocate the line table on the symbol obstack. */
- SYMTAB_LINETABLE (symtab) = (struct linetable *)
- obstack_alloc (&m_objfile->objfile_obstack, linetablesize);
- memcpy (SYMTAB_LINETABLE (symtab), subfile->line_vector,
- linetablesize);
+ symtab->set_linetable
+ ((struct linetable *)
+ obstack_alloc (&m_objfile->objfile_obstack, linetablesize));
+ memcpy (symtab->linetable (), subfile->line_vector, linetablesize);
}
else
- {
- SYMTAB_LINETABLE (symtab) = NULL;
- }
+ symtab->set_linetable (nullptr);
/* Use whatever language we have been using for this
subfile, not the one that was deduced in allocate_symtab
int num_displayed = 0;
print_source_lines_flags psl_flags = 0;
- gdb_assert (symtab != NULL && SYMTAB_LINETABLE (symtab) != NULL);
+ gdb_assert (symtab != nullptr && symtab->linetable () != nullptr);
- nlines = SYMTAB_LINETABLE (symtab)->nitems;
- le = SYMTAB_LINETABLE (symtab)->item;
+ nlines = symtab->linetable ()->nitems;
+ le = symtab->linetable ()->item;
if (flags & DISASSEMBLY_FILENAME)
psl_flags |= PRINT_SOURCE_LINES_FILENAME;
struct symtab *last_symtab;
int last_line;
- gdb_assert (main_symtab != NULL && SYMTAB_LINETABLE (main_symtab) != NULL);
+ gdb_assert (main_symtab != NULL && main_symtab->linetable () != NULL);
/* First pass: collect the list of all source files and lines.
We do this so that we can only print lines containing code once.
line after the opening brace. We still want to print this opening brace.
first_le is used to implement this. */
- nlines = SYMTAB_LINETABLE (main_symtab)->nitems;
- le = SYMTAB_LINETABLE (main_symtab)->item;
+ nlines = main_symtab->linetable ()->nitems;
+ le = main_symtab->linetable ()->item;
first_le = NULL;
/* Skip all the preceding functions. */
/* Assume symtab is valid for whole PC range. */
symtab = find_pc_line_symtab (low);
- if (symtab != NULL && SYMTAB_LINETABLE (symtab) != NULL)
- nlines = SYMTAB_LINETABLE (symtab)->nitems;
+ if (symtab != NULL && symtab->linetable () != NULL)
+ nlines = symtab->linetable ()->nitems;
if (!(flags & (DISASSEMBLY_SOURCE_DEPRECATED | DISASSEMBLY_SOURCE))
|| nlines <= 0)
size_t size = ((stab->linetable->nitems - 1)
* sizeof (struct linetable_entry)
+ sizeof (struct linetable));
- SYMTAB_LINETABLE (filetab)
- = (struct linetable *) obstack_alloc (&objfile->objfile_obstack, size);
- memcpy (SYMTAB_LINETABLE (filetab),
- stab->linetable.get (), size);
+ filetab->set_linetable ((struct linetable *)
+ obstack_alloc (&objfile->objfile_obstack, size));
+ memcpy (filetab->linetable (), stab->linetable.get (), size);
}
blockvector_size = (sizeof (struct blockvector)
psymtab_language = cust->primary_filetab ()->language;
- lines = SYMTAB_LINETABLE (cust->primary_filetab ());
+ lines = cust->primary_filetab ()->linetable ();
/* Get a new lexical context. */
size = lines->nitems;
if (size > 1)
--size;
- SYMTAB_LINETABLE (cust->primary_filetab ())
- = ((struct linetable *)
- obstack_copy (&mdebugread_objfile->objfile_obstack,
- lines, (sizeof (struct linetable)
- + size * sizeof (lines->item))));
+ cust->primary_filetab ()->set_linetable
+ ((struct linetable *)
+ obstack_copy (&mdebugread_objfile->objfile_obstack,
+ lines, (sizeof (struct linetable)
+ + size * sizeof (lines->item))));
xfree (lines);
/* .. and our share of externals.
add_compunit_symtab_to_objfile (cust);
symtab = allocate_symtab (cust, name);
- SYMTAB_LINETABLE (symtab) = new_linetable (maxlines);
+ symtab->set_linetable (new_linetable (maxlines));
lang = compunit_language (cust);
/* All symtabs must have at least two blocks. */
gdbarch = SYMTAB_OBJFILE (s)->arch ();
ui_out_emit_list list_emitter (uiout, "lines");
- if (SYMTAB_LINETABLE (s) != NULL && SYMTAB_LINETABLE (s)->nitems > 0)
- for (i = 0; i < SYMTAB_LINETABLE (s)->nitems; i++)
+ if (s->linetable () != NULL && s->linetable ()->nitems > 0)
+ for (i = 0; i < s->linetable ()->nitems; i++)
{
ui_out_emit_tuple tuple_emitter (uiout, NULL);
- uiout->field_core_addr ("pc", gdbarch, SYMTAB_LINETABLE (s)->item[i].pc);
- uiout->field_signed ("line", SYMTAB_LINETABLE (s)->item[i].line);
+ uiout->field_core_addr ("pc", gdbarch, s->linetable ()->item[i].pc);
+ uiout->field_signed ("line", s->linetable ()->item[i].line);
}
}
struct linetable *l;
/* First the line table. */
- l = SYMTAB_LINETABLE (s);
+ l = s->linetable ();
if (l)
{
for (int i = 0; i < l->nitems; ++i)
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;
}
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"));
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. */
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. */
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);
if (symtab == NULL)
return btrace_mk_line_range (NULL, 0, 0);
- ltable = SYMTAB_LINETABLE (symtab);
+ ltable = symtab->linetable ();
if (ltable == NULL)
return btrace_mk_line_range (symtab, 0, 0);
for (symtab *s : cu->filetabs ())
{
i++;
- if (SYMTAB_LINETABLE (s) != NULL)
+ if (s->linetable () != NULL)
linetables++;
}
}
language_str (symtab->language));
/* First print the line table. */
- l = SYMTAB_LINETABLE (symtab);
+ l = symtab->linetable ();
if (l)
{
fprintf_filtered (outfile, "\nLine table:\n\n");
: "(null)");
printf_filtered ("\t "
"linetable ((struct linetable *) %s)\n",
- host_address_to_string (symtab->linetable));
+ host_address_to_string
+ (symtab->linetable ()));
printf_filtered ("\t}\n");
}
}
styled_string (file_name_style.style (),
symtab_to_fullname (symtab)),
host_address_to_string (symtab));
- linetable = SYMTAB_LINETABLE (symtab);
+ linetable = symtab->linetable ();
printf_filtered (_("linetable: ((struct linetable *) %s):\n"),
host_address_to_string (linetable));
for (symtab *iter_s : cust->filetabs ())
{
/* Find the best line in this symtab. */
- l = SYMTAB_LINETABLE (iter_s);
+ l = iter_s->linetable ();
if (!l)
continue;
len = l->nitems;
struct symtab *best_symtab;
/* First try looking it up in the given symtab. */
- best_linetable = SYMTAB_LINETABLE (sym_tab);
+ best_linetable = sym_tab->linetable ();
best_symtab = sym_tab;
best_index = find_line_common (best_linetable, line, &exact, 0);
if (best_index < 0 || !exact)
if (FILENAME_CMP (symtab_to_fullname (sym_tab),
symtab_to_fullname (s)) != 0)
continue;
- l = SYMTAB_LINETABLE (s);
+ l = s->linetable ();
ind = find_line_common (l, line, &exact, 0);
if (ind >= 0)
{
int was_exact;
int idx;
- idx = find_line_common (SYMTAB_LINETABLE (symtab), line, &was_exact,
+ idx = find_line_common (symtab->linetable (), line, &was_exact,
start);
if (idx < 0)
break;
if (!was_exact)
{
- struct linetable_entry *item = &SYMTAB_LINETABLE (symtab)->item[idx];
+ struct linetable_entry *item = &symtab->linetable ()->item[idx];
if (*best_item == NULL
|| (item->line < (*best_item)->line && item->is_stmt))
break;
}
- result.push_back (SYMTAB_LINETABLE (symtab)->item[idx].pc);
+ result.push_back (symtab->linetable ()->item[idx].pc);
start = idx + 1;
}
symtab = find_line_symtab (symtab, line, &ind, NULL);
if (symtab != NULL)
{
- l = SYMTAB_LINETABLE (symtab);
+ l = symtab->linetable ();
*pc = l->item[ind].pc;
return true;
}
int i;
/* Give up if this symbol has no lineinfo table. */
- l = SYMTAB_LINETABLE (symtab);
+ l = symtab->linetable ();
if (l == NULL)
return func_addr;
do this. */
if (prologue_sal.symtab->language != language_asm)
{
- struct linetable *linetable = SYMTAB_LINETABLE (prologue_sal.symtab);
+ struct linetable *linetable = prologue_sal.symtab->linetable ();
int idx = 0;
/* Skip any earlier lines, and any end-of-sequence marker
m_compunit = compunit;
}
+ struct linetable *linetable () const
+ {
+ return m_linetable;
+ }
+
+ void set_linetable (struct linetable *linetable)
+ {
+ m_linetable = linetable;
+ }
+
/* Unordered chain of all filetabs in the compunit, with the exception
that the "main" source file is the first entry in the list. */
/* Table mapping core addresses to line numbers for this file.
Can be NULL if none. Never shared between different symtabs. */
- struct linetable *linetable;
+ struct linetable *m_linetable;
/* Name of this source file. This pointer is never NULL. */
using symtab_range = next_range<symtab>;
-#define SYMTAB_LINETABLE(symtab) ((symtab)->linetable)
#define SYMTAB_LANGUAGE(symtab) ((symtab)->language)
#define SYMTAB_BLOCKVECTOR(symtab) \
(symtab->compunit ()->blockvector ())