summaryrefslogtreecommitdiffstats
path: root/runtime/interpreter/interpreter_common.cc
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/interpreter/interpreter_common.cc')
-rw-r--r--runtime/interpreter/interpreter_common.cc11
1 files changed, 5 insertions, 6 deletions
diff --git a/runtime/interpreter/interpreter_common.cc b/runtime/interpreter/interpreter_common.cc
index 3ab7f3036e..754602f943 100644
--- a/runtime/interpreter/interpreter_common.cc
+++ b/runtime/interpreter/interpreter_common.cc
@@ -491,12 +491,12 @@ uint32_t FindNextInstructionFollowingException(Thread* self,
ThrowLocation throw_location;
StackHandleScope<3> hs(self);
Handle<mirror::Throwable> exception(hs.NewHandle(self->GetException(&throw_location)));
- if (!self->IsExceptionReportedToInstrumentation() && instrumentation->HasExceptionCaughtListeners()) {
+ if (instrumentation->HasExceptionCaughtListeners()
+ && self->IsExceptionThrownByCurrentMethod(exception.Get())) {
CatchLocationFinder clf(self, &exception);
clf.WalkStack(false);
instrumentation->ExceptionCaughtEvent(self, throw_location, clf.GetCatchMethod(),
clf.GetCatchDexPc(), exception.Get());
- self->SetExceptionReportedToInstrumentation(true);
}
bool clear_exception = false;
uint32_t found_dex_pc;
@@ -507,13 +507,12 @@ uint32_t FindNextInstructionFollowingException(Thread* self,
&clear_exception);
}
if (found_dex_pc == DexFile::kDexNoIndex) {
+ // Exception is not caught by the current method. We will unwind to the
+ // caller. Notify any instrumentation listener.
instrumentation->MethodUnwindEvent(self, shadow_frame.GetThisObject(),
shadow_frame.GetMethod(), dex_pc);
} else {
- if (self->IsExceptionReportedToInstrumentation()) {
- instrumentation->MethodUnwindEvent(self, shadow_frame.GetThisObject(),
- shadow_frame.GetMethod(), dex_pc);
- }
+ // Exception is caught in the current method. We will jump to the found_dex_pc.
if (clear_exception) {
self->ClearException();
}