From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32130 invoked by alias); 13 Nov 2019 10:32:25 -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 32121 invoked by uid 89); 13 Nov 2019 10:32:25 -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=million 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] Add -lnone and -Lnone Message-ID: <20191113103210.GA7468@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/msg00048.txt.bz2 Hi, The low-mem-die-limit has a default value, so if we run with an executable with more DIEs than that default, then low-mem mode is activated: ... $ dwz-for-test --devel-trace 1 Compressing 1 Hit low-mem die-limit Compressing 1 in low-mem mode $ ... In order to disable low-mem mode, we need to specify -l with a number of DIEs larger than the actual number of DIEs in the executable, where 2^32-1 is the maximum we can use: ... $ dwz-for-test -l4294967295 --devel-trace 1 Compressing 1 ... Add a shorthand -lnone to disable the low-mem-die-limit. Do the same for -L. Committed to trunk. Thanks, - Tom Add -lnone and -Lnone 2019-11-13 Tom de Vries * dwz.1: Document none argument for -l and -L. * dwz.c (usage): Same. (main): Handle none argument for -l and -L. * testsuite/dwz.tests/low-mem-die-limit-none.sh: New test. * testsuite/dwz.tests/max-die-limit-none.sh: New test. --- dwz.1 | 9 +++++---- dwz.c | 16 ++++++++++++++-- testsuite/dwz.tests/low-mem-die-limit-none.sh | 13 +++++++++++++ testsuite/dwz.tests/max-die-limit-none.sh | 7 +++++++ 4 files changed, 39 insertions(+), 6 deletions(-) diff --git a/dwz.1 b/dwz.1 index f3c38fc..a5a1ef6 100644 --- a/dwz.1 +++ b/dwz.1 @@ -71,7 +71,7 @@ or shared library (if there are no arguments at all, \fIa.out\fR is assumed). .TP -.B \-l COUNT \-\-low\-mem\-die\-limit COUNT +.B \-l \-\-low\-mem\-die\-limit Handle executables or shared libraries containing more than \fICOUNT\fR debugging information entries in their \fI.debug_info\fR section using a slower and more memory usage friendly mode and don't @@ -80,12 +80,13 @@ The default is 10 million DIEs. There is a risk that for very large amounts of debugging information in a single shared library or executable there might not be enough memory (especially when \fBdwz\fR tool is 32-bit binary, it might run out of available virtual address -space even sooner). +space even sooner). Specifying none as argument disables the limit. .TP -.B \-L COUNT \-\-max\-die\-limit COUNT +.B \-L \-\-max\-die\-limit Don't attempt to optimize executables or shared libraries containing more than -\fICOUNT\fR DIEs at all. The default is 50 million DIEs. +\fICOUNT\fR DIEs at all. The default is 50 million DIEs. Specifying none as +argument disables the limit. .TP .B \-? \-\-help Print short help and exit. diff --git a/dwz.c b/dwz.c index ec9a79a..e990693 100644 --- a/dwz.c +++ b/dwz.c @@ -12638,10 +12638,12 @@ static struct option dwz_options[] = static void usage (void) { +#define COMMON_OPTS "[-v] [-q] [-l ] [-L ]" error (1, 0, "Usage:\n" - " dwz [-v] [-q] [-h] [-l COUNT] [-L COUNT] [-m COMMONFILE] [-M NAME] [-r] [FILES]\n" - " dwz [-v] [-q] [-l COUNT] [-L COUNT] -o OUTFILE FILE\n"); + " dwz " COMMON_OPTS " [-h] [-m COMMONFILE] [-M NAME] [-r] [FILES]\n" + " dwz " COMMON_OPTS " -o OUTFILE FILE\n"); +#undef COMMON_OPTS } /* Print version and exit. */ @@ -12715,6 +12717,11 @@ main (int argc, char *argv[]) break; case 'l': + if (strcmp (optarg, "none") == 0) + { + low_mem_die_limit = -1U; + break; + } l = strtoul (optarg, &end, 0); if (*end != '\0' || optarg == end || (unsigned int) l != l) error (1, 0, "invalid argument -l %s", optarg); @@ -12722,6 +12729,11 @@ main (int argc, char *argv[]) break; case 'L': + if (strcmp (optarg, "none") == 0) + { + max_die_limit = -1U; + break; + } l = strtoul (optarg, &end, 0); if (*end != '\0' || optarg == end || (unsigned int) l != l) error (1, 0, "invalid argument -L %s", optarg); diff --git a/testsuite/dwz.tests/low-mem-die-limit-none.sh b/testsuite/dwz.tests/low-mem-die-limit-none.sh new file mode 100644 index 0000000..20b8cad --- /dev/null +++ b/testsuite/dwz.tests/low-mem-die-limit-none.sh @@ -0,0 +1,13 @@ +cp $execs/hello 1 + +$execs/dwz-for-test \ + -lnone \ + --devel-trace \ + 1 \ + 2> dwz.err + +if grep -q "Compressing 1 in low-mem mode" dwz.err; then + exit 1 +fi + +rm -f 1 dwz.err diff --git a/testsuite/dwz.tests/max-die-limit-none.sh b/testsuite/dwz.tests/max-die-limit-none.sh new file mode 100644 index 0000000..f45d566 --- /dev/null +++ b/testsuite/dwz.tests/max-die-limit-none.sh @@ -0,0 +1,7 @@ +cp $execs/hello 1 + +$execs/dwz-for-test \ + -Lnone \ + 1 + +rm -f 1