aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2022-04-19 11:32:04 -0600
committerTom Tromey <tromey@adacore.com>2022-04-21 12:18:25 -0600
commit31de881f8f9a03499002d28ff42286b79c24a97d (patch)
tree5b53fb49b9872daf60c36d0fe78f6c9ad0553fe5 /gdb/dwarf2
parent5f21c7aae2040f3463d1ff56a4b0bcdbba34832d (diff)
downloadgdb-31de881f8f9a03499002d28ff42286b79c24a97d.zip
gdb-31de881f8f9a03499002d28ff42286b79c24a97d.tar.gz
gdb-31de881f8f9a03499002d28ff42286b79c24a97d.tar.bz2
Always use dwarf2_initialize_objfile
Internally we noticed that some tests would fail like so on Windows: warning: Section .debug_aranges in [...] has duplicate debug_info_offset 0x0, ignoring .debug_aranges. Debugging showed that, in fact, a second CU was being created at this offset. We tracked this down to the fact that, while the ELF reader is careful to re-use the per-BFD data, other readers are not, and could re-read the DWARF data multiple times. However, since the change to allow an objfile to have multiple "quick symbol" implementations, there's no reason for this approach -- it's safe and easy for all symbol readers to reuse the per-BFD data when reading DWARF. This patch implements this idea, simplifying dwarf2_build_psymtabs and making it private, and then switching to dwarf2_initialize_objfile as the sole way to start the DWARF reader. Note that, while I think the call to dwarf2_build_frame_info in machoread.c is also obsolete, I haven't attempted to remove it here.
Diffstat (limited to 'gdb/dwarf2')
-rw-r--r--gdb/dwarf2/public.h3
-rw-r--r--gdb/dwarf2/read.c15
2 files changed, 5 insertions, 13 deletions
diff --git a/gdb/dwarf2/public.h b/gdb/dwarf2/public.h
index f002ab2..a9d4682 100644
--- a/gdb/dwarf2/public.h
+++ b/gdb/dwarf2/public.h
@@ -38,9 +38,6 @@ enum class dw_index_kind
entry on the objfile's "qf" list. */
extern void dwarf2_initialize_objfile (struct objfile *objfile);
-struct psymbol_functions;
-extern void dwarf2_build_psymtabs (struct objfile *,
- bool already_attached = false);
extern void dwarf2_build_frame_info (struct objfile *);
#endif /* DWARF2_PUBLIC_H */
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 8586463..d6fccf8 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -5340,18 +5340,13 @@ dwarf2_initialize_objfile (struct objfile *objfile)
/* Build a partial symbol table. */
-void
-dwarf2_build_psymtabs (struct objfile *objfile, bool already_attached)
+static void
+dwarf2_build_psymtabs (struct objfile *objfile)
{
dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile);
- if (already_attached)
- {
- if (per_objfile->per_bfd->index_table != nullptr)
- return;
- }
- else
- objfile->qf.push_front (make_cooked_index_funcs ());
+ if (per_objfile->per_bfd->index_table != nullptr)
+ return;
try
{
@@ -18457,7 +18452,7 @@ struct cooked_index_functions : public dwarf2_base_index_functions
void read_partial_symbols (struct objfile *objfile) override
{
if (dwarf2_has_info (objfile, nullptr))
- dwarf2_build_psymtabs (objfile, true);
+ dwarf2_build_psymtabs (objfile);
}
};