Introduced:
The previous article explained how the agent uses the environment pointers to access the VM's thread group operations, where the stack operation is discussed.
Category 4: Stack operations
A. getstacktrace. Gets the stack for a thread.
Jvmtierrorgetstacktrace (jvmtienv* env, Jthread thread, Jint start_depth, Jint Max_frame_c Ount, jvmtiframeinfo* Frame_buffer, jint* count_ptr)
The Enter parameter thread represents the thread to be parsed, or the current thread if the value is not set. Start_depth represents the starting depth to parse, and 0 indicates that the current frame,1 represents the caller's frame,2 representing the caller's frame. Max_frame_count represents the maximum frame count. The return frame_buffer contains a huge stack of desired information.
B.getallstacktraces. Gets the stack information for all the live threads.
Jvmtierrorgetallstacktraces (jvmtienv* env, Jint Max_frame_count, jvmtistackinfo** stack_info_ptr, jint* thread_count_ptr)
The stack information array for all alive threads is placed in the return value stack_info_ptr.
C.getthreadliststacktraces. Gets the stack information for the given list of threads.
Jvmtierrorgetthreadliststacktraces (jvmtienv* env, Jint thread_count, const jthread* thread_list, Jint Max_frame_count, jvmtistackinfo** stack_info_ptr)
D.getframecount. Gets the current number of frames in the call stack for a given thread.
Jvmtierrorgetframecount (jvmtienv* env, Jthread thread, jint* count_ptr)
E.popframe. pops up the topmost frame of the given thread stack.
Jvmtierrorpopframe (jvmtienv* env, Jthread thread)
This time
(1) The current frame will be discarded and the previous frame will be the current frame.
(2) The stack of the operator (operand) is restored.
(3) The operation code (opcode) reverts to the previous call instruction.
F.getframelocation. Returns the position of the currently executing instruction frame.
Jvmtierrorgetframelocation (jvmtienv* env, jthread thread, jint depth, jmethodid* method_p TR, jlocation* Location_ptr)
As can be seen from the return, this return position contains the depth, method pointer, and position pointer.
G.notifyframepop. When a frame pops out of the stack, a Framepop event is generated.
Jvmtierrornotifyframepop (jvmtienv* env, jthread thread, jint depth)
This article is from the "cohesion of parallel Lines" blog, please be sure to keep this source http://supercharles888.blog.51cto.com/609344/1587697
JPDA Architecture Research 8-agent using environment pointers to access VMS (Stack management chapter)