summaryrefslogtreecommitdiffstats
path: root/dexdump
diff options
context:
space:
mode:
Diffstat (limited to 'dexdump')
-rw-r--r--dexdump/dexdump.cc13
-rw-r--r--dexdump/dexdump_cfg.cc9
2 files changed, 12 insertions, 10 deletions
diff --git a/dexdump/dexdump.cc b/dexdump/dexdump.cc
index 730d4b97a0..ba2a9228b6 100644
--- a/dexdump/dexdump.cc
+++ b/dexdump/dexdump.cc
@@ -48,6 +48,7 @@
#include "dex_file-inl.h"
#include "dex_file_loader.h"
#include "dex_file_types.h"
+#include "dex_file_exception_helpers.h"
#include "dex_instruction-inl.h"
#include "dexdump_cfg.h"
@@ -735,7 +736,8 @@ static void dumpInterface(const DexFile* pDexFile, const DexFile::TypeItem& pTyp
* Dumps the catches table associated with the code.
*/
static void dumpCatches(const DexFile* pDexFile, const DexFile::CodeItem* pCode) {
- const u4 triesSize = CodeItemDataAccessor(pDexFile, pCode).TriesSize();
+ CodeItemDataAccessor accessor(pDexFile, pCode);
+ const u4 triesSize = accessor.TriesSize();
// No catch table.
if (triesSize == 0) {
@@ -745,12 +747,11 @@ static void dumpCatches(const DexFile* pDexFile, const DexFile::CodeItem* pCode)
// Dump all table entries.
fprintf(gOutFile, " catches : %d\n", triesSize);
- for (u4 i = 0; i < triesSize; i++) {
- const DexFile::TryItem* pTry = pDexFile->GetTryItems(*pCode, i);
- const u4 start = pTry->start_addr_;
- const u4 end = start + pTry->insn_count_;
+ for (const DexFile::TryItem& try_item : accessor.TryItems()) {
+ const u4 start = try_item.start_addr_;
+ const u4 end = start + try_item.insn_count_;
fprintf(gOutFile, " 0x%04x - 0x%04x\n", start, end);
- for (CatchHandlerIterator it(*pCode, *pTry); it.HasNext(); it.Next()) {
+ for (CatchHandlerIterator it(accessor, try_item); it.HasNext(); it.Next()) {
const dex::TypeIndex tidx = it.GetHandlerTypeIndex();
const char* descriptor = (!tidx.IsValid()) ? "<any>" : pDexFile->StringByTypeIdx(tidx);
fprintf(gOutFile, " %s -> 0x%04x\n", descriptor, it.GetHandlerAddress());
diff --git a/dexdump/dexdump_cfg.cc b/dexdump/dexdump_cfg.cc
index dd57a11758..7e9f113da3 100644
--- a/dexdump/dexdump_cfg.cc
+++ b/dexdump/dexdump_cfg.cc
@@ -27,6 +27,7 @@
#include "code_item_accessors-no_art-inl.h"
#include "dex_file-inl.h"
+#include "dex_file_exception_helpers.h"
#include "dex_instruction-inl.h"
namespace art {
@@ -38,7 +39,7 @@ static void dumpMethodCFGImpl(const DexFile* dex_file,
os << "digraph {\n";
os << " # /* " << dex_file->PrettyMethod(dex_method_idx, true) << " */\n";
- CodeItemInstructionAccessor accessor(dex_file, code_item);
+ CodeItemDataAccessor accessor(dex_file, code_item);
std::set<uint32_t> dex_pc_is_branch_target;
{
@@ -195,7 +196,7 @@ static void dumpMethodCFGImpl(const DexFile* dex_file,
}
// Look at the exceptions of the first entry.
- CatchHandlerIterator catch_it(*code_item, dex_pc);
+ CatchHandlerIterator catch_it(accessor, dex_pc);
for (; catch_it.HasNext(); catch_it.Next()) {
exception_targets.insert(catch_it.GetHandlerAddress());
}
@@ -254,7 +255,7 @@ static void dumpMethodCFGImpl(const DexFile* dex_file,
// Exception edges. If this is not the first instruction in the block
if (block_start_dex_pc != dex_pc) {
std::set<uint32_t> current_handler_pcs;
- CatchHandlerIterator catch_it(*code_item, dex_pc);
+ CatchHandlerIterator catch_it(accessor, dex_pc);
for (; catch_it.HasNext(); catch_it.Next()) {
current_handler_pcs.insert(catch_it.GetHandlerAddress());
}
@@ -295,7 +296,7 @@ static void dumpMethodCFGImpl(const DexFile* dex_file,
const Instruction* inst = &accessor.InstructionAt(dex_pc);
uint32_t this_node_id = dex_pc_to_incl_id.find(dex_pc)->second;
while (true) {
- CatchHandlerIterator catch_it(*code_item, dex_pc);
+ CatchHandlerIterator catch_it(accessor, dex_pc);
if (catch_it.HasNext()) {
std::set<uint32_t> handled_targets;
for (; catch_it.HasNext(); catch_it.Next()) {