From ec7f1a96683836d9375adc48c6bf802c0ce2160e Mon Sep 17 00:00:00 2001 From: Jeff Hao Date: Mon, 13 Mar 2017 16:24:24 -0700 Subject: Added new -v option to dexlayout to verify output dex file. Passing -v will cause dexlayout to do an IR level comparison of the output with the original input dex file. This checks that the data in the dex files are the same, but allows for different offsets since the output dex file may have a different layout. Test: mm test-art-host Bug: 36107940 Change-Id: If75a93973ffdd2d91111727f089713c800d8cee8 --- dexlayout/dexlayout_main.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'dexlayout/dexlayout_main.cc') diff --git a/dexlayout/dexlayout_main.cc b/dexlayout/dexlayout_main.cc index 3eac660eca..38faf9688b 100644 --- a/dexlayout/dexlayout_main.cc +++ b/dexlayout/dexlayout_main.cc @@ -1,4 +1,4 @@ -/* + /* * Copyright (C) 2016 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -44,7 +44,7 @@ static const char* kProgramName = "dexlayout"; static void Usage(void) { fprintf(stderr, "Copyright (C) 2016 The Android Open Source Project\n\n"); fprintf(stderr, "%s: [-a] [-c] [-d] [-e] [-f] [-h] [-i] [-l layout] [-o outfile] [-p profile]" - " [-s] [-w directory] dexfile...\n\n", kProgramName); + " [-s] [-t] [-v] [-w directory] dexfile...\n\n", kProgramName); fprintf(stderr, " -a : display annotations\n"); fprintf(stderr, " -b : build dex_ir\n"); fprintf(stderr, " -c : verify checksum and exit\n"); @@ -58,6 +58,7 @@ static void Usage(void) { fprintf(stderr, " -p : profile file name (defaults to no profile)\n"); fprintf(stderr, " -s : visualize reference pattern\n"); fprintf(stderr, " -t : display file section sizes\n"); + fprintf(stderr, " -v : verify output file is canonical to input (IR level comparison)\n"); fprintf(stderr, " -w : output dex directory \n"); } @@ -76,7 +77,7 @@ int DexlayoutDriver(int argc, char** argv) { // Parse all arguments. while (1) { - const int ic = getopt(argc, argv, "abcdefghil:mo:p:stw:"); + const int ic = getopt(argc, argv, "abcdefghil:mo:p:stvw:"); if (ic < 0) { break; // done } @@ -132,6 +133,9 @@ int DexlayoutDriver(int argc, char** argv) { options.show_section_statistics_ = true; options.verbose_ = false; break; + case 'v': // verify output + options.verify_output_ = true; + break; case 'w': // output dex files directory options.output_dex_directory_ = optarg; break; -- cgit v1.2.3-59-g8ed1b