summaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
authorAndreas Gampe <agampe@google.com>2014-07-16 22:20:31 -0700
committerAndreas Gampe <agampe@google.com>2014-07-25 09:22:34 +0000
commit4a8c3fa4bd8d95fac5671ab778dd00b6dc3ec0e4 (patch)
treeb601d3d5dabfe16571f5fe10667cb9e09cf8a329 /runtime
parent81457a3cd8fca14396b5785a4e4c8070c259b07a (diff)
downloadart-4a8c3fa4bd8d95fac5671ab778dd00b6dc3ec0e4.zip
art-4a8c3fa4bd8d95fac5671ab778dd00b6dc3ec0e4.tar.gz
art-4a8c3fa4bd8d95fac5671ab778dd00b6dc3ec0e4.tar.bz2
ART: Relax CurrentMethodVisitor requirements on GetDexPC
In case we want to dump a Java stack after an unhandled fault, in case we hold a thinlocked monitor, that monitor might get inflated. That can cause an abort as we may not have enough/correct information for the state at the bottom-most call. Relax GetDexPc in the CurrentMethodVisitor to not abort when it cannot find a dex pc. Instead, let the caller handle such a case. This CL allows the locking_dex_pc_ in Monitor to be DexFile::kDexNoIndex, which avoids the above abort. Bug: 16352802, 16556938 Change-Id: I3adf89b2d8f018a0c3e3abdd26e542f46ee59eef
Diffstat (limited to 'runtime')
-rw-r--r--runtime/monitor_android.cc1
-rw-r--r--runtime/thread.cc5
2 files changed, 5 insertions, 1 deletions
diff --git a/runtime/monitor_android.cc b/runtime/monitor_android.cc
index d89290b..c46efd8 100644
--- a/runtime/monitor_android.cc
+++ b/runtime/monitor_android.cc
@@ -79,6 +79,7 @@ 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 f888029..cfa2290 100644
--- a/runtime/thread.cc
+++ b/runtime/thread.cc
@@ -1970,6 +1970,8 @@ Context* Thread::GetLongJumpContext() {
return result;
}
+// 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)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_)
@@ -1984,7 +1986,7 @@ struct CurrentMethodVisitor FINAL : public StackVisitor {
this_object_ = GetThisObject();
}
method_ = m;
- dex_pc_ = GetDexPc();
+ dex_pc_ = GetDexPc(false); // We may not have a valid PC. Let the caller deal with it.
return false;
}
mirror::Object* this_object_;
@@ -2005,6 +2007,7 @@ ThrowLocation Thread::GetCurrentLocationForThrow() {
Context* context = GetLongJumpContext();
CurrentMethodVisitor visitor(this, context);
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_);
}