public inbox for dwz@sourceware.org
 help / color / mirror / Atom feed
* [committed] Allow empty .debug_info section in multifile
@ 2019-01-01  0:00 Tom de Vries
  0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2019-01-01  0:00 UTC (permalink / raw)
  To: dwz, jakub

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-04-06 20:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-01  0:00 [committed] Allow empty .debug_info section in multifile Tom de Vries

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