Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [PATCH][gdb] Fix cc-with-dwz regression
Date: Thu, 20 Feb 2020 14:25:00 -0000	[thread overview]
Message-ID: <20200220142547.GA16577@delia> (raw)

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.  */


             reply	other threads:[~2020-02-20 14:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-20 14:25 Tom de Vries [this message]
2020-02-20 16:43 ` Tom Tromey
2020-02-21 13:02   ` Tom de Vries
2020-02-21 14:43     ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200220142547.GA16577@delia \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox