From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 97350 invoked by alias); 6 Apr 2019 20:41:29 -0000 Mailing-List: contact dwz-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Post: List-Help: List-Subscribe: Sender: dwz-owner@sourceware.org Received: (qmail 97339 invoked by uid 89); 6 Apr 2019 20:41:29 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.100.2 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.4 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= X-Spam-Status: No, score=-25.4 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 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on sourceware.org X-Spam-Level: X-HELO: mx1.suse.de X-Virus-Scanned: by amavisd-new at test-mx.suse.de Date: Tue, 01 Jan 2019 00:00:00 -0000 From: Tom de Vries To: dwz@sourceware.org, jakub@redhat.com Subject: [committed] Allow empty .debug_info section in multifile Message-ID: <20190406204122.GA25176@delia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-SW-Source: 2019-q2/txt/msg00007.txt.bz2 Hi, When running dwz on an executable with dwarf with no dies suitable for the multifile, the generated multifile only contains a .debug_str section, and we run into: ... $ dwz -m multifile.debug a.out b.out dwz: multifile.debug: .debug_info section not present ... Fix this by allowing an empty .debug_info section in the multifile. Committed to trunk. Thanks, - Tom Allow empty .debug_info section in multifile 2019-04-06 Tom de Vries PR dwz/24341 * dwz.c (read_dwarf): Allow empty .debug_info section in multifile. * testsuite/dwz.tests/dwz-tests.exp: Require min with dwarf for test sources only for pr24341.sh. * testsuite/dwz.tests/pr24341.sh: New test. --- dwz.c | 3 ++- testsuite/dwz.tests/dwz-tests.exp | 10 ++++++++++ testsuite/dwz.tests/pr24341.sh | 15 +++++++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/dwz.c b/dwz.c index d31be82..3f0f40f 100644 --- a/dwz.c +++ b/dwz.c @@ -9960,7 +9960,8 @@ read_dwarf (DSO *dso, bool quieter) return 1; } - if (debug_sections[DEBUG_INFO].data == NULL) + if (debug_sections[DEBUG_INFO].data == NULL + && !rd_multifile) { if (!quieter) error (0, 0, "%s: .debug_info section not present", diff --git a/testsuite/dwz.tests/dwz-tests.exp b/testsuite/dwz.tests/dwz-tests.exp index 5a0b551..9bb8e96 100644 --- a/testsuite/dwz.tests/dwz-tests.exp +++ b/testsuite/dwz.tests/dwz-tests.exp @@ -20,6 +20,16 @@ foreach test $tests { if { $basename == "pr24173.sh" } { lappend required_execs "py-section-script" } + if { $basename == "pr24341.sh" } { + # The exec min is used for the regression test for pr24341, but it only + # functions as such if the DWARF only contains the CUs of the test-case + # itself. + set matches [exec readelf -wi min | grep DW_AT_name | grep -c / ] + if { $matches != 2 } { + unsupported "$test" + continue + } + } set unsupported 0 foreach required_exec $required_execs { diff --git a/testsuite/dwz.tests/pr24341.sh b/testsuite/dwz.tests/pr24341.sh new file mode 100644 index 0000000..972fbf4 --- /dev/null +++ b/testsuite/dwz.tests/pr24341.sh @@ -0,0 +1,15 @@ +cp ../min 1 +cp 1 2 + +dwz -m 3 1 2 + +cnt=$(readelf -S 3 | grep "\.debug_info" | wc -l) +[ $cnt -eq 0 ] + +smaller-than.sh 1 ../min +smaller-than.sh 2 ../min + +[ "$(gnu-debugaltlink-name.sh 1)" = "3" ] +[ "$(gnu-debugaltlink-name.sh 2)" = "3" ] + +rm -f 1 2 3