* [committed] Add -lnone and -Lnone
@ 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,
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 <tdevries@suse.de>
* 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 <COUNT|none> \-\-low\-mem\-die\-limit <COUNT|none>
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 <COUNT|none> \-\-max\-die\-limit <COUNT|none>
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 <COUNT|none>] [-L <COUNT|none>]"
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-11-13 10:32 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] Add -lnone and -Lnone 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).