Fix cc-with-dwz regression
Commit Message
Hi,
I noticed a regression with board cc-with-dwz:
...
FAIL: gdb.cp/m-static.exp: static const int initialized elsewhere
FAIL: gdb.cp/m-static.exp: info variable everywhere
...
The problem started with commit 0494dbecdf "Consolidate partial symtab
dependency reading".
The commit replaces the dwarf2_psymtab::expand_psymtab specific reading of
dependencies, which contains a "dependencies[i]->user == NULL" test, with a
generic partial_symtab::read_dependencies call, which does not test the user
field.
This patch fixes the regression by adding dwarf2_psymtab::read_dependencies,
which reinstates the original code.
Build and reg-tested on x86_64-linux.
Tested natively, as well as with boards cc-with-dwz and cc-with-dwz-m.
The patch fixes all 33 regressions with cc-with-dwz, and all 2929 regression
with cc-with-dwz-m.
OK for trunk?
Thanks,
- Tom
[gdb] Fix cc-with-dwz regression
gdb/ChangeLog:
2020-02-20 Tom de Vries <tdevries@suse.de>
PR gdb/25534
* dwarf2/read.c (dwarf2_psymtab::read_dependencies): New member
function.
* dwarf2/read.h (struct dwarf2_psymtab::read_dependencies): Declare.
* psympriv.h (struct partial_symtab::read_dependencies): Declare
virtual.
---
gdb/dwarf2/read.c | 27 +++++++++++++++++++++++++++
gdb/dwarf2/read.h | 1 +
gdb/psympriv.h | 2 +-
3 files changed, 29 insertions(+), 1 deletion(-)
Comments
>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:
Tom> Hi,
Tom> I noticed a regression with board cc-with-dwz:
Tom> ...
Tom> FAIL: gdb.cp/m-static.exp: static const int initialized elsewhere
Tom> FAIL: gdb.cp/m-static.exp: info variable everywhere
Tom> ...
Tom> The problem started with commit 0494dbecdf "Consolidate partial symtab
Tom> dependency reading".
Thank you for doing this.
Tom> The commit replaces the dwarf2_psymtab::expand_psymtab specific reading of
Tom> dependencies, which contains a "dependencies[i]->user == NULL" test, with a
Tom> generic partial_symtab::read_dependencies call, which does not test the user
Tom> field.
Can we simply add this to the base class?
I think only the DWARF reader ever sets the "user" field anyway.
Tom
@@ -8828,6 +8828,33 @@ process_queue (struct dwarf2_per_objfile *dwarf2_per_objfile)
}
}
+/* Ensure that all the dependencies are read in. */
+
+void
+dwarf2_psymtab::read_dependencies (struct objfile *objfile)
+{
+ int i;
+
+ for (i = 0; i < number_of_dependencies; i++)
+ if (!dependencies[i]->readin_p ()
+ && dependencies[i]->user == NULL)
+ {
+ /* Inform about additional files that need to be read in. */
+ if (info_verbose)
+ {
+ /* FIXME: i18n: Need to make this a single string. */
+ fputs_filtered (" ", gdb_stdout);
+ wrap_here ("");
+ fputs_filtered ("and ", gdb_stdout);
+ wrap_here ("");
+ printf_filtered ("%s...", dependencies[i]->filename);
+ wrap_here (""); /* Flush output. */
+ gdb_flush (gdb_stdout);
+ }
+ dependencies[i]->expand_psymtab (objfile);
+ }
+}
+
/* Read in full symbols for PST, and anything it depends on. */
void
@@ -258,6 +258,7 @@ struct dwarf2_psymtab : public standard_psymtab
void read_symtab (struct objfile *) override;
void expand_psymtab (struct objfile *) override;
+ void read_dependencies (struct objfile *objfile) override;
struct dwarf2_per_cu_data *per_cu_data;
};
@@ -135,7 +135,7 @@ struct partial_symtab
virtual void expand_psymtab (struct objfile *) = 0;
/* Ensure that all the dependencies are read in. */
- void read_dependencies (struct objfile *);
+ virtual void read_dependencies (struct objfile *);
/* Return true if the symtab corresponding to this psymtab has been
readin. */