Implemented control of "export only" feature in dexdump.
Rationale:
Export only is now under explicit control of a new -e flag, and
can be used to control both -l xml and -l plain. The result is
that, by default, xml output now shows all items (old behavior
can be forced with -e -l xml). This solution feels a bit cleaner
than adding a flag to override export only when -l xml is given
(old dexdump forced this tight relation).
Bug: 25673756 (feature request).
Change-Id: I7cfd48bf91195d2a81d134936719d267fda399f5
diff --git a/dexdump/dexdump_main.cc b/dexdump/dexdump_main.cc
index 2466f33..dd1002c 100644
--- a/dexdump/dexdump_main.cc
+++ b/dexdump/dexdump_main.cc
@@ -40,11 +40,12 @@
*/
static void usage(void) {
fprintf(stderr, "Copyright (C) 2007 The Android Open Source Project\n\n");
- fprintf(stderr, "%s: [-c] [-d] [-f] [-h] [-i] [-l layout] [-o outfile]"
+ fprintf(stderr, "%s: [-c] [-d] [-e] [-f] [-h] [-i] [-l layout] [-o outfile]"
" [-t tempfile] dexfile...\n", gProgName);
fprintf(stderr, "\n");
fprintf(stderr, " -c : verify checksum and exit\n");
fprintf(stderr, " -d : disassemble code sections\n");
+ fprintf(stderr, " -e : display exported items only\n");
fprintf(stderr, " -f : display summary information from file header\n");
fprintf(stderr, " -g : dump CFG for dex\n");
fprintf(stderr, " -h : display file header details\n");
@@ -69,7 +70,7 @@
// Parse all arguments.
while (1) {
- const int ic = getopt(argc, argv, "cdfghil:t:o:");
+ const int ic = getopt(argc, argv, "cdefghil:t:o:");
if (ic < 0) {
break; // done
}
@@ -80,6 +81,9 @@
case 'd': // disassemble Dalvik instructions
gOptions.disassemble = true;
break;
+ case 'e': // exported items only
+ gOptions.exportsOnly = true;
+ break;
case 'f': // dump outer file header
gOptions.showFileHeaders = true;
break;
@@ -98,7 +102,6 @@
} else if (strcmp(optarg, "xml") == 0) {
gOptions.outputFormat = OUTPUT_XML;
gOptions.verbose = false;
- gOptions.exportsOnly = true;
} else {
wantUsage = true;
}
diff --git a/test/dexdump/run-all-tests b/test/dexdump/run-all-tests
index 9cf7ab6..11ab55a 100755
--- a/test/dexdump/run-all-tests
+++ b/test/dexdump/run-all-tests
@@ -40,7 +40,7 @@
# Set up dexdump binary and flags to test.
DEXD="${ANDROID_HOST_OUT}/bin/dexdump2"
DEXDFLAGS1="-dfh"
-DEXDFLAGS2="-l xml"
+DEXDFLAGS2="-e -l xml"
# Set up dexlist binary and flags to test.
DEXL="${ANDROID_HOST_OUT}/bin/dexlist"