summaryrefslogtreecommitdiff
path: root/gdb/symtab.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2018-11-24 09:49:24 -0700
committerTom Tromey <tom@tromey.com>2019-01-09 18:28:15 -0700
commit5accd1a07e080c386918da413e0f9e90c4cab58a (patch)
treee57e6b4dbc75344a342a52a15e4d6bcbfcabadae /gdb/symtab.c
parentd8aeb77f040ced7d37ab83f032b2e4ded2c81ca5 (diff)
downloadbinutils-gdb-5accd1a07e080c386918da413e0f9e90c4cab58a.tar.gz
Remove ALL_COMPUNIT_FILETABS
This removes ALL_COMPUNIT_FILETABS, replacing its uses with ranged for loops. Because this is still used in the ALL_OBJFILE_FILETABS macro, in some places a declaration had to be removed or renamed to avoid shadowing. gdb/ChangeLog 2019-01-09 Tom Tromey <tom@tromey.com> * symtab.h (ALL_COMPUNIT_FILETABS): Remove. (compunit_filetabs): New. * symtab.c (iterate_over_some_symtabs, find_pc_sect_line): Use compunit_filetabs. (info_sources_command, make_source_files_completion_list): Remove declaration. * symmisc.c (print_objfile_statistics, dump_objfile) (maintenance_print_symbols): Remove declaration. (maintenance_info_symtabs): Use compunit_filetabs. (maintenance_info_line_tables): Likewise. * source.c (select_source_symtab): Change local variable name. (forget_cached_source_info_for_objfile): Remove declaration. * objfiles.h (ALL_OBJFILE_FILETABS): Use compunit_filetabs. * objfiles.c (objfile_relocate1): Remove declaration. * mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_files): Remove declaration. * maint.c (count_symtabs_and_blocks): Use compunit_filetabs. * coffread.c (coff_symtab_read): Remove declaration. * buildsym.c (buildsym_compunit::end_symtab_with_blockvector): Use compunit_filetabs.
Diffstat (limited to 'gdb/symtab.c')
-rw-r--r--gdb/symtab.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/gdb/symtab.c b/gdb/symtab.c
index e6e001bcd22..b32eca18faf 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -405,12 +405,11 @@ iterate_over_some_symtabs (const char *name,
gdb::function_view<bool (symtab *)> callback)
{
struct compunit_symtab *cust;
- struct symtab *s;
const char* base_name = lbasename (name);
for (cust = first; cust != NULL && cust != after_last; cust = cust->next)
{
- ALL_COMPUNIT_FILETABS (cust, s)
+ for (symtab *s : compunit_filetabs (cust))
{
if (compare_filenames_for_search (s->filename, name))
{
@@ -3050,7 +3049,6 @@ struct symtab_and_line
find_pc_sect_line (CORE_ADDR pc, struct obj_section *section, int notcurrent)
{
struct compunit_symtab *cust;
- struct symtab *iter_s;
struct linetable *l;
int len;
struct linetable_entry *item;
@@ -3187,7 +3185,7 @@ find_pc_sect_line (CORE_ADDR pc, struct obj_section *section, int notcurrent)
They all have the same apriori range, that we found was right;
but they have different line tables. */
- ALL_COMPUNIT_FILETABS (cust, iter_s)
+ for (symtab *iter_s : compunit_filetabs (cust))
{
/* Find the best line in this symtab. */
l = SYMTAB_LINETABLE (iter_s);
@@ -3319,7 +3317,7 @@ find_pc_line_symtab (CORE_ADDR pc)
If not found, return NULL. */
struct symtab *
-find_line_symtab (struct symtab *symtab, int line,
+find_line_symtab (struct symtab *sym_tab, int line,
int *index, int *exact_match)
{
int exact = 0; /* Initialized here to avoid a compiler warning. */
@@ -3332,8 +3330,8 @@ find_line_symtab (struct symtab *symtab, int line,
struct symtab *best_symtab;
/* First try looking it up in the given symtab. */
- best_linetable = SYMTAB_LINETABLE (symtab);
- best_symtab = symtab;
+ best_linetable = SYMTAB_LINETABLE (sym_tab);
+ best_symtab = sym_tab;
best_index = find_line_common (best_linetable, line, &exact, 0);
if (best_index < 0 || !exact)
{
@@ -3349,8 +3347,6 @@ find_line_symtab (struct symtab *symtab, int line,
BEST_INDEX and BEST_LINETABLE identify the item for it. */
int best;
- struct symtab *s;
-
if (best_index >= 0)
best = best_linetable->item[best_index].line;
else
@@ -3360,7 +3356,7 @@ find_line_symtab (struct symtab *symtab, int line,
{
if (objfile->sf)
objfile->sf->qf->expand_symtabs_with_fullname
- (objfile, symtab_to_fullname (symtab));
+ (objfile, symtab_to_fullname (sym_tab));
}
struct objfile *objfile;
@@ -3369,9 +3365,9 @@ find_line_symtab (struct symtab *symtab, int line,
struct linetable *l;
int ind;
- if (FILENAME_CMP (symtab->filename, s->filename) != 0)
+ if (FILENAME_CMP (sym_tab->filename, s->filename) != 0)
continue;
- if (FILENAME_CMP (symtab_to_fullname (symtab),
+ if (FILENAME_CMP (symtab_to_fullname (sym_tab),
symtab_to_fullname (s)) != 0)
continue;
l = SYMTAB_LINETABLE (s);
@@ -4184,7 +4180,6 @@ output_partial_symbol_filename (const char *filename, const char *fullname,
static void
info_sources_command (const char *ignore, int from_tty)
{
- struct symtab *s;
struct objfile *objfile;
struct output_source_filename_data data;
@@ -5586,7 +5581,6 @@ maybe_add_partial_symtab_filename (const char *filename, const char *fullname,
completion_list
make_source_files_completion_list (const char *text, const char *word)
{
- struct symtab *s;
struct objfile *objfile;
size_t text_len = strlen (text);
completion_list list;