summaryrefslogtreecommitdiffstats
path: root/runtime/monitor.cc
diff options
context:
space:
mode:
authorAndreas Gampe <agampe@google.com>2014-08-18 05:19:46 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-08-18 05:19:46 +0000
commit3b18f257344f911d7223bd36b90d1a4ad5331933 (patch)
tree93970f631b75ce62208625bfa06b1d60e9f59884 /runtime/monitor.cc
parent517e1e72e50bc30f438ef3826a37213e4ee65dbd (diff)
parentd75383af2f0843ecd2f493fd64b4eb38630c6071 (diff)
downloadart-3b18f257344f911d7223bd36b90d1a4ad5331933.tar.gz
art-3b18f257344f911d7223bd36b90d1a4ad5331933.tar.bz2
art-3b18f257344f911d7223bd36b90d1a4ad5331933.zip
am d75383af: am 5e8a63ae: Merge "ART: Do not recursively abort when visiting locks in a bad state" into lmp-dev
* commit 'd75383af2f0843ecd2f493fd64b4eb38630c6071': ART: Do not recursively abort when visiting locks in a bad state
Diffstat (limited to 'runtime/monitor.cc')
-rw-r--r--runtime/monitor.cc13
1 files changed, 11 insertions, 2 deletions
diff --git a/runtime/monitor.cc b/runtime/monitor.cc
index 8f5ae54d89..5dd16efa02 100644
--- a/runtime/monitor.cc
+++ b/runtime/monitor.cc
@@ -945,7 +945,7 @@ mirror::Object* Monitor::GetContendedMonitor(Thread* thread) {
}
void Monitor::VisitLocks(StackVisitor* stack_visitor, void (*callback)(mirror::Object*, void*),
- void* callback_context) {
+ void* callback_context, bool abort_on_failure) {
mirror::ArtMethod* m = stack_visitor->GetMethod();
CHECK(m != NULL);
@@ -978,10 +978,19 @@ void Monitor::VisitLocks(StackVisitor* stack_visitor, void (*callback)(mirror::O
return; // No "tries" implies no synchronization, so no held locks to report.
}
+ // Get the dex pc. If abort_on_failure is false, GetDexPc will not abort in the case it cannot
+ // find the dex pc, and instead return kDexNoIndex. Then bail out, as it indicates we have an
+ // inconsistent stack anyways.
+ uint32_t dex_pc = stack_visitor->GetDexPc(abort_on_failure);
+ if (!abort_on_failure && dex_pc == DexFile::kDexNoIndex) {
+ LOG(ERROR) << "Could not find dex_pc for " << PrettyMethod(m);
+ return;
+ }
+
// Ask the verifier for the dex pcs of all the monitor-enter instructions corresponding to
// the locks held in this stack frame.
std::vector<uint32_t> monitor_enter_dex_pcs;
- verifier::MethodVerifier::FindLocksAtDexPc(m, stack_visitor->GetDexPc(), &monitor_enter_dex_pcs);
+ verifier::MethodVerifier::FindLocksAtDexPc(m, dex_pc, &monitor_enter_dex_pcs);
if (monitor_enter_dex_pcs.empty()) {
return;
}