diff options
author | Tom Tromey <tom@tromey.com> | 2021-04-17 09:35:04 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2021-04-17 09:35:06 -0600 |
commit | 90160b57032ce8c2d12864a53036bab2c5b86682 (patch) | |
tree | 8d999d738be70a8d34aa6ef9a086ac098a3f4703 /gdb | |
parent | 7089bd886ec78d623c3188cac48c039bc5eaf3b6 (diff) | |
download | gdb-90160b57032ce8c2d12864a53036bab2c5b86682.zip gdb-90160b57032ce8c2d12864a53036bab2c5b86682.tar.gz gdb-90160b57032ce8c2d12864a53036bab2c5b86682.tar.bz2 |
Remove quick_symbol_functions::expand_symtabs_with_fullname
This removes quick_symbol_functions::expand_symtabs_with_fullname,
replacing it with a call to expand_symtabs_matching. As with the
previous patches, the implementation is consolidated in the objfile
method.
gdb/ChangeLog
2021-04-17 Tom Tromey <tom@tromey.com>
* quick-symbol.h (struct quick_symbol_functions)
<expand_symtabs_with_fullname>: Remove.
* psymtab.c (psymbol_functions::expand_symtabs_with_fullname):
Remove.
* psympriv.h (struct psymbol_functions)
<expand_symtabs_with_fullname>: Remove.
* dwarf2/read.c (struct dwarf2_base_index_functions)
<expand_symtabs_with_fullname>: Remove.
(dwarf2_base_index_functions::expand_symtabs_with_fullname):
Remove.
* objfiles.h (struct objfile) <expand_symtabs_with_fullname>:
Update comment.
* symfile-debug.c (objfile::expand_symtabs_with_fullname):
Rewrite.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 17 | ||||
-rw-r--r-- | gdb/dwarf2/read.c | 37 | ||||
-rw-r--r-- | gdb/objfiles.h | 6 | ||||
-rw-r--r-- | gdb/psympriv.h | 3 | ||||
-rw-r--r-- | gdb/psymtab.c | 22 | ||||
-rw-r--r-- | gdb/quick-symbol.h | 8 | ||||
-rw-r--r-- | gdb/symfile-debug.c | 16 |
7 files changed, 37 insertions, 72 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 88e8790..6de85cb 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,22 @@ 2021-04-17 Tom Tromey <tom@tromey.com> + * quick-symbol.h (struct quick_symbol_functions) + <expand_symtabs_with_fullname>: Remove. + * psymtab.c (psymbol_functions::expand_symtabs_with_fullname): + Remove. + * psympriv.h (struct psymbol_functions) + <expand_symtabs_with_fullname>: Remove. + * dwarf2/read.c (struct dwarf2_base_index_functions) + <expand_symtabs_with_fullname>: Remove. + (dwarf2_base_index_functions::expand_symtabs_with_fullname): + Remove. + * objfiles.h (struct objfile) <expand_symtabs_with_fullname>: + Update comment. + * symfile-debug.c (objfile::expand_symtabs_with_fullname): + Rewrite. + +2021-04-17 Tom Tromey <tom@tromey.com> + * symfile-debug.c (objfile::expand_symtabs_for_function): Rewrite. * quick-symbol.h (struct quick_symbol_functions) diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 007b70e..6befb77 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -2241,9 +2241,6 @@ struct dwarf2_base_index_functions : public quick_symbol_functions void expand_all_symtabs (struct objfile *objfile) override; - void expand_symtabs_with_fullname (struct objfile *objfile, - const char *fullname) override; - struct compunit_symtab *find_pc_sect_compunit_symtab (struct objfile *objfile, struct bound_minimal_symbol msymbol, CORE_ADDR pc, struct obj_section *section, int warn_if_readin) override; @@ -3525,40 +3522,6 @@ dwarf2_base_index_functions::expand_all_symtabs (struct objfile *objfile) } } -void -dwarf2_base_index_functions::expand_symtabs_with_fullname - (struct objfile *objfile, const char *fullname) -{ - dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile); - - /* We don't need to consider type units here. - This is only called for examining code, e.g. expand_line_sal. - There can be an order of magnitude (or more) more type units - than comp units, and we avoid them if we can. */ - - for (dwarf2_per_cu_data *per_cu : per_objfile->per_bfd->all_comp_units) - { - /* We only need to look at symtabs not already expanded. */ - if (per_objfile->symtab_set_p (per_cu)) - continue; - - quick_file_names *file_data = dw2_get_file_names (per_cu, per_objfile); - if (file_data == NULL) - continue; - - for (int j = 0; j < file_data->num_file_names; ++j) - { - const char *this_fullname = file_data->file_names[j]; - - if (filename_cmp (this_fullname, fullname) == 0) - { - dw2_instantiate_symtab (per_cu, per_objfile, false); - break; - } - } - } -} - static bool dw2_expand_symtabs_matching_symbol (mapped_index_base &index, diff --git a/gdb/objfiles.h b/gdb/objfiles.h index 64cfca4..90ea49e 100644 --- a/gdb/objfiles.h +++ b/gdb/objfiles.h @@ -613,7 +613,11 @@ public: /* See quick_symbol_functions. */ void expand_all_symtabs (); - /* See quick_symbol_functions. */ + /* Read all symbol tables associated with OBJFILE which have + symtab_to_fullname equal to FULLNAME. + This is for the purposes of examining code only, e.g., expand_line_sal. + The routine may ignore debug info that is known to not be useful with + code, e.g., DW_TAG_type_unit for dwarf debug info. */ void expand_symtabs_with_fullname (const char *fullname); /* See quick_symbol_functions. */ diff --git a/gdb/psympriv.h b/gdb/psympriv.h index 4bd6dec..a539571 100644 --- a/gdb/psympriv.h +++ b/gdb/psympriv.h @@ -518,9 +518,6 @@ struct psymbol_functions : public quick_symbol_functions void expand_all_symtabs (struct objfile *objfile) override; - void expand_symtabs_with_fullname (struct objfile *objfile, - const char *fullname) override; - void map_matching_symbols (struct objfile *, const lookup_name_info &lookup_name, diff --git a/gdb/psymtab.c b/gdb/psymtab.c index 8afeeb3..7c73293 100644 --- a/gdb/psymtab.c +++ b/gdb/psymtab.c @@ -902,28 +902,6 @@ psymbol_functions::expand_all_symtabs (struct objfile *objfile) psymtab_to_symtab (objfile, psymtab); } -/* Psymtab version of expand_symtabs_with_fullname. See its definition in - the definition of quick_symbol_functions in symfile.h. */ - -void -psymbol_functions::expand_symtabs_with_fullname (struct objfile *objfile, - const char *fullname) -{ - for (partial_symtab *p : require_partial_symbols (objfile)) - { - /* Anonymous psymtabs don't have a name of a source file. */ - if (p->anonymous) - continue; - - /* psymtab_to_fullname tries to open the file which is slow. - Don't call it if we know the basenames don't match. */ - if ((basenames_may_differ - || filename_cmp (lbasename (fullname), lbasename (p->filename)) == 0) - && filename_cmp (fullname, psymtab_to_fullname (p)) == 0) - psymtab_to_symtab (objfile, p); - } -} - /* Psymtab version of map_symbol_filenames. See its definition in the definition of quick_symbol_functions in symfile.h. */ diff --git a/gdb/quick-symbol.h b/gdb/quick-symbol.h index 1aa02e9..d883d7b 100644 --- a/gdb/quick-symbol.h +++ b/gdb/quick-symbol.h @@ -119,14 +119,6 @@ struct quick_symbol_functions /* Read all symbol tables associated with OBJFILE. */ virtual void expand_all_symtabs (struct objfile *objfile) = 0; - /* Read all symbol tables associated with OBJFILE which have - symtab_to_fullname equal to FULLNAME. - This is for the purposes of examining code only, e.g., expand_line_sal. - The routine may ignore debug info that is known to not be useful with - code, e.g., DW_TAG_type_unit for dwarf debug info. */ - virtual void expand_symtabs_with_fullname (struct objfile *objfile, - const char *fullname) = 0; - /* Find global or static symbols in all tables that are in DOMAIN and for which MATCH (symbol name, NAME) == 0, passing each to CALLBACK, reading in partial symbol tables as needed. Look diff --git a/gdb/symfile-debug.c b/gdb/symfile-debug.c index deabea4..dd5a70b 100644 --- a/gdb/symfile-debug.c +++ b/gdb/symfile-debug.c @@ -334,8 +334,22 @@ objfile::expand_symtabs_with_fullname (const char *fullname) "qf->expand_symtabs_with_fullname (%s, \"%s\")\n", objfile_debug_name (this), fullname); + const char *basename = lbasename (fullname); + auto file_matcher = [&] (const char *filename, bool basenames) + { + return filename_cmp (basenames ? basename : fullname, filename) == 0; + }; + for (const auto &iter : qf) - iter->expand_symtabs_with_fullname (this, fullname); + iter->expand_symtabs_matching (this, + file_matcher, + nullptr, + nullptr, + nullptr, + (SEARCH_GLOBAL_BLOCK + | SEARCH_STATIC_BLOCK), + UNDEF_DOMAIN, + ALL_DOMAIN); } void |