public inbox for dwz@sourceware.org
 help / color / mirror / Atom feed
* [committed] Fix low-mem limit regression in multifile mode
@ 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,

With the commit 639610d "Avoid unnecessary .debug_info section parsing", the
following regression was introduced:
...
 $ cp hello 1; cp 1 2; dwz -l73 --devel-trace -m 3 1 2
 Compressing 1
 Write-multifile 1
 Compressing 2
 Write-multifile 2
 Optimize-multifile
-Read-multifile
-Compressing 1 in finalize-multifile mode
-Compressing 2 in finalize-multifile mode
+Hit low-mem die-limit
...

The problem is in read_debug_info, in the condition for calling
try_debug_info, which uses !low_mem to avoid triggering clause
'estimated_nr_dies > low_mem_die_limit' in low_mem mode:
...
 if (kind == DEBUG_INFO
      && ((multifile_mode == 0 && estimated_nr_dies > max_die_limit)
         || (!low_mem && estimated_nr_dies > low_mem_die_limit)))
     {
       int try_ret = try_debug_info (dso);
...
which results in triggering the clause in optimize_multifile mode.

Fix this by testing for multifile_mode == 0 instead of for !low_mem mode.

Committed to trunk.

Thanks,
- Tom

Fix low-mem limit regression in multifile mode

2019-11-25  Tom de Vries  <tdevries@suse.de>

	* dwz.c (read_debug_info): Don't call try_debug_info in
	optimize-multifile mode.
	* testsuite/dwz.tests/low-mem-die-limit-at-limit-multifile.sh: New
	test.

---
 dwz.c                                              |  5 +++--
 .../low-mem-die-limit-at-limit-multifile.sh        | 23 ++++++++++++++++++++++
 2 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/dwz.c b/dwz.c
index b80375d..c8e43b7 100644
--- a/dwz.c
+++ b/dwz.c
@@ -5043,8 +5043,9 @@ read_debug_info (DSO *dso, int kind)
 
   unsigned int estimated_nr_dies = estimate_nr_dies ();
   if (kind == DEBUG_INFO
-      && ((multifile_mode == 0 && estimated_nr_dies > max_die_limit)
-	  || (!low_mem && estimated_nr_dies > low_mem_die_limit)))
+      && multifile_mode == 0
+      && (estimated_nr_dies > max_die_limit
+	  || estimated_nr_dies > low_mem_die_limit))
     {
       int try_ret = try_debug_info (dso);
       if (try_ret != 0)
diff --git a/testsuite/dwz.tests/low-mem-die-limit-at-limit-multifile.sh b/testsuite/dwz.tests/low-mem-die-limit-at-limit-multifile.sh
new file mode 100644
index 0000000..ece4fd5
--- /dev/null
+++ b/testsuite/dwz.tests/low-mem-die-limit-at-limit-multifile.sh
@@ -0,0 +1,23 @@
+cp $execs/hello 1
+cp 1 2
+
+count=$(readelf -wi 1 \
+	    | grep '(DW_TAG' \
+	    | wc -l)
+limit=$count
+
+if $execs/dwz-for-test \
+       -l$limit \
+       --devel-trace \
+       -m 3 1 2 \
+       2> dwz.err; status=$?; then
+    true
+fi
+
+if grep -q "Hit low-mem die-limit" dwz.err; then
+    exit 1
+fi
+
+[ $status -eq 0 ]
+
+rm -f 1 2 3 dwz.err

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

only message in thread, other threads:[~2019-11-25 14:39 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] Fix low-mem limit regression in multifile mode 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).