Implemented annotations display in dexdump.
Rationale:
Showing this in true dexdump style as a separate construct
under switch -a (rather than interpreting the data and showing
each annotation where it is used). Also added new test to
cover many more value encodings in static fields.
BUG=28981655
Change-Id: I6d7d44cbd358d9880aab78812471bdb0dc6b6ad8
diff --git a/dexdump/dexdump_main.cc b/dexdump/dexdump_main.cc
index dd1002c..32e9d52 100644
--- a/dexdump/dexdump_main.cc
+++ b/dexdump/dexdump_main.cc
@@ -40,19 +40,18 @@
*/
static void usage(void) {
fprintf(stderr, "Copyright (C) 2007 The Android Open Source Project\n\n");
- fprintf(stderr, "%s: [-c] [-d] [-e] [-f] [-h] [-i] [-l layout] [-o outfile]"
- " [-t tempfile] dexfile...\n", gProgName);
- fprintf(stderr, "\n");
+ fprintf(stderr, "%s: [-a] [-c] [-d] [-e] [-f] [-h] [-i] [-l layout] [-o outfile]"
+ " dexfile...\n\n", gProgName);
+ fprintf(stderr, " -a : display annotations\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, " -g : display CFG for dex\n");
fprintf(stderr, " -h : display file header details\n");
fprintf(stderr, " -i : ignore checksum failures\n");
fprintf(stderr, " -l : output layout, either 'plain' or 'xml'\n");
fprintf(stderr, " -o : output file name (defaults to stdout)\n");
- fprintf(stderr, " -t : temp file name (defaults to /sdcard/dex-temp-*)\n");
}
/*
@@ -70,11 +69,14 @@
// Parse all arguments.
while (1) {
- const int ic = getopt(argc, argv, "cdefghil:t:o:");
+ const int ic = getopt(argc, argv, "acdefghil:o:");
if (ic < 0) {
break; // done
}
switch (ic) {
+ case 'a': // display annotations
+ gOptions.showAnnotations = true;
+ break;
case 'c': // verify the checksum then exit
gOptions.checksumOnly = true;
break;
@@ -84,13 +86,13 @@
case 'e': // exported items only
gOptions.exportsOnly = true;
break;
- case 'f': // dump outer file header
+ case 'f': // display outer file header
gOptions.showFileHeaders = true;
break;
- case 'g': // dump cfg
- gOptions.cfg = true;
+ case 'g': // display cfg
+ gOptions.showCfg = true;
break;
- case 'h': // dump section headers, i.e. all meta-data
+ case 'h': // display section headers, i.e. all meta-data
gOptions.showSectionHeaders = true;
break;
case 'i': // continue even if checksum is bad
@@ -106,9 +108,6 @@
wantUsage = true;
}
break;
- case 't': // temp file, used when opening compressed Jar
- gOptions.tempFileName = optarg;
- break;
case 'o': // output file
gOptions.outputFileName = optarg;
break;