diff options
author | Johnnie Birch <johnnie.l.birch.jr@intel.com> | 2014-05-15 11:31:14 -0700 |
---|---|---|
committer | Johnnie Birch <johnnie.l.birch.jr@intel.com> | 2014-05-22 11:33:21 -0700 |
commit | 14e81447ebaa1d80aae0c53312d4ff238d3fd98a (patch) | |
tree | 9b3651a64e67f64055d351579e83a1a2794978ff /runtime/native | |
parent | 3ba5511665ffd31cc766fe7774a94eb18696a845 (diff) | |
download | art-14e81447ebaa1d80aae0c53312d4ff238d3fd98a.zip art-14e81447ebaa1d80aae0c53312d4ff238d3fd98a.tar.gz art-14e81447ebaa1d80aae0c53312d4ff238d3fd98a.tar.bz2 |
Add a check for null thread before trying to suspend
The patch fixes a jpda test failure due to a failed
assertion in SuspendThreadByThreadId. There should be
a check for a null thread before the assertion check.
This was the behavior of previous code (4.4.2) where
this test passes, but this check was removed during
some refactoring of the code.
Change-Id: Ia63de5f159ce1e51110bf9dc604011d07b2f048e
Signed-off-by: Johnnie Birch <johnnie.l.birch.jr@intel.com>
Diffstat (limited to 'runtime/native')
-rw-r--r-- | runtime/native/org_apache_harmony_dalvik_ddmc_DdmVmInternal.cc | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/runtime/native/org_apache_harmony_dalvik_ddmc_DdmVmInternal.cc b/runtime/native/org_apache_harmony_dalvik_ddmc_DdmVmInternal.cc index 5d90f1a..e17e60a 100644 --- a/runtime/native/org_apache_harmony_dalvik_ddmc_DdmVmInternal.cc +++ b/runtime/native/org_apache_harmony_dalvik_ddmc_DdmVmInternal.cc @@ -52,9 +52,15 @@ static jobjectArray DdmVmInternal_getStackTraceById(JNIEnv* env, jclass, jint th jobject internal_trace = self->CreateInternalStackTrace<false>(soa); trace = Thread::InternalStackTraceToStackTraceElementArray(soa, internal_trace); } else { - // Suspend thread to build stack trace. ThreadList* thread_list = Runtime::Current()->GetThreadList(); bool timed_out; + + // Check for valid thread + if (thin_lock_id == ThreadList::kInvalidThreadId) { + return nullptr; + } + + // Suspend thread to build stack trace. Thread* thread = thread_list->SuspendThreadByThreadId(thin_lock_id, false, &timed_out); if (thread != nullptr) { { |