This module provides stack traces. A stack trace is a sequence of frames counting from the top to the bottom of the stack.
The stack trace inlcudes one frame for each managed stack frame and one frame for each M2N frame that has an associated method. For each frame, the method and the IP are provided and, optionally, the file and line number.
The current implementation supports the following types of frames:
Native frames iteration is not currently supported. To iterate over native frames, use OS-provided tools.
Classes | |
struct | StackTraceFrame |
Functions | |
VMEXPORT unsigned | st_get_depth (VM_thread *p_vmthread) |
Gets the depth of the stack trace for the specified thread. | |
VMEXPORT bool | st_get_frame (unsigned depth, StackTraceFrame *stf) |
Fills the stack trace frame at the given relative depth for the current thread. | |
VMEXPORT StackTraceFrame * | st_alloc_frames (int num) |
Allocates memory required for the given number of stack trace frames. | |
VMEXPORT void | st_get_trace (VM_thread *p_vmthread, unsigned *depth, StackTraceFrame **stfs) |
Fills the stack trace frames for the specified number of frames of the specified thread. | |
VMEXPORT void | get_file_and_line (Method_Handle method, void *ip, bool is_ip_past, int depth, const char **file, int *line) |
Fills the given pointer to a source file and line number by using the given method and IP. | |
void | st_print_frame (ExpandableMemBlock *buf, StackTraceFrame *stf) |
Appends data about the given frame to the expandable buffer in a human-readable form. | |
void | st_print_all (FILE *f) |
Prints stack trace of all java threads. | |
void | st_print (FILE *f, hythread_t thread) |
Prints the current java thread stack trace into specified stream. | |
void | st_print () |
Prints the current java thread stack trace into the stderr stream. |
VMEXPORT unsigned st_get_depth | ( | VM_thread * | p_vmthread | ) |
Gets the depth of the stack trace for the specified thread.
The depth is the number of supported stack frames in the current thread stack, from most recently pushed to the first pushed. The depth also includes the number of inlined methods.
[in] | p_vmthread | - pointer to the thread |
VMEXPORT bool st_get_frame | ( | unsigned | depth, | |
StackTraceFrame * | stf | |||
) |
Fills the stack trace frame at the given relative depth for the current thread.
[in] | depth | - relative depth of a frame or inlined method on the stack, topmost frame has zero depth. |
[out] | stf | - the pointer to the StackTraceFrame structure that needs to be filled with the data on the frame or inlined method corresponding to the given depth |
TRUE
on success, FALSE
if the depth is greater than or equal to thecurrent thread's stack trace length. VMEXPORT StackTraceFrame* st_alloc_frames | ( | int | num | ) |
Allocates memory required for the given number of stack trace frames.
Used internaly by the interpreter to avoid memory allocation/de-allocation conflicts in the VM and DLLs on Windows / IA-32 systems.
[in] | num | - required number of stack trace frames |
VMEXPORT void st_get_trace | ( | VM_thread * | p_vmthread, | |
unsigned * | depth, | |||
StackTraceFrame ** | stfs | |||
) |
Fills the stack trace frames for the specified number of frames of the specified thread.
[in] | p_vmthread | - pointer to the thread |
[in] | depth | - the number of frames including inlined methods, information about which should be stored |
[out] | stfs | - the pointer to the array of stack trace frames created by this function and returned via this pointer. |
VMEXPORT void get_file_and_line | ( | Method_Handle | method, | |
void * | ip, | |||
bool | is_ip_past, | |||
int | depth, | |||
const char ** | file, | |||
int * | line | |||
) |
Fills the given pointer to a source file and line number by using the given method and IP.
[in] | method | - the handle of the method information to identify the source file |
[in] | ip | - the instruction pointer to identify the JIT and using the JIT line number |
[in] | depth | - the inlined depth for inlined methods; (-1) for native methods and methods which were not inlined |
[out] | file | - the pointer to the file reference to be filled by this function |
[out] | line | - the pointer to the line number to be filled by this function |
void st_print_frame | ( | ExpandableMemBlock * | buf, | |
StackTraceFrame * | stf | |||
) |
Appends data about the given frame to the expandable buffer in a human-readable form.
[in] | buf | - the pointer to ExpandableMemBlock , where data will be added |
[in] | stf | - the pointer to the stack trace frame, data from which will be printed into buffer |
void st_print_all | ( | FILE * | f | ) |
Prints stack trace of all java threads.
This function supports and prints all Java frames.
[in] | f | - the pointer to the file, where the stack trace will be printed |
void st_print | ( | FILE * | f, | |
hythread_t | thread | |||
) |
Prints the current java thread stack trace into specified stream.
This function supports and prints all Java frames.
[in] | f | - the pointer to the file, where the stack trace will be printed |
[in] | thread | - the thread wich stack should be printed |
void st_print | ( | ) |
Prints the current java thread stack trace into the stderr
stream.
Genereated on Tue Mar 11 19:25:23 2008 by Doxygen.
(c) Copyright 2005, 2008 The Apache Software Foundation or its licensors, as applicable.