summaryrefslogtreecommitdiffstats
path: root/dexdump
diff options
context:
space:
mode:
authorAndy McFadden <>2009-04-02 14:50:26 -0700
committerThe Android Open Source Project <initial-contribution@android.com>2009-04-02 14:50:26 -0700
commit13f2ea7bbd0b1a6807dd3d7879065f6a1344fb32 (patch)
tree6d80579a775cf8ea32cf1aa64d5681759d8edd7e /dexdump
parentd415159b9d85b9490bacd4cb152fcda276326c5e (diff)
parent0198b1443707d575d30c2b20f1bc3766a9221e96 (diff)
downloadandroid_dalvik-13f2ea7bbd0b1a6807dd3d7879065f6a1344fb32.tar.gz
android_dalvik-13f2ea7bbd0b1a6807dd3d7879065f6a1344fb32.tar.bz2
android_dalvik-13f2ea7bbd0b1a6807dd3d7879065f6a1344fb32.zip
Merge branch 'readonly-p4-master'
Diffstat (limited to 'dexdump')
-rw-r--r--dexdump/DexDump.c30
1 files changed, 24 insertions, 6 deletions
diff --git a/dexdump/DexDump.c b/dexdump/DexDump.c
index 784de13c0..bd9123671 100644
--- a/dexdump/DexDump.c
+++ b/dexdump/DexDump.c
@@ -46,6 +46,7 @@ static InstructionFormat* gInstrFormat;
/* command-line options */
struct {
+ bool checksumOnly;
bool disassemble;
bool showFileHeaders;
bool showSectionHeaders;
@@ -1303,7 +1304,11 @@ int process(const char* fileName)
goto bail;
}
- processDexFile(fileName, pDexFile);
+ if (gOptions.checksumOnly) {
+ printf("Checksum verified\n");
+ } else {
+ processDexFile(fileName, pDexFile);
+ }
result = 0;
@@ -1322,9 +1327,11 @@ bail:
void usage(void)
{
fprintf(stderr, "Copyright (C) 2007 The Android Open Source Project\n\n");
- fprintf(stderr, "%s: [-d] [-f] [-h] [-m] [-i] [-t tempfile] dexfile...\n",
+ fprintf(stderr,
+ "%s: [-c] [-d] [-f] [-h] [-m] [-i] [-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, " -f : display summary information from file header\n");
fprintf(stderr, " -h : display file header details\n");
@@ -1346,11 +1353,14 @@ int main(int argc, char* const argv[])
memset(&gOptions, 0, sizeof(gOptions));
while (1) {
- ic = getopt(argc, argv, "dfhimt:");
+ ic = getopt(argc, argv, "cdfhimt:");
if (ic < 0)
break;
switch (ic) {
+ case 'c': // verify the checksum then exit
+ gOptions.checksumOnly = true;
+ break;
case 'd': // disassemble Dalvik instructions
gOptions.disassemble = true;
break;
@@ -1380,6 +1390,11 @@ int main(int argc, char* const argv[])
wantUsage = true;
}
+ if (gOptions.checksumOnly && gOptions.ignoreBadChecksum) {
+ fprintf(stderr, "Can't specify both -c and -i\n");
+ wantUsage = true;
+ }
+
/* initialize some VM tables */
gInstrWidth = dexCreateInstrWidthTable();
gInstrFormat = dexCreateInstrFormatTable();
@@ -1389,11 +1404,14 @@ int main(int argc, char* const argv[])
return 2;
}
- while (optind < argc)
- process(argv[optind++]);
+ int result = 0;
+ while (optind < argc) {
+ result |= process(argv[optind++]);
+ }
free(gInstrWidth);
free(gInstrFormat);
- return 0;
+ return (result != 0);
}
+