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
This commit is contained in:
Simon Marchi
2021-11-20 08:40:12 -05:00
committed by Simon Marchi
parent c615965258
commit 5b6074611e
11 changed files with 64 additions and 57 deletions

View File

@@ -393,10 +393,10 @@ do_mixed_source_and_assembly_deprecated
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;
@@ -535,7 +535,7 @@ do_mixed_source_and_assembly (struct gdbarch *gdbarch,
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.
@@ -553,8 +553,8 @@ do_mixed_source_and_assembly (struct gdbarch *gdbarch,
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. */
@@ -850,8 +850,8 @@ gdb_disassembly (struct gdbarch *gdbarch, struct ui_out *uiout,
/* 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)