1358 // retrieve or create JvmtiThreadState. |
1358 // retrieve or create JvmtiThreadState. |
1359 JvmtiThreadState* state = JvmtiThreadState::state_for(java_thread); |
1359 JvmtiThreadState* state = JvmtiThreadState::state_for(java_thread); |
1360 if (state == NULL) { |
1360 if (state == NULL) { |
1361 return JVMTI_ERROR_THREAD_NOT_ALIVE; |
1361 return JVMTI_ERROR_THREAD_NOT_ALIVE; |
1362 } |
1362 } |
1363 uint32_t debug_bits = 0; |
1363 |
1364 if (is_thread_fully_suspended(java_thread, true, &debug_bits)) { |
1364 // It is only safe to perform the direct operation on the current |
|
1365 // thread. All other usage needs to use a vm-safepoint-op for safety. |
|
1366 if (java_thread == JavaThread::current()) { |
1365 err = get_frame_count(state, count_ptr); |
1367 err = get_frame_count(state, count_ptr); |
1366 } else { |
1368 } else { |
1367 // get java stack frame count at safepoint. |
1369 // get java stack frame count at safepoint. |
1368 VM_GetFrameCount op(this, state, count_ptr); |
1370 VM_GetFrameCount op(this, state, count_ptr); |
1369 VMThread::execute(&op); |
1371 VMThread::execute(&op); |
1474 // method_ptr - pre-checked for NULL |
1476 // method_ptr - pre-checked for NULL |
1475 // location_ptr - pre-checked for NULL |
1477 // location_ptr - pre-checked for NULL |
1476 jvmtiError |
1478 jvmtiError |
1477 JvmtiEnv::GetFrameLocation(JavaThread* java_thread, jint depth, jmethodID* method_ptr, jlocation* location_ptr) { |
1479 JvmtiEnv::GetFrameLocation(JavaThread* java_thread, jint depth, jmethodID* method_ptr, jlocation* location_ptr) { |
1478 jvmtiError err = JVMTI_ERROR_NONE; |
1480 jvmtiError err = JVMTI_ERROR_NONE; |
1479 uint32_t debug_bits = 0; |
1481 |
1480 |
1482 // It is only safe to perform the direct operation on the current |
1481 if (is_thread_fully_suspended(java_thread, true, &debug_bits)) { |
1483 // thread. All other usage needs to use a vm-safepoint-op for safety. |
|
1484 if (java_thread == JavaThread::current()) { |
1482 err = get_frame_location(java_thread, depth, method_ptr, location_ptr); |
1485 err = get_frame_location(java_thread, depth, method_ptr, location_ptr); |
1483 } else { |
1486 } else { |
1484 // JVMTI get java stack frame location at safepoint. |
1487 // JVMTI get java stack frame location at safepoint. |
1485 VM_GetFrameLocation op(this, java_thread, depth, method_ptr, location_ptr); |
1488 VM_GetFrameLocation op(this, java_thread, depth, method_ptr, location_ptr); |
1486 VMThread::execute(&op); |
1489 VMThread::execute(&op); |