summaryrefslogtreecommitdiff
path: root/compiler/cfi_test.h
diff options
context:
space:
mode:
author Aart Bik <ajcbik@google.com> 2016-05-11 10:30:47 -0700
committer Aart Bik <ajcbik@google.com> 2016-05-12 10:01:08 -0700
commitd3059e77818a058513ed92557160bdb6d5102b67 (patch)
treecff82528de3dd71104d9b3fa4e1a57f2c9fc81dc /compiler/cfi_test.h
parentb0fca360a081eff1a44c6f055c628e2dba44c003 (diff)
Fix oatdump crash on arm64/arm code.
Also adds 16 bit literal information. Rationale: When "run-away" instructions are disassembled, the literal addresses may go out of range, causing oatdump to crash. This CL guards memory access against the full memory range allocated to assembly instructions and data (it is possible but not really necessary to refine this a bit). Out of range arguments are now displayed as (?) to denote the issue, which is a lot nicer than crashing. BUG=28670871 Change-Id: I51e9b6a6a99162546fe31059f14278e8980451c2
Diffstat (limited to 'compiler/cfi_test.h')
-rw-r--r--compiler/cfi_test.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/cfi_test.h b/compiler/cfi_test.h
index 230cb9aeea..f8b7460935 100644
--- a/compiler/cfi_test.h
+++ b/compiler/cfi_test.h
@@ -55,7 +55,9 @@ class CFITest : public dwarf::DwarfTest {
kCFIFormat, 0, &debug_frame_data_, &debug_frame_patches);
ReformatCfi(Objdump(false, "-W"), &lines);
// Pretty-print assembly.
- auto* opts = new DisassemblerOptions(false, actual_asm.data(), true);
+ const uint8_t* asm_base = actual_asm.data();
+ const uint8_t* asm_end = asm_base + actual_asm.size();
+ auto* opts = new DisassemblerOptions(false, asm_base, asm_end, true);
std::unique_ptr<Disassembler> disasm(Disassembler::Create(isa, opts));
std::stringstream stream;
const uint8_t* base = actual_asm.data() + (isa == kThumb2 ? 1 : 0);