From patchwork Thu Feb 20 14:25:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 38256 Received: (qmail 79798 invoked by alias); 20 Feb 2020 14:25:54 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 79786 invoked by uid 89); 20 Feb 2020 14:25:54 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.1 spammy=Flush, boards, pst, PST X-HELO: mx2.suse.de Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 20 Feb 2020 14:25:53 +0000 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id C7747B204; Thu, 20 Feb 2020 14:25:50 +0000 (UTC) Date: Thu, 20 Feb 2020 15:25:49 +0100 From: Tom de Vries To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH][gdb] Fix cc-with-dwz regression Message-ID: <20200220142547.GA16577@delia> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-IsSubscribed: yes 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 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. */