Update instrumentation stack after exception event
If instrumentation is updated on an exception event, we must update
the instrumentation stack (to remove all frames that will be unwound
by the exception) before doing the long jump.
Bug: 23471864
Change-Id: Ic91552bb7280c54bcc58b7ba03a17040b0b0f5ef
diff --git a/runtime/quick_exception_handler.cc b/runtime/quick_exception_handler.cc
index d1a4081..9d5ce9f 100644
--- a/runtime/quick_exception_handler.cc
+++ b/runtime/quick_exception_handler.cc
@@ -152,6 +152,9 @@
if (instrumentation->HasExceptionCaughtListeners()
&& self_->IsExceptionThrownByCurrentMethod(exception)) {
instrumentation->ExceptionCaughtEvent(self_, exception_ref.Get());
+ // Instrumentation may have been updated.
+ method_tracing_active_ = is_deoptimization_ ||
+ Runtime::Current()->GetInstrumentation()->AreExitStubsInstalled();
}
}
diff --git a/runtime/quick_exception_handler.h b/runtime/quick_exception_handler.h
index ce9085d..e934834 100644
--- a/runtime/quick_exception_handler.h
+++ b/runtime/quick_exception_handler.h
@@ -85,7 +85,7 @@
Context* const context_;
const bool is_deoptimization_;
// Is method tracing active?
- const bool method_tracing_active_;
+ bool method_tracing_active_;
// Quick frame with found handler or last frame if no handler found.
ArtMethod** handler_quick_frame_;
// PC to branch to for the handler.