Use try item offset to find catch block instead of Dex PC.
Change-Id: Icb8cd07a824be638c02a6204cfaf034a249d49b5
diff --git a/src/dex_file.cc b/src/dex_file.cc
index 85dafee..eb2a157 100644
--- a/src/dex_file.cc
+++ b/src/dex_file.cc
@@ -1001,9 +1001,19 @@
default:
offset = DexFile::FindCatchHandlerOffset(code_item, code_item.tries_size_, address);
}
+ Init(code_item, offset);
+}
+
+CatchHandlerIterator::CatchHandlerIterator(const DexFile::CodeItem& code_item,
+ const DexFile::TryItem& try_item) {
+ handler_.address_ = -1;
+ Init(code_item, try_item.handler_off_);
+}
+
+void CatchHandlerIterator::Init(const DexFile::CodeItem& code_item,
+ int32_t offset) {
if (offset >= 0) {
- const byte* handler_data = DexFile::GetCatchHandlerData(code_item, offset);
- Init(handler_data);
+ Init(DexFile::GetCatchHandlerData(code_item, offset));
} else {
// Not found, initialize as empty
current_data_ = NULL;