diff options
| -rw-r--r-- | runtime/monitor_android.cc | 1 | ||||
| -rw-r--r-- | runtime/thread.cc | 13 |
2 files changed, 7 insertions, 7 deletions
diff --git a/runtime/monitor_android.cc b/runtime/monitor_android.cc index c46efd8093..d89290b836 100644 --- a/runtime/monitor_android.cc +++ b/runtime/monitor_android.cc @@ -79,7 +79,6 @@ void Monitor::LogContentionEvent(Thread* self, uint32_t wait_ms, uint32_t sample // Emit the source code file name, <= 37 bytes. uint32_t pc; mirror::ArtMethod* m = self->GetCurrentMethod(&pc); - CHECK_NE(pc, DexFile::kDexNoIndex); // TODO: Can we relax this check? const char* filename; uint32_t line_number; TranslateLocation(m, pc, &filename, &line_number); diff --git a/runtime/thread.cc b/runtime/thread.cc index f041263994..ddba708049 100644 --- a/runtime/thread.cc +++ b/runtime/thread.cc @@ -1975,9 +1975,10 @@ Context* Thread::GetLongJumpContext() { // Note: this visitor may return with a method set, but dex_pc_ being DexFile:kDexNoIndex. This is // so we don't abort in a special situation (thinlocked monitor) when dumping the Java stack. struct CurrentMethodVisitor FINAL : public StackVisitor { - CurrentMethodVisitor(Thread* thread, Context* context) + CurrentMethodVisitor(Thread* thread, Context* context, bool fail_on_error) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) - : StackVisitor(thread, context), this_object_(nullptr), method_(nullptr), dex_pc_(0) {} + : StackVisitor(thread, context), this_object_(nullptr), method_(nullptr), dex_pc_(0), + fail_on_error_(fail_on_error) {} bool VisitFrame() OVERRIDE SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { mirror::ArtMethod* m = GetMethod(); if (m->IsRuntimeMethod()) { @@ -1988,16 +1989,17 @@ struct CurrentMethodVisitor FINAL : public StackVisitor { this_object_ = GetThisObject(); } method_ = m; - dex_pc_ = GetDexPc(false); // We may not have a valid PC. Let the caller deal with it. + dex_pc_ = GetDexPc(fail_on_error_); return false; } mirror::Object* this_object_; mirror::ArtMethod* method_; uint32_t dex_pc_; + const bool fail_on_error_; }; mirror::ArtMethod* Thread::GetCurrentMethod(uint32_t* dex_pc) const { - CurrentMethodVisitor visitor(const_cast<Thread*>(this), nullptr); + CurrentMethodVisitor visitor(const_cast<Thread*>(this), nullptr, false); visitor.WalkStack(false); if (dex_pc != nullptr) { *dex_pc = visitor.dex_pc_; @@ -2007,9 +2009,8 @@ mirror::ArtMethod* Thread::GetCurrentMethod(uint32_t* dex_pc) const { ThrowLocation Thread::GetCurrentLocationForThrow() { Context* context = GetLongJumpContext(); - CurrentMethodVisitor visitor(this, context); + CurrentMethodVisitor visitor(this, context, true); visitor.WalkStack(false); - CHECK_NE(visitor.dex_pc_, DexFile::kDexNoIndex); // TODO: Can we relax this? ReleaseLongJumpContext(context); return ThrowLocation(visitor.this_object_, visitor.method_, visitor.dex_pc_); } |