Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH][gdb] Fix cc-with-dwz regression
@ 2020-02-20 14:25 Tom de Vries
  2020-02-20 16:43 ` Tom Tromey
  0 siblings, 1 reply; 4+ messages in thread
From: Tom de Vries @ 2020-02-20 14:25 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

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(-)

diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 4d767a59af..27d688dabe 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -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
diff --git a/gdb/dwarf2/read.h b/gdb/dwarf2/read.h
index b06c2e218c..1f573506e3 100644
--- a/gdb/dwarf2/read.h
+++ b/gdb/dwarf2/read.h
@@ -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;
 };
diff --git a/gdb/psympriv.h b/gdb/psympriv.h
index 1b1f57cf76..dab24da0d2 100644
--- a/gdb/psympriv.h
+++ b/gdb/psympriv.h
@@ -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.  */


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH][gdb] Fix cc-with-dwz regression
  2020-02-20 14:25 [PATCH][gdb] Fix cc-with-dwz regression Tom de Vries
@ 2020-02-20 16:43 ` Tom Tromey
  2020-02-21 13:02   ` Tom de Vries
  0 siblings, 1 reply; 4+ messages in thread
From: Tom Tromey @ 2020-02-20 16:43 UTC (permalink / raw)
  To: Tom de Vries; +Cc: gdb-patches, Tom Tromey

>>>>> "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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH][gdb] Fix cc-with-dwz regression
  2020-02-20 16:43 ` Tom Tromey
@ 2020-02-21 13:02   ` Tom de Vries
  2020-02-21 14:43     ` Tom Tromey
  0 siblings, 1 reply; 4+ messages in thread
From: Tom de Vries @ 2020-02-21 13:02 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 882 bytes --]

On 20-02-2020 17:43, Tom Tromey wrote:
>>>>>> "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.

Ack, updated.

OK like this?

Thanks,
- Tom

[-- Attachment #2: 0001-gdb-Fix-cc-with-dwz-regression.patch --]
[-- Type: text/x-patch, Size: 1580 bytes --]

[gdb] Fix cc-with-dwz regression

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/psymtab.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index 56576b3bce..fd7fc8feff 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -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)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH][gdb] Fix cc-with-dwz regression
  2020-02-21 13:02   ` Tom de Vries
@ 2020-02-21 14:43     ` Tom Tromey
  0 siblings, 0 replies; 4+ messages in thread
From: Tom Tromey @ 2020-02-21 14:43 UTC (permalink / raw)
  To: Tom de Vries; +Cc: Tom Tromey, gdb-patches

>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:

>> Can we simply add this to the base class?
>> I think only the DWARF reader ever sets the "user" field anyway.

Tom> Ack, updated.

Tom> OK like this?

Yes.  Thank you.

Tom


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-02-21 14:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-20 14:25 [PATCH][gdb] Fix cc-with-dwz regression Tom de Vries
2020-02-20 16:43 ` Tom Tromey
2020-02-21 13:02   ` Tom de Vries
2020-02-21 14:43     ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox