diff options
author | Orion Hodson <oth@google.com> | 2018-10-11 10:01:21 +0100 |
---|---|---|
committer | Orion Hodson <oth@google.com> | 2018-10-22 17:38:51 +0100 |
commit | d159521daac233a82b235c7a6baeb7e3d3c498a0 (patch) | |
tree | b3d7872f76b8b1c72c6efd968b9ac4a3bb7e9a30 | |
parent | 5ae27dfb9cee5a312cb0a1e1da57195107b7bbf4 (diff) | |
download | dalvik-d159521daac233a82b235c7a6baeb7e3d3c498a0.tar.gz |
dexdump: Expand version check to allow 039 DEX filesandroid-9.0.0_r47android-9.0.0_r46android-9.0.0_r45android-9.0.0_r44android-9.0.0_r43android-9.0.0_r42android-9.0.0_r41android-9.0.0_r40android-9.0.0_r37android-9.0.0_r36pie-qpr3-s1-releasepie-qpr3-releasepie-qpr3-b-releasepie-b4s4-dev
Remove unused logic for extended bytecodes libdex/DexOpcodes.h which
breaks dexdump output for the const-method-type bytecode. This dates
back to 111221644 when there were raw and packed opcodes.
Add --no-clean option to the dx run-test script to use DEX file from
test to validate dexdump (dexdump is deprecated and has no tests of
it's own).
Bug: 117409365
Bug: 117767860
Test: dalvik/dx/run-test --no-clean 142-const-method-handle && dexdump -d ${TEST_DIR}/constmethodhandle.dex
(cherry picked from commit ea2a4f6e68fc75705d0c4d1298605696dbfa30d1)
Change-Id: Id7aa87a7d1634d4ccd2a96fc4b27da36fbc28cc6
-rwxr-xr-x | dx/tests/run-test | 10 | ||||
-rw-r--r-- | libdex/DexOpcodes.h | 6 | ||||
-rw-r--r-- | libdex/DexSwapVerify.cpp | 3 |
3 files changed, 11 insertions, 8 deletions
diff --git a/dx/tests/run-test b/dx/tests/run-test index f205c4690..a781d8d59 100755 --- a/dx/tests/run-test +++ b/dx/tests/run-test @@ -54,6 +54,7 @@ run="run" expected="expected.txt" output="out.txt" +clean_on_exit="yes" dev_mode="no" update_mode="no" tmpdir=/tmp/test-$$ @@ -61,7 +62,8 @@ usage="no" while [[ "x$1" = "x-"* ]]; do case $1 in - --dev) dev_mode="yes" ;; + --dev) dev_mode="yes" ;; + --no-clean) clean_on_exit="no" ;; --output_dir) tmpdir=$2 shift ;; @@ -156,7 +158,11 @@ fi if [ "$good" = "yes" ]; then cd "$oldwd" - rm -rf "$tmpdir" + if [ "$clean_on_exit" = "yes" ]; then + rm -rf "$tmpdir" + else + echo "Test artifacts left in $tmpdir" + fi exit 0 fi diff --git a/libdex/DexOpcodes.h b/libdex/DexOpcodes.h index 1c684ab63..f4dcd6b51 100644 --- a/libdex/DexOpcodes.h +++ b/libdex/DexOpcodes.h @@ -609,11 +609,7 @@ DEX_INLINE Opcode dexOpcodeFromCodeUnit(u2 codeUnit) { * that data tables get generated in a consistent way. */ int lowByte = codeUnit & 0xff; - if (lowByte != 0xff) { - return (Opcode) lowByte; - } else { - return (Opcode) ((codeUnit >> 8) | 0x100); - } + return (Opcode) lowByte; } /* diff --git a/libdex/DexSwapVerify.cpp b/libdex/DexSwapVerify.cpp index 8836ab227..1f8eed828 100644 --- a/libdex/DexSwapVerify.cpp +++ b/libdex/DexSwapVerify.cpp @@ -2908,7 +2908,8 @@ bool dexHasValidMagic(const DexHeader* pHeader) if ((memcmp(version, DEX_MAGIC_VERS, 4) != 0) && (memcmp(version, DEX_MAGIC_VERS_API_13, 4) != 0) && (memcmp(version, DEX_MAGIC_VERS_37, 4) != 0) && - (memcmp(version, DEX_MAGIC_VERS_38, 4) != 0)) { + (memcmp(version, DEX_MAGIC_VERS_38, 4) != 0) && + (memcmp(version, DEX_MAGIC_VERS_39, 4) != 0)) { /* * Magic was correct, but this is an unsupported older or * newer format variant. |