summaryrefslogtreecommitdiffstats
path: root/vm/Thread.cpp
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2013-04-11 16:28:38 -0700
committerElliott Hughes <enh@google.com>2013-04-11 16:28:38 -0700
commitfeddac5b7718dd8141391bfeb6359f1906542823 (patch)
treeb9f50959caa0089a864619d3a680a154eb17b7db /vm/Thread.cpp
parent167bd12436dcf46740908a4d5898868e90cd716f (diff)
downloadandroid_dalvik-feddac5b7718dd8141391bfeb6359f1906542823.tar.gz
android_dalvik-feddac5b7718dd8141391bfeb6359f1906542823.tar.bz2
android_dalvik-feddac5b7718dd8141391bfeb6359f1906542823.zip
Harden the native stack dumping decision.
We've seen monkey crashes in this code, though I haven't been able to reproduce them in my own SIGQUIT stress tests. Address the two most likely causes of trouble: dumping the signal catcher's own thread (which will always be runnable), and assuming that the Method* pulled from the save area is non-NULL. Bug: 8596028 Change-Id: I59d1dcb2264a774d8416d50a5f77a06c70d37c59
Diffstat (limited to 'vm/Thread.cpp')
-rw-r--r--vm/Thread.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/vm/Thread.cpp b/vm/Thread.cpp
index c0321c105..aba98ab73 100644
--- a/vm/Thread.cpp
+++ b/vm/Thread.cpp
@@ -3320,13 +3320,18 @@ static bool shouldShowNativeStack(Thread* thread) {
return false;
}
+ // The Signal Catcher thread? That's not interesting.
+ if (thread->status == THREAD_RUNNING) {
+ return false;
+ }
+
// In some other native method? That's interesting.
// We don't just check THREAD_NATIVE because native methods will be in
// state THREAD_SUSPENDED if they're calling back into the VM, or THREAD_MONITOR
// if they're blocked on a monitor, or one of the thread-startup states if
// it's early enough in their life cycle (http://b/7432159).
const Method* currentMethod = SAVEAREA_FROM_FP(thread->interpSave.curFrame)->method;
- return dvmIsNativeMethod(currentMethod);
+ return currentMethod != NULL && dvmIsNativeMethod(currentMethod);
}
/*