summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2021-03-20 17:23:40 -0600
committerTom Tromey <tom@tromey.com>2021-03-20 17:23:43 -0600
commit51962708bd3701780ac9ffd99a70d8eb2149a376 (patch)
tree505ef41d69854c52b1a9e538efba1d810f694325
parent484b1090630d273dfb70ee96b152ec6b527a1b65 (diff)
downloadbinutils-gdb-51962708bd3701780ac9ffd99a70d8eb2149a376.tar.gz
Set per_bfd->partial_symtabs earlier
dwarf2_build_psymtabs sets per_bfd->partial_symtabs at its end, in order to facilitate sharing. However, in order to diassociate partial symtabs from the objfile, we want to change the DWARF reader to reference partial symtabs via the per_bfd. So, we want to set this reference before reading psymtabs. This is safe to do because the assignment is done unconditionally. gdb/ChangeLog 2021-03-20 Tom Tromey <tom@tromey.com> * dwarf2/read.c (dwarf2_build_psymtabs): Set partial_symtabs earlier.
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/dwarf2/read.c12
2 files changed, 11 insertions, 6 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 7bb862e43f0..61232703b6f 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
2021-03-20 Tom Tromey <tom@tromey.com>
+ * dwarf2/read.c (dwarf2_build_psymtabs): Set partial_symtabs
+ earlier.
+
+2021-03-20 Tom Tromey <tom@tromey.com>
+
* psympriv.h (psymtab_discarder): Take psymtab_storage parameter.
(~psymtab_discarder, keep): Update.
<m_objfile>: Remove.
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index aad25f7c086..9de9e48c7bb 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -6137,6 +6137,12 @@ dwarf2_build_psymtabs (struct objfile *objfile)
return;
}
+ /* Set the local reference to partial symtabs, so that we don't try
+ to read them again if reading another objfile with the same BFD.
+ If we can't in fact share, this won't make a difference anyway as
+ the dwarf2_per_bfd object won't be shared. */
+ per_bfd->partial_symtabs = objfile->partial_symtabs;
+
try
{
/* This isn't really ideal: all the data we allocate on the
@@ -6155,12 +6161,6 @@ dwarf2_build_psymtabs (struct objfile *objfile)
{
exception_print (gdb_stderr, except);
}
-
- /* Finish by setting the local reference to partial symtabs, so that
- we don't try to read them again if reading another objfile with the same
- BFD. If we can't in fact share, this won't make a difference anyway as
- the dwarf2_per_bfd object won't be shared. */
- per_bfd->partial_symtabs = objfile->partial_symtabs;
}
/* Find the base address of the compilation unit for range lists and