hotspot/src/share/vm/prims/jvmtiEnv.cpp
// Threads_lock NOT held, java_thread not protected by lock
// java_thread - pre-checked
// max_frame_count - pre-checked to be greater than or equal to 0
// frame_buffer - pre-checked for NULL
// count_ptr - pre-checked for NULL
jvmtiError
JvmtiEnv::GetStackTrace(JavaThread* java_thread, jint start_depth, jint max_frame_count, jvmtiFrameInfo* frame_buffer, jint* count_ptr) {
{- -------------------------------------------
(1) (変数宣言など)
---------------------------------------- -}
jvmtiError err = JVMTI_ERROR_NONE;
uint32_t debug_bits = 0;
{- -------------------------------------------
(1) java_thread 引数で指定されたスレッドのスタックトレース情報を取得する.
取得方法は以下の2通り.
* 対象のスレッドがサスペンドしている場合:
JvmtiEnvBase::get_stack_trace() で取得.
* 対象のスレッドがサスペンドしていない場合:
VM_GetStackTrace で取得.
---------------------------------------- -}
if (is_thread_fully_suspended(java_thread, true, &debug_bits)) {
err = get_stack_trace(java_thread, start_depth, max_frame_count, frame_buffer, count_ptr);
} else {
// JVMTI get stack trace at safepoint. Do not require target thread to
// be suspended.
VM_GetStackTrace op(this, java_thread, start_depth, max_frame_count, frame_buffer, count_ptr);
VMThread::execute(&op);
err = op.result();
}
{- -------------------------------------------
(1) リターン
---------------------------------------- -}
return err;
} /* end GetStackTrace */
This document is available under the GNU GENERAL PUBLIC LICENSE Version 2.