public inbox for dwz@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: dwz@sourceware.org, jakub@redhat.com
Subject: [committed] Allow empty .debug_info section in multifile
Date: Tue, 01 Jan 2019 00:00:00 -0000	[thread overview]
Message-ID: <20190406204122.GA25176@delia> (raw)

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  <tdevries@suse.de>

	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

                 reply	other threads:[~2019-04-06 20:41 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20190406204122.GA25176@delia \
    --to=tdevries@suse.de \
    --cc=dwz@sourceware.org \
    --cc=jakub@redhat.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).