diff options
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 20 | ||||
-rw-r--r-- | gdb/elfread.c | 7 | ||||
-rw-r--r-- | gdb/guile/scm-progspace.c | 17 | ||||
-rw-r--r-- | gdb/objfiles.c | 9 | ||||
-rw-r--r-- | gdb/objfiles.h | 5 | ||||
-rw-r--r-- | gdb/probe.c | 4 | ||||
-rw-r--r-- | gdb/psymtab.c | 190 | ||||
-rw-r--r-- | gdb/python/py-progspace.c | 4 | ||||
-rw-r--r-- | gdb/source.c | 9 | ||||
-rw-r--r-- | gdb/symfile-debug.c | 27 | ||||
-rw-r--r-- | gdb/symmisc.c | 425 |
11 files changed, 359 insertions, 358 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 62338d7..d7d1876 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,25 @@ 2019-01-09 Tom Tromey <tom@tromey.com> + * probe.c (parse_probes_in_pspace): Use all_objfiles. + * guile/scm-progspace.c (gdbscm_progspace_objfiles): Use + all_objfiles. + * objfiles.h (ALL_PSPACE_OBJFILES): Remove. + * symmisc.c (print_symbol_bcache_statistics) + (print_objfile_statistics, maintenance_print_objfiles) + (maintenance_info_symtabs, maintenance_check_symtabs) + (maintenance_expand_symtabs, maintenance_info_line_tables): Use + all_objfiles. + * source.c (forget_cached_source_info): Use all_objfiles. + * symfile-debug.c (set_debug_symfile): Use all_objfiles. + * elfread.c (elf_gnu_ifunc_resolve_by_cache) + (elf_gnu_ifunc_resolve_by_got): Use all_objfiles. + * objfiles.c (update_section_map): Use all_objfiles. + (shared_objfile_contains_address_p): Likewise. + * psymtab.c (maintenance_info_psymtabs): Use all_objfiles. + * python/py-progspace.c (pspy_get_objfiles): Use all_objfiles. + +2019-01-09 Tom Tromey <tom@tromey.com> + * common/next-iterator.h: New file. * objfiles.h (class all_objfiles): New. (struct objfile_iterator): New. diff --git a/gdb/elfread.c b/gdb/elfread.c index b6f34d9..9d35feb 100644 --- a/gdb/elfread.c +++ b/gdb/elfread.c @@ -758,9 +758,7 @@ elf_gnu_ifunc_record_cache (const char *name, CORE_ADDR addr) static int elf_gnu_ifunc_resolve_by_cache (const char *name, CORE_ADDR *addr_p) { - struct objfile *objfile; - - ALL_PSPACE_OBJFILES (current_program_space, objfile) + for (objfile *objfile : all_objfiles (current_program_space)) { htab_t htab; struct elf_gnu_ifunc_cache *entry_p; @@ -800,13 +798,12 @@ static int elf_gnu_ifunc_resolve_by_got (const char *name, CORE_ADDR *addr_p) { char *name_got_plt; - struct objfile *objfile; const size_t got_suffix_len = strlen (SYMBOL_GOT_PLT_SUFFIX); name_got_plt = (char *) alloca (strlen (name) + got_suffix_len + 1); sprintf (name_got_plt, "%s" SYMBOL_GOT_PLT_SUFFIX, name); - ALL_PSPACE_OBJFILES (current_program_space, objfile) + for (objfile *objfile : all_objfiles (current_program_space)) { bfd *obfd = objfile->obfd; struct gdbarch *gdbarch = get_objfile_arch (objfile); diff --git a/gdb/guile/scm-progspace.c b/gdb/guile/scm-progspace.c index 57c88d3..9fc650c 100644 --- a/gdb/guile/scm-progspace.c +++ b/gdb/guile/scm-progspace.c @@ -285,20 +285,19 @@ gdbscm_progspace_objfiles (SCM self) { pspace_smob *p_smob = psscm_get_valid_pspace_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME); - struct objfile *objfile; SCM result; result = SCM_EOL; - ALL_PSPACE_OBJFILES (p_smob->pspace, objfile) - { - if (objfile->separate_debug_objfile_backlink == NULL) - { - SCM item = ofscm_scm_from_objfile (objfile); + for (objfile *objfile : all_objfiles (p_smob->pspace)) + { + if (objfile->separate_debug_objfile_backlink == NULL) + { + SCM item = ofscm_scm_from_objfile (objfile); - result = scm_cons (item, result); - } - } + result = scm_cons (item, result); + } + } /* We don't really have to return the list in the same order as recorded internally, but for consistency we do. We still advertise that one diff --git a/gdb/objfiles.c b/gdb/objfiles.c index 4776b60..f8a0dc2 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -1322,7 +1322,6 @@ update_section_map (struct program_space *pspace, struct objfile_pspace_info *pspace_info; int alloc_size, map_size, i; struct obj_section *s, **map; - struct objfile *objfile; pspace_info = get_objfile_pspace_data (pspace); gdb_assert (pspace_info->section_map_dirty != 0 @@ -1332,7 +1331,7 @@ update_section_map (struct program_space *pspace, xfree (map); alloc_size = 0; - ALL_PSPACE_OBJFILES (pspace, objfile) + for (objfile *objfile : all_objfiles (pspace)) ALL_OBJFILE_OSECTIONS (objfile, s) if (insert_section_p (objfile->obfd, s->the_bfd_section)) alloc_size += 1; @@ -1348,7 +1347,7 @@ update_section_map (struct program_space *pspace, map = XNEWVEC (struct obj_section *, alloc_size); i = 0; - ALL_PSPACE_OBJFILES (pspace, objfile) + for (objfile *objfile : all_objfiles (pspace)) ALL_OBJFILE_OSECTIONS (objfile, s) if (insert_section_p (objfile->obfd, s->the_bfd_section)) map[i++] = s; @@ -1492,9 +1491,7 @@ int shared_objfile_contains_address_p (struct program_space *pspace, CORE_ADDR address) { - struct objfile *objfile; - - ALL_PSPACE_OBJFILES (pspace, objfile) + for (objfile *objfile : all_objfiles (pspace)) { if ((objfile->flags & OBJF_SHARED) != 0 && is_addr_in_objfile (address, objfile)) diff --git a/gdb/objfiles.h b/gdb/objfiles.h index 8d7a3c3..512869f 100644 --- a/gdb/objfiles.h +++ b/gdb/objfiles.h @@ -586,11 +586,6 @@ public: ALL_OBJFILES_SAFE works even if you delete the objfile during the traversal. */ -/* Traverse all object files in program space SS. */ - -#define ALL_PSPACE_OBJFILES(ss, obj) \ - for ((obj) = ss->objfiles; (obj) != NULL; (obj) = (obj)->next) - #define ALL_OBJFILES(obj) \ for ((obj) = current_program_space->objfiles; \ (obj) != NULL; \ diff --git a/gdb/probe.c b/gdb/probe.c index 5f42f9b..865c13f 100644 --- a/gdb/probe.c +++ b/gdb/probe.c @@ -73,9 +73,7 @@ parse_probes_in_pspace (const static_probe_ops *spops, const char *name, std::vector<symtab_and_line> *result) { - struct objfile *objfile; - - ALL_PSPACE_OBJFILES (search_pspace, objfile) + for (objfile *objfile : all_objfiles (search_pspace)) { if (!objfile->sf || !objfile->sf->sym_probe_fns) continue; diff --git a/gdb/psymtab.c b/gdb/psymtab.c index f14aae6..804558e 100644 --- a/gdb/psymtab.c +++ b/gdb/psymtab.c @@ -2031,106 +2031,112 @@ static void maintenance_info_psymtabs (const char *regexp, int from_tty) { struct program_space *pspace; - struct objfile *objfile; if (regexp) re_comp (regexp); ALL_PSPACES (pspace) - ALL_PSPACE_OBJFILES (pspace, objfile) - { - struct gdbarch *gdbarch = get_objfile_arch (objfile); - struct partial_symtab *psymtab; - - /* We don't want to print anything for this objfile until we - actually find a symtab whose name matches. */ - int printed_objfile_start = 0; - - ALL_OBJFILE_PSYMTABS_REQUIRED (objfile, psymtab) - { - QUIT; - - if (! regexp - || re_exec (psymtab->filename)) - { - if (! printed_objfile_start) - { - printf_filtered ("{ objfile %s ", objfile_name (objfile)); - wrap_here (" "); - printf_filtered ("((struct objfile *) %s)\n", - host_address_to_string (objfile)); - printed_objfile_start = 1; - } - - printf_filtered (" { psymtab %s ", psymtab->filename); - wrap_here (" "); - printf_filtered ("((struct partial_symtab *) %s)\n", - host_address_to_string (psymtab)); - - printf_filtered (" readin %s\n", - psymtab->readin ? "yes" : "no"); - printf_filtered (" fullname %s\n", - psymtab->fullname - ? psymtab->fullname : "(null)"); - printf_filtered (" text addresses "); - fputs_filtered (paddress (gdbarch, psymtab->text_low (objfile)), - gdb_stdout); - printf_filtered (" -- "); - fputs_filtered (paddress (gdbarch, psymtab->text_high (objfile)), - gdb_stdout); - printf_filtered ("\n"); - printf_filtered (" psymtabs_addrmap_supported %s\n", - (psymtab->psymtabs_addrmap_supported - ? "yes" : "no")); - printf_filtered (" globals "); - if (psymtab->n_global_syms) - { - auto p = &objfile->global_psymbols[psymtab->globals_offset]; - - printf_filtered ("(* (struct partial_symbol **) %s @ %d)\n", - host_address_to_string (p), - psymtab->n_global_syms); - } - else - printf_filtered ("(none)\n"); - printf_filtered (" statics "); - if (psymtab->n_static_syms) - { - auto p = &objfile->static_psymbols[psymtab->statics_offset]; - - printf_filtered ("(* (struct partial_symbol **) %s @ %d)\n", - host_address_to_string (p), - psymtab->n_static_syms); - } - else - printf_filtered ("(none)\n"); - printf_filtered (" dependencies "); - if (psymtab->number_of_dependencies) - { - int i; + for (objfile *objfile : all_objfiles (pspace)) + { + struct gdbarch *gdbarch = get_objfile_arch (objfile); + struct partial_symtab *psymtab; - printf_filtered ("{\n"); - for (i = 0; i < psymtab->number_of_dependencies; i++) - { - struct partial_symtab *dep = psymtab->dependencies[i]; + /* We don't want to print anything for this objfile until we + actually find a symtab whose name matches. */ + int printed_objfile_start = 0; - /* Note the string concatenation there --- no comma. */ - printf_filtered (" psymtab %s " - "((struct partial_symtab *) %s)\n", - dep->filename, - host_address_to_string (dep)); - } - printf_filtered (" }\n"); - } - else - printf_filtered ("(none)\n"); - printf_filtered (" }\n"); - } - } + ALL_OBJFILE_PSYMTABS_REQUIRED (objfile, psymtab) + { + QUIT; + + if (! regexp + || re_exec (psymtab->filename)) + { + if (! printed_objfile_start) + { + printf_filtered ("{ objfile %s ", objfile_name (objfile)); + wrap_here (" "); + printf_filtered ("((struct objfile *) %s)\n", + host_address_to_string (objfile)); + printed_objfile_start = 1; + } + + printf_filtered (" { psymtab %s ", psymtab->filename); + wrap_here (" "); + printf_filtered ("((struct partial_symtab *) %s)\n", + host_address_to_string (psymtab)); + + printf_filtered (" readin %s\n", + psymtab->readin ? "yes" : "no"); + printf_filtered (" fullname %s\n", + psymtab->fullname + ? psymtab->fullname : "(null)"); + printf_filtered (" text addresses "); + fputs_filtered (paddress (gdbarch, + psymtab->text_low (objfile)), + gdb_stdout); + printf_filtered (" -- "); + fputs_filtered (paddress (gdbarch, + psymtab->text_high (objfile)), + gdb_stdout); + printf_filtered ("\n"); + printf_filtered (" psymtabs_addrmap_supported %s\n", + (psymtab->psymtabs_addrmap_supported + ? "yes" : "no")); + printf_filtered (" globals "); + if (psymtab->n_global_syms) + { + auto p + = &objfile->global_psymbols[psymtab->globals_offset]; + + printf_filtered + ("(* (struct partial_symbol **) %s @ %d)\n", + host_address_to_string (p), + psymtab->n_global_syms); + } + else + printf_filtered ("(none)\n"); + printf_filtered (" statics "); + if (psymtab->n_static_syms) + { + auto p + = &objfile->static_psymbols[psymtab->statics_offset]; + + printf_filtered + ("(* (struct partial_symbol **) %s @ %d)\n", + host_address_to_string (p), + psymtab->n_static_syms); + } + else + printf_filtered ("(none)\n"); + printf_filtered (" dependencies "); + if (psymtab->number_of_dependencies) + { + int i; + + printf_filtered ("{\n"); + for (i = 0; i < psymtab->number_of_dependencies; i++) + { + struct partial_symtab *dep = psymtab->dependencies[i]; + + /* Note the string concatenation there --- no + comma. */ + printf_filtered (" psymtab %s " + "((struct partial_symtab *) %s)\n", + dep->filename, + host_address_to_string (dep)); + } + printf_filtered (" }\n"); + } + else + printf_filtered ("(none)\n"); + printf_filtered (" }\n"); + } + } - if (printed_objfile_start) - printf_filtered ("}\n"); - } + if (printed_objfile_start) + printf_filtered ("}\n"); + } } /* Check consistency of currently expanded psymtabs vs symtabs. */ diff --git a/gdb/python/py-progspace.c b/gdb/python/py-progspace.c index 4d0297b..a17ef69 100644 --- a/gdb/python/py-progspace.c +++ b/gdb/python/py-progspace.c @@ -333,9 +333,7 @@ pspy_get_objfiles (PyObject *self_, PyObject *args) if (self->pspace != NULL) { - struct objfile *objf; - - ALL_PSPACE_OBJFILES (self->pspace, objf) + for (objfile *objf : all_objfiles (self->pspace)) { gdbpy_ref<> item = objfile_to_objfile_object (objf); diff --git a/gdb/source.c b/gdb/source.c index 1f10379..85e15c3 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -377,13 +377,12 @@ void forget_cached_source_info (void) { struct program_space *pspace; - struct objfile *objfile; ALL_PSPACES (pspace) - ALL_PSPACE_OBJFILES (pspace, objfile) - { - forget_cached_source_info_for_objfile (objfile); - } + for (objfile *objfile : all_objfiles (pspace)) + { + forget_cached_source_info_for_objfile (objfile); + } g_source_cache.clear (); last_source_visited = NULL; diff --git a/gdb/symfile-debug.c b/gdb/symfile-debug.c index 28bbd2c..b71fa8b 100644 --- a/gdb/symfile-debug.c +++ b/gdb/symfile-debug.c @@ -660,22 +660,21 @@ static void set_debug_symfile (const char *args, int from_tty, struct cmd_list_element *c) { struct program_space *pspace; - struct objfile *objfile; ALL_PSPACES (pspace) - ALL_PSPACE_OBJFILES (pspace, objfile) - { - if (debug_symfile) - { - if (!symfile_debug_installed (objfile)) - install_symfile_debug_logging (objfile); - } - else - { - if (symfile_debug_installed (objfile)) - uninstall_symfile_debug_logging (objfile); - } - } + for (objfile *objfile : all_objfiles (pspace)) + { + if (debug_symfile) + { + if (!symfile_debug_installed (objfile)) + install_symfile_debug_logging (objfile); + } + else + { + if (symfile_debug_installed (objfile)) + uninstall_symfile_debug_logging (objfile); + } + } } static void diff --git a/gdb/symmisc.c b/gdb/symmisc.c index 46c8206..24ecea3 100644 --- a/gdb/symmisc.c +++ b/gdb/symmisc.c @@ -62,86 +62,84 @@ void print_symbol_bcache_statistics (void) { struct program_space *pspace; - struct objfile *objfile; ALL_PSPACES (pspace) - ALL_PSPACE_OBJFILES (pspace, objfile) - { - QUIT; - printf_filtered (_("Byte cache statistics for '%s':\n"), - objfile_name (objfile)); - print_bcache_statistics (psymbol_bcache_get_bcache (objfile->psymbol_cache), - "partial symbol cache"); - print_bcache_statistics (objfile->per_bfd->macro_cache, - "preprocessor macro cache"); - print_bcache_statistics (objfile->per_bfd->filename_cache, - "file name cache"); - } + for (objfile *objfile : all_objfiles (pspace)) + { + QUIT; + printf_filtered (_("Byte cache statistics for '%s':\n"), + objfile_name (objfile)); + print_bcache_statistics (psymbol_bcache_get_bcache (objfile->psymbol_cache), + "partial symbol cache"); + print_bcache_statistics (objfile->per_bfd->macro_cache, + "preprocessor macro cache"); + print_bcache_statistics (objfile->per_bfd->filename_cache, + "file name cache"); + } } void print_objfile_statistics (void) { struct program_space *pspace; - struct objfile *objfile; struct compunit_symtab *cu; struct symtab *s; int i, linetables, blockvectors; ALL_PSPACES (pspace) - ALL_PSPACE_OBJFILES (pspace, objfile) - { - QUIT; - printf_filtered (_("Statistics for '%s':\n"), objfile_name (objfile)); - if (OBJSTAT (objfile, n_stabs) > 0) - printf_filtered (_(" Number of \"stab\" symbols read: %d\n"), - OBJSTAT (objfile, n_stabs)); - if (objfile->per_bfd->n_minsyms > 0) - printf_filtered (_(" Number of \"minimal\" symbols read: %d\n"), - objfile->per_bfd->n_minsyms); - if (OBJSTAT (objfile, n_psyms) > 0) - printf_filtered (_(" Number of \"partial\" symbols read: %d\n"), - OBJSTAT (objfile, n_psyms)); - if (OBJSTAT (objfile, n_syms) > 0) - printf_filtered (_(" Number of \"full\" symbols read: %d\n"), - OBJSTAT (objfile, n_syms)); - if (OBJSTAT (objfile, n_types) > 0) - printf_filtered (_(" Number of \"types\" defined: %d\n"), - OBJSTAT (objfile, n_types)); - if (objfile->sf) - objfile->sf->qf->print_stats (objfile); - i = linetables = blockvectors = 0; - ALL_OBJFILE_FILETABS (objfile, cu, s) - { - i++; - if (SYMTAB_LINETABLE (s) != NULL) - linetables++; - } - ALL_OBJFILE_COMPUNITS (objfile, cu) - blockvectors++; - printf_filtered (_(" Number of symbol tables: %d\n"), i); - printf_filtered (_(" Number of symbol tables with line tables: %d\n"), - linetables); - printf_filtered (_(" Number of symbol tables with blockvectors: %d\n"), - blockvectors); - - if (OBJSTAT (objfile, sz_strtab) > 0) - printf_filtered (_(" Space used by string tables: %d\n"), - OBJSTAT (objfile, sz_strtab)); - printf_filtered (_(" Total memory used for objfile obstack: %s\n"), - pulongest (obstack_memory_used (&objfile - ->objfile_obstack))); - printf_filtered (_(" Total memory used for BFD obstack: %s\n"), - pulongest (obstack_memory_used (&objfile->per_bfd - ->storage_obstack))); - printf_filtered (_(" Total memory used for psymbol cache: %d\n"), - bcache_memory_used (psymbol_bcache_get_bcache - (objfile->psymbol_cache))); - printf_filtered (_(" Total memory used for macro cache: %d\n"), - bcache_memory_used (objfile->per_bfd->macro_cache)); - printf_filtered (_(" Total memory used for file name cache: %d\n"), - bcache_memory_used (objfile->per_bfd->filename_cache)); - } + for (objfile *objfile : all_objfiles (pspace)) + { + QUIT; + printf_filtered (_("Statistics for '%s':\n"), objfile_name (objfile)); + if (OBJSTAT (objfile, n_stabs) > 0) + printf_filtered (_(" Number of \"stab\" symbols read: %d\n"), + OBJSTAT (objfile, n_stabs)); + if (objfile->per_bfd->n_minsyms > 0) + printf_filtered (_(" Number of \"minimal\" symbols read: %d\n"), + objfile->per_bfd->n_minsyms); + if (OBJSTAT (objfile, n_psyms) > 0) + printf_filtered (_(" Number of \"partial\" symbols read: %d\n"), + OBJSTAT (objfile, n_psyms)); + if (OBJSTAT (objfile, n_syms) > 0) + printf_filtered (_(" Number of \"full\" symbols read: %d\n"), + OBJSTAT (objfile, n_syms)); + if (OBJSTAT (objfile, n_types) > 0) + printf_filtered (_(" Number of \"types\" defined: %d\n"), + OBJSTAT (objfile, n_types)); + if (objfile->sf) + objfile->sf->qf->print_stats (objfile); + i = linetables = blockvectors = 0; + ALL_OBJFILE_FILETABS (objfile, cu, s) + { + i++; + if (SYMTAB_LINETABLE (s) != NULL) + linetables++; + } + ALL_OBJFILE_COMPUNITS (objfile, cu) + blockvectors++; + printf_filtered (_(" Number of symbol tables: %d\n"), i); + printf_filtered (_(" Number of symbol tables with line tables: %d\n"), + linetables); + printf_filtered (_(" Number of symbol tables with blockvectors: %d\n"), + blockvectors); + + if (OBJSTAT (objfile, sz_strtab) > 0) + printf_filtered (_(" Space used by string tables: %d\n"), + OBJSTAT (objfile, sz_strtab)); + printf_filtered (_(" Total memory used for objfile obstack: %s\n"), + pulongest (obstack_memory_used (&objfile + ->objfile_obstack))); + printf_filtered (_(" Total memory used for BFD obstack: %s\n"), + pulongest (obstack_memory_used (&objfile->per_bfd + ->storage_obstack))); + printf_filtered (_(" Total memory used for psymbol cache: %d\n"), + bcache_memory_used (psymbol_bcache_get_bcache + (objfile->psymbol_cache))); + printf_filtered (_(" Total memory used for macro cache: %d\n"), + bcache_memory_used (objfile->per_bfd->macro_cache)); + printf_filtered (_(" Total memory used for file name cache: %d\n"), + bcache_memory_used (objfile->per_bfd->filename_cache)); + } } static void @@ -749,7 +747,6 @@ static void maintenance_print_objfiles (const char *regexp, int from_tty) { struct program_space *pspace; - struct objfile *objfile; dont_repeat (); @@ -757,7 +754,7 @@ maintenance_print_objfiles (const char *regexp, int from_tty) re_comp (regexp); ALL_PSPACES (pspace) - ALL_PSPACE_OBJFILES (pspace, objfile) + for (objfile *objfile : all_objfiles (pspace)) { QUIT; if (! regexp @@ -772,7 +769,6 @@ static void maintenance_info_symtabs (const char *regexp, int from_tty) { struct program_space *pspace; - struct objfile *objfile; dont_repeat (); @@ -780,78 +776,78 @@ maintenance_info_symtabs (const char *regexp, int from_tty) re_comp (regexp); ALL_PSPACES (pspace) - ALL_PSPACE_OBJFILES (pspace, objfile) - { - struct compunit_symtab *cust; - struct symtab *symtab; - - /* We don't want to print anything for this objfile until we - actually find a symtab whose name matches. */ - int printed_objfile_start = 0; - - ALL_OBJFILE_COMPUNITS (objfile, cust) - { - int printed_compunit_symtab_start = 0; + for (objfile *objfile : all_objfiles (pspace)) + { + struct compunit_symtab *cust; + struct symtab *symtab; - ALL_COMPUNIT_FILETABS (cust, symtab) - { - QUIT; + /* We don't want to print anything for this objfile until we + actually find a symtab whose name matches. */ + int printed_objfile_start = 0; - if (! regexp - || re_exec (symtab_to_filename_for_display (symtab))) - { - if (! printed_objfile_start) - { - printf_filtered ("{ objfile %s ", objfile_name (objfile)); - wrap_here (" "); - printf_filtered ("((struct objfile *) %s)\n", - host_address_to_string (objfile)); - printed_objfile_start = 1; - } - if (! printed_compunit_symtab_start) - { - printf_filtered (" { ((struct compunit_symtab *) %s)\n", - host_address_to_string (cust)); - printf_filtered (" debugformat %s\n", - COMPUNIT_DEBUGFORMAT (cust)); - printf_filtered (" producer %s\n", - COMPUNIT_PRODUCER (cust) != NULL - ? COMPUNIT_PRODUCER (cust) - : "(null)"); - printf_filtered (" dirname %s\n", - COMPUNIT_DIRNAME (cust) != NULL - ? COMPUNIT_DIRNAME (cust) - : "(null)"); - printf_filtered (" blockvector" - " ((struct blockvector *) %s)\n", - host_address_to_string + ALL_OBJFILE_COMPUNITS (objfile, cust) + { + int printed_compunit_symtab_start = 0; + + ALL_COMPUNIT_FILETABS (cust, symtab) + { + QUIT; + + if (! regexp + || re_exec (symtab_to_filename_for_display (symtab))) + { + if (! printed_objfile_start) + { + printf_filtered ("{ objfile %s ", objfile_name (objfile)); + wrap_here (" "); + printf_filtered ("((struct objfile *) %s)\n", + host_address_to_string (objfile)); + printed_objfile_start = 1; + } + if (! printed_compunit_symtab_start) + { + printf_filtered (" { ((struct compunit_symtab *) %s)\n", + host_address_to_string (cust)); + printf_filtered (" debugformat %s\n", + COMPUNIT_DEBUGFORMAT (cust)); + printf_filtered (" producer %s\n", + COMPUNIT_PRODUCER (cust) != NULL + ? COMPUNIT_PRODUCER (cust) + : "(null)"); + printf_filtered (" dirname %s\n", + COMPUNIT_DIRNAME (cust) != NULL + ? COMPUNIT_DIRNAME (cust) + : "(null)"); + printf_filtered (" blockvector" + " ((struct blockvector *) %s)\n", + host_address_to_string (COMPUNIT_BLOCKVECTOR (cust))); - printed_compunit_symtab_start = 1; - } - - printf_filtered ("\t{ symtab %s ", - symtab_to_filename_for_display (symtab)); - wrap_here (" "); - printf_filtered ("((struct symtab *) %s)\n", - host_address_to_string (symtab)); - printf_filtered ("\t fullname %s\n", - symtab->fullname != NULL - ? symtab->fullname - : "(null)"); - printf_filtered ("\t " - "linetable ((struct linetable *) %s)\n", - host_address_to_string (symtab->linetable)); - printf_filtered ("\t}\n"); - } - } - - if (printed_compunit_symtab_start) - printf_filtered (" }\n"); - } + printed_compunit_symtab_start = 1; + } + + printf_filtered ("\t{ symtab %s ", + symtab_to_filename_for_display (symtab)); + wrap_here (" "); + printf_filtered ("((struct symtab *) %s)\n", + host_address_to_string (symtab)); + printf_filtered ("\t fullname %s\n", + symtab->fullname != NULL + ? symtab->fullname + : "(null)"); + printf_filtered ("\t " + "linetable ((struct linetable *) %s)\n", + host_address_to_string (symtab->linetable)); + printf_filtered ("\t}\n"); + } + } + + if (printed_compunit_symtab_start) + printf_filtered (" }\n"); + } - if (printed_objfile_start) - printf_filtered ("}\n"); - } + if (printed_objfile_start) + printf_filtered ("}\n"); + } } /* Check consistency of symtabs. @@ -866,49 +862,48 @@ static void maintenance_check_symtabs (const char *ignore, int from_tty) { struct program_space *pspace; - struct objfile *objfile; ALL_PSPACES (pspace) - ALL_PSPACE_OBJFILES (pspace, objfile) - { - struct compunit_symtab *cust; - - /* We don't want to print anything for this objfile until we - actually find something worth printing. */ - int printed_objfile_start = 0; - - ALL_OBJFILE_COMPUNITS (objfile, cust) - { - int found_something = 0; - struct symtab *symtab = compunit_primary_filetab (cust); - - QUIT; + for (objfile *objfile : all_objfiles (pspace)) + { + struct compunit_symtab *cust; - if (COMPUNIT_BLOCKVECTOR (cust) == NULL) - found_something = 1; - /* Add more checks here. */ + /* We don't want to print anything for this objfile until we + actually find something worth printing. */ + int printed_objfile_start = 0; - if (found_something) - { - if (! printed_objfile_start) - { - printf_filtered ("{ objfile %s ", objfile_name (objfile)); - wrap_here (" "); - printf_filtered ("((struct objfile *) %s)\n", - host_address_to_string (objfile)); - printed_objfile_start = 1; - } - printf_filtered (" { symtab %s\n", - symtab_to_filename_for_display (symtab)); - if (COMPUNIT_BLOCKVECTOR (cust) == NULL) - printf_filtered (" NULL blockvector\n"); - printf_filtered (" }\n"); - } - } + ALL_OBJFILE_COMPUNITS (objfile, cust) + { + int found_something = 0; + struct symtab *symtab = compunit_primary_filetab (cust); + + QUIT; + + if (COMPUNIT_BLOCKVECTOR (cust) == NULL) + found_something = 1; + /* Add more checks here. */ + + if (found_something) + { + if (! printed_objfile_start) + { + printf_filtered ("{ objfile %s ", objfile_name (objfile)); + wrap_here (" "); + printf_filtered ("((struct objfile *) %s)\n", + host_address_to_string (objfile)); + printed_objfile_start = 1; + } + printf_filtered (" { symtab %s\n", + symtab_to_filename_for_display (symtab)); + if (COMPUNIT_BLOCKVECTOR (cust) == NULL) + printf_filtered (" NULL blockvector\n"); + printf_filtered (" }\n"); + } + } - if (printed_objfile_start) - printf_filtered ("}\n"); - } + if (printed_objfile_start) + printf_filtered ("}\n"); + } } /* Expand all symbol tables whose name matches an optional regexp. */ @@ -917,7 +912,6 @@ static void maintenance_expand_symtabs (const char *args, int from_tty) { struct program_space *pspace; - struct objfile *objfile; char *regexp = NULL; /* We use buildargv here so that we handle spaces in the regexp @@ -938,28 +932,28 @@ maintenance_expand_symtabs (const char *args, int from_tty) re_comp (regexp); ALL_PSPACES (pspace) - ALL_PSPACE_OBJFILES (pspace, objfile) - { - if (objfile->sf) - { - objfile->sf->qf->expand_symtabs_matching - (objfile, - [&] (const char *filename, bool basenames) - { - /* KISS: Only apply the regexp to the complete file name. */ - return (!basenames - && (regexp == NULL || re_exec (filename))); - }, - lookup_name_info::match_any (), - [] (const char *symname) - { - /* Since we're not searching on symbols, just return true. */ - return true; - }, - NULL, - ALL_DOMAIN); - } - } + for (objfile *objfile : all_objfiles (pspace)) + { + if (objfile->sf) + { + objfile->sf->qf->expand_symtabs_matching + (objfile, + [&] (const char *filename, bool basenames) + { + /* KISS: Only apply the regexp to the complete file name. */ + return (!basenames + && (regexp == NULL || re_exec (filename))); + }, + lookup_name_info::match_any (), + [] (const char *symname) + { + /* Since we're not searching on symbols, just return true. */ + return true; + }, + NULL, + ALL_DOMAIN); + } + } } @@ -1032,7 +1026,6 @@ static void maintenance_info_line_tables (const char *regexp, int from_tty) { struct program_space *pspace; - struct objfile *objfile; dont_repeat (); @@ -1040,23 +1033,23 @@ maintenance_info_line_tables (const char *regexp, int from_tty) re_comp (regexp); ALL_PSPACES (pspace) - ALL_PSPACE_OBJFILES (pspace, objfile) - { - struct compunit_symtab *cust; - struct symtab *symtab; - - ALL_OBJFILE_COMPUNITS (objfile, cust) - { - ALL_COMPUNIT_FILETABS (cust, symtab) - { - QUIT; + for (objfile *objfile : all_objfiles (pspace)) + { + struct compunit_symtab *cust; + struct symtab *symtab; - if (regexp == NULL - || re_exec (symtab_to_filename_for_display (symtab))) - maintenance_print_one_line_table (symtab, NULL); - } - } - } + ALL_OBJFILE_COMPUNITS (objfile, cust) + { + ALL_COMPUNIT_FILETABS (cust, symtab) + { + QUIT; + + if (regexp == NULL + || re_exec (symtab_to_filename_for_display (symtab))) + maintenance_print_one_line_table (symtab, NULL); + } + } + } } |