diff options
author | Sebastien Hertz <shertz@google.com> | 2013-11-27 15:49:42 +0100 |
---|---|---|
committer | Sebastien Hertz <shertz@google.com> | 2013-12-05 15:02:35 +0100 |
commit | 123756a041baf8421ed933312605daa5ef082f6f (patch) | |
tree | 0b9524660399b9e42adcc178027c9ddd8a61bd38 /runtime | |
parent | 315ab6c077c4db2031f1ffa40b78722d8269dc9b (diff) | |
download | art-123756a041baf8421ed933312605daa5ef082f6f.zip art-123756a041baf8421ed933312605daa5ef082f6f.tar.gz art-123756a041baf8421ed933312605daa5ef082f6f.tar.bz2 |
Fix JDWP class-only modifier.
Fix Dbg::MatchType which is used for class-only and exception-only modifiers.
Also fix crash happening when notifying an exception. A debugger may walk the
stack of the current thread so we need to keep the instrumentation stack frame
synced with the native stack.
Bug: 11856587
Change-Id: Ibf95f8a83ce9ee640abf945e498b42cc88ea92a0
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/debugger.cc | 3 | ||||
-rw-r--r-- | runtime/stack.cc | 1 | ||||
-rw-r--r-- | runtime/thread.cc | 11 |
3 files changed, 10 insertions, 5 deletions
diff --git a/runtime/debugger.cc b/runtime/debugger.cc index 52a2141..e4b8a8a 100644 --- a/runtime/debugger.cc +++ b/runtime/debugger.cc @@ -452,6 +452,7 @@ void Dbg::StartJdwp() { void Dbg::StopJdwp() { delete gJdwpState; + gJdwpState = NULL; delete gRegistry; gRegistry = NULL; } @@ -1113,7 +1114,7 @@ bool Dbg::MatchType(JDWP::RefTypeId instance_class_id, JDWP::RefTypeId class_id) CHECK(c1 != NULL); mirror::Class* c2 = DecodeClass(class_id, status); CHECK(c2 != NULL); - return c1->IsAssignableFrom(c2); + return c2->IsAssignableFrom(c1); } static JDWP::FieldId ToFieldId(const mirror::ArtField* f) diff --git a/runtime/stack.cc b/runtime/stack.cc index a505383..4e3fb4a 100644 --- a/runtime/stack.cc +++ b/runtime/stack.cc @@ -259,6 +259,7 @@ std::string StackVisitor::DescribeLocation() const { } instrumentation::InstrumentationStackFrame& StackVisitor::GetInstrumentationStackFrame(uint32_t depth) const { + CHECK_LT(depth, thread_->GetInstrumentationStack()->size()); return thread_->GetInstrumentationStack()->at(depth); } diff --git a/runtime/thread.cc b/runtime/thread.cc index 1add507..1e2a742 100644 --- a/runtime/thread.cc +++ b/runtime/thread.cc @@ -1818,6 +1818,12 @@ class CatchBlockStackVisitor : public StackVisitor { self_->EndAssertNoThreadSuspension(last_no_assert_suspension_cause_); // Do instrumentation events after allowing thread suspension again. instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation(); + if (!is_deoptimization_) { + // The debugger may suspend this thread and walk its stack. Let's do this before popping + // instrumentation frames. + instrumentation->ExceptionCaughtEvent(self_, throw_location_, catch_method, handler_dex_pc_, + exception_); + } for (size_t i = 0; i < instrumentation_frames_to_pop_; ++i) { // We pop the instrumentation stack here so as not to corrupt it during the stack walk. if (i != instrumentation_frames_to_pop_ - 1 || self_->GetInstrumentationStack()->front().method_ != catch_method) { @@ -1825,10 +1831,7 @@ class CatchBlockStackVisitor : public StackVisitor { instrumentation->PopMethodForUnwind(self_, is_deoptimization_); } } - if (!is_deoptimization_) { - instrumentation->ExceptionCaughtEvent(self_, throw_location_, catch_method, handler_dex_pc_, - exception_); - } else { + if (is_deoptimization_) { // TODO: proper return value. self_->SetDeoptimizationShadowFrame(top_shadow_frame_); } |