diff options
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_); } |