[gdb] Fix cc-with-dwz regression
authorTom de Vries <tdevries@suse.de>
Fri, 21 Feb 2020 15:36:48 +0000 (16:36 +0100)
committerTom de Vries <tdevries@suse.de>
Fri, 21 Feb 2020 15:36:48 +0000 (16:36 +0100)
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 back the test, in the generic
partial_symtab::read_dependencies.

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.

gdb/ChangeLog:

2020-02-21  Tom de Vries  <tdevries@suse.de>

PR gdb/25534
* psymtab.c (partial_symtab::read_dependencies): Don't read dependency
if dependencies[i]->user != NULL.

gdb/ChangeLog
gdb/psymtab.c

index d480ff4e1596819084c4fcec3b93648c1c1990bf..90eb475bf876b6f66fa403a95ddaaf92d6bd90a1 100644 (file)
@@ -1,3 +1,9 @@
+2020-02-21  Tom de Vries  <tdevries@suse.de>
+
+       PR gdb/25534
+       * psymtab.c (partial_symtab::read_dependencies): Don't read dependency
+       if dependencies[i]->user != NULL.
+
 2020-02-21  Ali Tamur  <tamur@google.com>
 
        * dwarf2/read.c (dwarf2_name): Add null check.
index 56576b3bcec2eb3be60ffc1f1dc6cf3cd363e93a..fd7fc8feff2a436b19e7ea4a62f7ffc4f62bbc51 100644 (file)
@@ -1688,7 +1688,8 @@ partial_symtab::read_dependencies (struct objfile *objfile)
 {
   for (int i = 0; i < number_of_dependencies; ++i)
     {
-      if (!dependencies[i]->readin_p ())
+      if (!dependencies[i]->readin_p ()
+         && dependencies[i]->user == NULL)
        {
          /* Inform about additional files to be read in.  */
          if (info_verbose)