X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fsymtab.c;h=d5e18a64d06c12d1153d2b8cb5fbb8ea4470a802;hb=1d94a5a36a614cf7ebe259d7660f4fa725f38ee2;hp=b32eca18faf7e7ba08ebb60d783fe070fb24bc13;hpb=5accd1a07e080c386918da413e0f9e90c4cab58a;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/symtab.c b/gdb/symtab.c index b32eca18fa..d5e18a64d0 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -707,14 +707,14 @@ eq_demangled_name_entry (const void *a, const void *b) name. The entry is hashed via just the mangled name. */ static void -create_demangled_names_hash (struct objfile *objfile) +create_demangled_names_hash (struct objfile_per_bfd_storage *per_bfd) { /* Choose 256 as the starting size of the hash table, somewhat arbitrarily. The hash table code will round this up to the next prime number. Choosing a much larger table size wastes memory, and saves only about 1% in symbol reading. */ - objfile->per_bfd->demangled_names_hash = htab_create_alloc + per_bfd->demangled_names_hash = htab_create_alloc (256, hash_demangled_name_entry, eq_demangled_name_entry, NULL, xcalloc, xfree); } @@ -772,13 +772,12 @@ symbol_find_demangled_name (struct general_symbol_info *gsymbol, void symbol_set_names (struct general_symbol_info *gsymbol, const char *linkage_name, int len, int copy_name, - struct objfile *objfile) + struct objfile_per_bfd_storage *per_bfd) { struct demangled_name_entry **slot; /* A 0-terminated copy of the linkage name. */ const char *linkage_name_copy; struct demangled_name_entry entry; - struct objfile_per_bfd_storage *per_bfd = objfile->per_bfd; if (gsymbol->language == language_ada) { @@ -801,7 +800,7 @@ symbol_set_names (struct general_symbol_info *gsymbol, } if (per_bfd->demangled_names_hash == NULL) - create_demangled_names_hash (objfile); + create_demangled_names_hash (per_bfd); if (linkage_name[len] != '\0') { @@ -3359,37 +3358,42 @@ find_line_symtab (struct symtab *sym_tab, int line, (objfile, symtab_to_fullname (sym_tab)); } - struct objfile *objfile; - ALL_FILETABS (objfile, cu, s) - { - struct linetable *l; - int ind; - - if (FILENAME_CMP (sym_tab->filename, s->filename) != 0) - continue; - if (FILENAME_CMP (symtab_to_fullname (sym_tab), - symtab_to_fullname (s)) != 0) - continue; - l = SYMTAB_LINETABLE (s); - ind = find_line_common (l, line, &exact, 0); - if (ind >= 0) - { - if (exact) - { - best_index = ind; - best_linetable = l; - best_symtab = s; - goto done; - } - if (best == 0 || l->item[ind].line < best) - { - best = l->item[ind].line; - best_index = ind; - best_linetable = l; - best_symtab = s; - } - } - } + for (objfile *objfile : all_objfiles (current_program_space)) + { + for (compunit_symtab *cu : objfile_compunits (objfile)) + { + for (symtab *s : compunit_filetabs (cu)) + { + struct linetable *l; + int ind; + + if (FILENAME_CMP (sym_tab->filename, s->filename) != 0) + continue; + if (FILENAME_CMP (symtab_to_fullname (sym_tab), + symtab_to_fullname (s)) != 0) + continue; + l = SYMTAB_LINETABLE (s); + ind = find_line_common (l, line, &exact, 0); + if (ind >= 0) + { + if (exact) + { + best_index = ind; + best_linetable = l; + best_symtab = s; + goto done; + } + if (best == 0 || l->item[ind].line < best) + { + best = l->item[ind].line; + best_index = ind; + best_linetable = l; + best_symtab = s; + } + } + } + } + } } done: if (best_index < 0) @@ -4180,7 +4184,6 @@ output_partial_symbol_filename (const char *filename, const char *fullname, static void info_sources_command (const char *ignore, int from_tty) { - struct objfile *objfile; struct output_source_filename_data data; if (!have_full_symbols () && !have_partial_symbols ()) @@ -4195,12 +4198,18 @@ info_sources_command (const char *ignore, int from_tty) printf_filtered ("Source files for which symbols have been read in:\n\n"); data.first = 1; - ALL_FILETABS (objfile, cu, s) - { - const char *fullname = symtab_to_fullname (s); + for (objfile *objfile : all_objfiles (current_program_space)) + { + for (compunit_symtab *cu : objfile_compunits (objfile)) + { + for (symtab *s : compunit_filetabs (cu)) + { + const char *fullname = symtab_to_fullname (s); - output_source_filename (fullname, &data); - } + output_source_filename (fullname, &data); + } + } + } printf_filtered ("\n\n"); printf_filtered ("Source files for which symbols " @@ -5581,7 +5590,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 objfile *objfile; size_t text_len = strlen (text); completion_list list; const char *base_name; @@ -5592,28 +5600,34 @@ make_source_files_completion_list (const char *text, const char *word) filename_seen_cache filenames_seen; - ALL_FILETABS (objfile, cu, s) + for (objfile *objfile : all_objfiles (current_program_space)) { - if (not_interesting_fname (s->filename)) - continue; - if (!filenames_seen.seen (s->filename) - && filename_ncmp (s->filename, text, text_len) == 0) - { - /* This file matches for a completion; add it to the current - list of matches. */ - add_filename_to_list (s->filename, text, word, &list); - } - else + for (compunit_symtab *cu : objfile_compunits (objfile)) { - /* NOTE: We allow the user to type a base name when the - debug info records leading directories, but not the other - way around. This is what subroutines of breakpoint - command do when they parse file names. */ - base_name = lbasename (s->filename); - if (base_name != s->filename - && !filenames_seen.seen (base_name) - && filename_ncmp (base_name, text, text_len) == 0) - add_filename_to_list (base_name, text, word, &list); + for (symtab *s : compunit_filetabs (cu)) + { + if (not_interesting_fname (s->filename)) + continue; + if (!filenames_seen.seen (s->filename) + && filename_ncmp (s->filename, text, text_len) == 0) + { + /* This file matches for a completion; add it to the current + list of matches. */ + add_filename_to_list (s->filename, text, word, &list); + } + else + { + /* NOTE: We allow the user to type a base name when the + debug info records leading directories, but not the other + way around. This is what subroutines of breakpoint + command do when they parse file names. */ + base_name = lbasename (s->filename); + if (base_name != s->filename + && !filenames_seen.seen (base_name) + && filename_ncmp (base_name, text, text_len) == 0) + add_filename_to_list (base_name, text, word, &list); + } + } } }