From 7642cfc90fc9c3ebfd8e3b5041915705c93b5cf0 Mon Sep 17 00:00:00 2001 From: Nicolas Geoffray Date: Thu, 26 Feb 2015 10:56:09 +0000 Subject: Change how we report exceptions to the debugger. This is only a refactoring/cleanup. Bug fixes with respect to catch location, and more cleanups will follow. Change-Id: I30d3c6260b0c8f8115a811621397225b88f2063a --- runtime/interpreter/interpreter_common.cc | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'runtime/interpreter/interpreter_common.cc') 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 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(); } -- cgit v1.2.3-59-g8ed1b