From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 127224 invoked by alias); 13 Nov 2019 11:42:31 -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 127209 invoked by uid 89); 13 Nov 2019 11:42:31 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.100.3 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.1 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.1 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] Handle dwz -l0 more efficiently Message-ID: <20191113114225.GA19002@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-q4/txt/msg00049.txt.bz2 Hi, If dwz is invoked with -l0, the dwz function is initially called without low-mem mode set, while it's certain that the call will run into the low-mem-die-limit: ... $ dwz -l0 1 --devel-trace Compressing 1 Hit low-mem die-limit Compressing 1 in low-mem mode ... Fix this by skipping the initial dwz call: ... $ dwz -l0 1 --devel-trace Compressing 1 in low-mem mode ... Committed to trunk. Thanks, - Tom Handle dwz -l0 more efficiently 2019-11-13 Tom de Vries * dwz.c (main): Only try dwz without MULTIFILE_MODE_LOW_MEM if low_mem_die_limit != 0. * testsuite/dwz.tests/low-mem-die-limit-0.sh: New test. * testsuite/dwz.tests/two-files-low-mem-die-limit-0.sh: New test. --- dwz.c | 12 ++++++++---- testsuite/dwz.tests/low-mem-die-limit-0.sh | 13 +++++++++++++ testsuite/dwz.tests/two-files-low-mem-die-limit-0.sh | 14 ++++++++++++++ 3 files changed, 35 insertions(+), 4 deletions(-) diff --git a/dwz.c b/dwz.c index e990693..9f37fd0 100644 --- a/dwz.c +++ b/dwz.c @@ -12756,8 +12756,10 @@ main (int argc, char *argv[]) error (0, 0, "Too few files for multifile optimization"); multifile = NULL; } - ret = dwz (optind == argc ? "a.out" : argv[optind], outfile, - &res, NULL, NULL); + ret = (low_mem_die_limit == 0 + ? 2 + : dwz (optind == argc ? "a.out" : argv[optind], outfile, + &res, NULL, NULL)); if (ret == 2) { multifile_mode = MULTIFILE_MODE_LOW_MEM; @@ -12795,8 +12797,10 @@ main (int argc, char *argv[]) } for (i = optind; i < argc; i++) { - int thisret = dwz (argv[i], NULL, &resa[i - optind], - hardlinks ? resa : NULL, &argv[optind]); + int thisret = (low_mem_die_limit == 0 + ? 2 + : dwz (argv[i], NULL, &resa[i - optind], + hardlinks ? resa : NULL, &argv[optind])); if (thisret == 2) { multifile_mode = MULTIFILE_MODE_LOW_MEM; diff --git a/testsuite/dwz.tests/low-mem-die-limit-0.sh b/testsuite/dwz.tests/low-mem-die-limit-0.sh new file mode 100644 index 0000000..7105431 --- /dev/null +++ b/testsuite/dwz.tests/low-mem-die-limit-0.sh @@ -0,0 +1,13 @@ +cp $execs/hello 1 + +$execs/dwz-for-test \ + -l0 \ + --devel-trace \ + 1 \ + 2> dwz.err + +if grep -q "Compressing 1$" dwz.err; then + exit 1 +fi + +rm -f 1 dwz.err diff --git a/testsuite/dwz.tests/two-files-low-mem-die-limit-0.sh b/testsuite/dwz.tests/two-files-low-mem-die-limit-0.sh new file mode 100644 index 0000000..7f1e174 --- /dev/null +++ b/testsuite/dwz.tests/two-files-low-mem-die-limit-0.sh @@ -0,0 +1,14 @@ +cp $execs/hello 1 +cp 1 2 + +$execs/dwz-for-test \ + -l0 \ + --devel-trace \ + 1 2 \ + 2> dwz.err + +if egrep -q "Compressing (1|2)$" dwz.err; then + exit 1 +fi + +rm -f 1 2 dwz.err