diff options
author | Brian Carlstrom <bdc@google.com> | 2014-09-14 20:34:17 -0700 |
---|---|---|
committer | Brian Carlstrom <bdc@google.com> | 2014-09-16 12:50:08 -0700 |
commit | 2cbaccb67e22c0b313a9785bfc65bcb4b25d0676 (patch) | |
tree | daeb766e19880b651fd9c4a719c9a07dd7d4bd0e /disassembler/disassembler_mips.cc | |
parent | bace0378d720a1d2938ec7f6be17e2814671d20a (diff) | |
download | art-2cbaccb67e22c0b313a9785bfc65bcb4b25d0676.zip art-2cbaccb67e22c0b313a9785bfc65bcb4b25d0676.tar.gz art-2cbaccb67e22c0b313a9785bfc65bcb4b25d0676.tar.bz2 |
Avoid printing absolute addresses in oatdump
- Added printing of OatClass offsets.
- Added printing of OatMethod offsets.
- Added bounds checks for code size size, code size, mapping table, gc map, vmap table.
- Added sanity check of 100k for code size.
- Added partial disassembly of questionable code.
- Added --no-disassemble to disable disassembly.
- Added --no-dump:vmap to disable vmap dumping.
- Reordered OatMethod info to be in file order.
Bug: 15567083
(cherry picked from commit 34fa79ece5b3a1940d412cd94dbdcc4225aae72f)
Change-Id: I2c368f3b81af53b735149a866f3e491c9ac33fb8
Diffstat (limited to 'disassembler/disassembler_mips.cc')
-rw-r--r-- | disassembler/disassembler_mips.cc | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/disassembler/disassembler_mips.cc b/disassembler/disassembler_mips.cc index 5e89f6f..bd5fac7 100644 --- a/disassembler/disassembler_mips.cc +++ b/disassembler/disassembler_mips.cc @@ -168,7 +168,7 @@ static uint32_t ReadU32(const uint8_t* ptr) { return ptr[0] | (ptr[1] << 8) | (ptr[2] << 16) | (ptr[3] << 24); } -static void DumpMips(std::ostream& os, const uint8_t* instr_ptr) { +size_t DisassemblerMips::Dump(std::ostream& os, const uint8_t* instr_ptr) { uint32_t instruction = ReadU32(instr_ptr); uint32_t rs = (instruction >> 21) & 0x1f; // I-type, R-type. @@ -197,7 +197,8 @@ static void DumpMips(std::ostream& os, const uint8_t* instr_ptr) { int32_t offset = static_cast<int16_t>(instruction & 0xffff); offset <<= 2; offset += 4; // Delay slot. - args << StringPrintf("%p ; %+d", instr_ptr + offset, offset); + args << FormatInstructionPointer(instr_ptr + offset) + << StringPrintf(" ; %+d", offset); } break; case 'D': args << 'r' << rd; break; @@ -254,17 +255,15 @@ static void DumpMips(std::ostream& os, const uint8_t* instr_ptr) { } } - os << StringPrintf("%p: %08x\t%-7s ", instr_ptr, instruction, opcode.c_str()) << args.str() << '\n'; -} - -size_t DisassemblerMips::Dump(std::ostream& os, const uint8_t* begin) { - DumpMips(os, begin); + os << FormatInstructionPointer(instr_ptr) + << StringPrintf(": %08x\t%-7s ", instruction, opcode.c_str()) + << args.str() << '\n'; return 4; } void DisassemblerMips::Dump(std::ostream& os, const uint8_t* begin, const uint8_t* end) { for (const uint8_t* cur = begin; cur < end; cur += 4) { - DumpMips(os, cur); + Dump(os, cur); } } |