summaryrefslogtreecommitdiffstats
path: root/runtime/dex_instruction.cc
diff options
context:
space:
mode:
authorAnestis Bechtsoudis <anestis@census-labs.com>2015-02-22 22:32:57 -0800
committerAndreas Gampe <agampe@google.com>2015-02-25 11:48:40 -0800
commit32f500daa2c04b1efe946c12c90502736e47d5fc (patch)
tree7065250ac6e2c07c252e1522bbf5762e7437133c /runtime/dex_instruction.cc
parent01b7c431ed85e0eae4554f6fc0f79a78bc82f31f (diff)
downloadart-32f500daa2c04b1efe946c12c90502736e47d5fc.tar.gz
art-32f500daa2c04b1efe946c12c90502736e47d5fc.tar.bz2
art-32f500daa2c04b1efe946c12c90502736e47d5fc.zip
ART: oatdump enhancements
New features list includes: - Class filter option to limit classes search space - Method filter is applied only against the method name, instead of the entire signature. Can be combined with class filter for maximum efficiency. - Bulk dump of class and method names list only. Can be combined with filters to limit results. - Export embedded dex files from input oat files to filesystem (symlinks not supported as utils functions are utilized for os & fs operations). - addr2instr option to locate the in-range method implementation and limit disassemble dumps. Input relative addr is added to oat executable offset to calculate the search offset. If method has been successfully located, code is dumped and program aborts further analysis of the input file. Methods located before the target address just print their signature, although skip all disassemble and other info. Calculated search offset is also printed as part of the initial header info. - Little-endian dex instructions bytecode is printed in the same line before the instruction string. Some minor re-orders have been also taken place for more targeted results. Change-Id: I3116ee3c99c258718f46faea8ea4295da6ae2bf7 Signed-off-by: Anestis Bechtsoudis <anestis@census-labs.com>
Diffstat (limited to 'runtime/dex_instruction.cc')
-rw-r--r--runtime/dex_instruction.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/runtime/dex_instruction.cc b/runtime/dex_instruction.cc
index a802759474..92e0f070bc 100644
--- a/runtime/dex_instruction.cc
+++ b/runtime/dex_instruction.cc
@@ -134,6 +134,23 @@ std::string Instruction::DumpHex(size_t code_units) const {
return os.str();
}
+std::string Instruction::DumpHexLE(size_t instr_code_units) const {
+ size_t inst_length = SizeInCodeUnits();
+ if (inst_length > instr_code_units) {
+ inst_length = instr_code_units;
+ }
+ std::ostringstream os;
+ const uint16_t* insn = reinterpret_cast<const uint16_t*>(this);
+ for (size_t i = 0; i < inst_length; i++) {
+ os << StringPrintf("%02x%02x", (uint8_t)(insn[i] & 0x00FF),
+ (uint8_t)((insn[i] & 0xFF00)>>8)) << " ";
+ }
+ for (size_t i = inst_length; i < instr_code_units; i++) {
+ os << " ";
+ }
+ return os.str();
+}
+
std::string Instruction::DumpString(const DexFile* file) const {
std::ostringstream os;
const char* opcode = kInstructionNames[Opcode()];