summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--runtime/monitor.cc4
-rw-r--r--runtime/thread.cc12
-rw-r--r--runtime/thread.h4
3 files changed, 12 insertions, 8 deletions
diff --git a/runtime/monitor.cc b/runtime/monitor.cc
index aee30868ed..371a9d9dd6 100644
--- a/runtime/monitor.cc
+++ b/runtime/monitor.cc
@@ -165,7 +165,9 @@ bool Monitor::Install(Thread* self) {
bool success = GetObject()->CasLockWordWeakSequentiallyConsistent(lw, fat);
// Lock profiling.
if (success && owner_ != nullptr && lock_profiling_threshold_ != 0) {
- locking_method_ = owner_->GetCurrentMethod(&locking_dex_pc_);
+ // Do not abort on dex pc errors. This can easily happen when we want to dump a stack trace on
+ // abort.
+ locking_method_ = owner_->GetCurrentMethod(&locking_dex_pc_, false);
}
return success;
}
diff --git a/runtime/thread.cc b/runtime/thread.cc
index ddba708049..18e28ea11c 100644
--- a/runtime/thread.cc
+++ b/runtime/thread.cc
@@ -1975,10 +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, bool fail_on_error)
+ CurrentMethodVisitor(Thread* thread, Context* context, bool abort_on_error)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_)
: StackVisitor(thread, context), this_object_(nullptr), method_(nullptr), dex_pc_(0),
- fail_on_error_(fail_on_error) {}
+ abort_on_error_(abort_on_error) {}
bool VisitFrame() OVERRIDE SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
mirror::ArtMethod* m = GetMethod();
if (m->IsRuntimeMethod()) {
@@ -1989,17 +1989,17 @@ struct CurrentMethodVisitor FINAL : public StackVisitor {
this_object_ = GetThisObject();
}
method_ = m;
- dex_pc_ = GetDexPc(fail_on_error_);
+ dex_pc_ = GetDexPc(abort_on_error_);
return false;
}
mirror::Object* this_object_;
mirror::ArtMethod* method_;
uint32_t dex_pc_;
- const bool fail_on_error_;
+ const bool abort_on_error_;
};
-mirror::ArtMethod* Thread::GetCurrentMethod(uint32_t* dex_pc) const {
- CurrentMethodVisitor visitor(const_cast<Thread*>(this), nullptr, false);
+mirror::ArtMethod* Thread::GetCurrentMethod(uint32_t* dex_pc, bool abort_on_error) const {
+ CurrentMethodVisitor visitor(const_cast<Thread*>(this), nullptr, abort_on_error);
visitor.WalkStack(false);
if (dex_pc != nullptr) {
*dex_pc = visitor.dex_pc_;
diff --git a/runtime/thread.h b/runtime/thread.h
index 998f7db460..3e9372fe1a 100644
--- a/runtime/thread.h
+++ b/runtime/thread.h
@@ -322,7 +322,9 @@ class Thread {
tlsPtr_.long_jump_context = context;
}
- mirror::ArtMethod* GetCurrentMethod(uint32_t* dex_pc) const
+ // Get the current method and dex pc. If there are errors in retrieving the dex pc, this will
+ // abort the runtime iff abort_on_error is true.
+ mirror::ArtMethod* GetCurrentMethod(uint32_t* dex_pc, bool abort_on_error = true) const
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
ThrowLocation GetCurrentLocationForThrow() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);