summaryrefslogtreecommitdiff
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.cc13
1 files changed, 8 insertions, 5 deletions
diff --git a/runtime/interpreter/interpreter_common.cc b/runtime/interpreter/interpreter_common.cc
index cafe74714e..c8a87c1d75 100644
--- a/runtime/interpreter/interpreter_common.cc
+++ b/runtime/interpreter/interpreter_common.cc
@@ -150,11 +150,14 @@ bool SendMethodExitEvents(Thread* self,
// behavior.
bool MoveToExceptionHandler(Thread* self,
ShadowFrame& shadow_frame,
- const instrumentation::Instrumentation* instrumentation) {
+ bool skip_listeners,
+ bool skip_throw_listener) {
self->VerifyStack();
StackHandleScope<2> hs(self);
Handle<mirror::Throwable> exception(hs.NewHandle(self->GetException()));
- if (instrumentation != nullptr &&
+ const instrumentation::Instrumentation* instrumentation =
+ Runtime::Current()->GetInstrumentation();
+ if (!skip_throw_listener &&
instrumentation->HasExceptionThrownListeners() &&
self->IsExceptionThrownByCurrentMethod(exception.Get())) {
// See b/65049545 for why we don't need to check to see if the exception has changed.
@@ -169,7 +172,7 @@ bool MoveToExceptionHandler(Thread* self,
uint32_t found_dex_pc = shadow_frame.GetMethod()->FindCatchBlock(
hs.NewHandle(exception->GetClass()), shadow_frame.GetDexPC(), &clear_exception);
if (found_dex_pc == dex::kDexNoIndex) {
- if (instrumentation != nullptr) {
+ if (!skip_listeners) {
if (shadow_frame.NeedsNotifyPop()) {
instrumentation->WatchedFramePopped(self, shadow_frame);
if (shadow_frame.GetForcePopFrame()) {
@@ -189,12 +192,12 @@ bool MoveToExceptionHandler(Thread* self,
return shadow_frame.GetForcePopFrame();
} else {
shadow_frame.SetDexPC(found_dex_pc);
- if (instrumentation != nullptr && instrumentation->HasExceptionHandledListeners()) {
+ if (!skip_listeners && instrumentation->HasExceptionHandledListeners()) {
self->ClearException();
instrumentation->ExceptionHandledEvent(self, exception.Get());
if (UNLIKELY(self->IsExceptionPending())) {
// Exception handled event threw an exception. Try to find the handler for this one.
- return MoveToExceptionHandler(self, shadow_frame, instrumentation);
+ return MoveToExceptionHandler(self, shadow_frame, skip_listeners, skip_throw_listener);
} else if (!clear_exception) {
self->SetException(exception.Get());
}