Mercurial > hg > truffle
comparison src/share/vm/prims/jvmtiEnvBase.cpp @ 609:ea20d7ce26b0
6800721: 3/4 JavaThread::jvmti_thread_state() and JvmtiThreadState::state_for() robustness
Summary: Check for NULL return values from jvmti_thread_state() and state_for() and return a JVM TI error code as appropriate.
Reviewed-by: coleenp, swamyv
author | dcubed |
---|---|
date | Mon, 02 Mar 2009 14:00:23 -0700 |
parents | ad8c8ca4ab0f |
children | 2f716c0acb64 |
comparison
equal
deleted
inserted
replaced
608:0386097d43d8 | 609:ea20d7ce26b0 |
---|---|
1320 JvmtiEnvBase::force_early_return(JavaThread* java_thread, jvalue value, TosState tos) { | 1320 JvmtiEnvBase::force_early_return(JavaThread* java_thread, jvalue value, TosState tos) { |
1321 JavaThread* current_thread = JavaThread::current(); | 1321 JavaThread* current_thread = JavaThread::current(); |
1322 HandleMark hm(current_thread); | 1322 HandleMark hm(current_thread); |
1323 uint32_t debug_bits = 0; | 1323 uint32_t debug_bits = 0; |
1324 | 1324 |
1325 // retrieve or create the state | |
1326 JvmtiThreadState* state = JvmtiThreadState::state_for(java_thread); | |
1327 if (state == NULL) { | |
1328 return JVMTI_ERROR_THREAD_NOT_ALIVE; | |
1329 } | |
1330 | |
1325 // Check if java_thread is fully suspended | 1331 // Check if java_thread is fully suspended |
1326 if (!is_thread_fully_suspended(java_thread, | 1332 if (!is_thread_fully_suspended(java_thread, |
1327 true /* wait for suspend completion */, | 1333 true /* wait for suspend completion */, |
1328 &debug_bits)) { | 1334 &debug_bits)) { |
1329 return JVMTI_ERROR_THREAD_NOT_SUSPENDED; | 1335 return JVMTI_ERROR_THREAD_NOT_SUSPENDED; |
1330 } | 1336 } |
1331 | |
1332 // retreive or create the state | |
1333 JvmtiThreadState* state = JvmtiThreadState::state_for(java_thread); | |
1334 | 1337 |
1335 // Check to see if a ForceEarlyReturn was already in progress | 1338 // Check to see if a ForceEarlyReturn was already in progress |
1336 if (state->is_earlyret_pending()) { | 1339 if (state->is_earlyret_pending()) { |
1337 // Probably possible for JVMTI clients to trigger this, but the | 1340 // Probably possible for JVMTI clients to trigger this, but the |
1338 // JPDA backend shouldn't allow this to happen | 1341 // JPDA backend shouldn't allow this to happen |