📄 jvmdi.h
字号:
typedef struct { jthread thread; jclass clazz; jmethodID method; jlocation location; jobject exception; } JVMDI_exception_catch_event_data; /* kind = JVMDI_EVENT_USER_DEFINED */ typedef struct { jobject object; jint key; } JVMDI_user_event_data; /* kind = JVMDI_EVENT_THREAD_END or */ /* JVMDI_EVENT_THREAD_START */ typedef struct { jthread thread; } JVMDI_thread_change_event_data; /* kind = JVMDI_EVENT_CLASS_LOAD, */ /* JVMDI_EVENT_CLASS_UNLOAD, or */ /* JVMDI_EVENT_CLASS_PREPARE */ typedef struct { jthread thread; jclass clazz; } JVMDI_class_event_data; /* This stucture passes information about the event. * location is the index of the last instruction executed. */typedef struct { jint kind; /* the discriminant */ union { /* kind = JVMDI_EVENT_SINGLE_STEP */ JVMDI_single_step_event_data single_step; /* kind = JVMDI_EVENT_BREAKPOINT */ JVMDI_breakpoint_event_data breakpoint; /* kind = JVMDI_EVENT_FRAME_POP */ /* kind = JVMDI_EVENT_METHOD_ENTRY */ /* kind = JVMDI_EVENT_METHOD_EXIT */ JVMDI_frame_event_data frame; /* kind = JVMDI_EVENT_FIELD_ACCESS */ JVMDI_field_access_event_data field_access; /* kind = JVMDI_EVENT_FIELD_MODIFICATION */ JVMDI_field_modification_event_data field_modification; /* kind = JVMDI_EVENT_EXCEPTION */ JVMDI_exception_event_data exception; /* kind = JVMDI_EVENT_EXCEPTION_CATCH */ JVMDI_exception_catch_event_data exception_catch; /* kind = JVMDI_EVENT_USER_DEFINED */ JVMDI_user_event_data user; /* kind = JVMDI_EVENT_THREAD_END or */ /* JVMDI_EVENT_THREAD_START */ JVMDI_thread_change_event_data thread_change; /* kind = JVMDI_EVENT_CLASS_LOAD, */ /* JVMDI_EVENT_CLASS_UNLOAD, or */ /* JVMDI_EVENT_CLASS_PREPARE */ JVMDI_class_event_data class_event; /* kind = JVMDI_EVENT_VM_DEATH, JVMDI_EVENT_VM_INIT */ /* no additional fields */ } u;} JVMDI_Event; /*** event kinds ***/#define JVMDI_EVENT_SINGLE_STEP ((jint)1)#define JVMDI_EVENT_BREAKPOINT ((jint)2)#define JVMDI_EVENT_FRAME_POP ((jint)3)#define JVMDI_EVENT_EXCEPTION ((jint)4)#define JVMDI_EVENT_USER_DEFINED ((jint)5)#define JVMDI_EVENT_THREAD_START ((jint)6)#define JVMDI_EVENT_THREAD_END ((jint)7)#define JVMDI_EVENT_CLASS_PREPARE ((jint)8)#define JVMDI_EVENT_CLASS_UNLOAD ((jint)9)#define JVMDI_EVENT_CLASS_LOAD ((jint)10)#define JVMDI_EVENT_FIELD_ACCESS ((jint)20)#define JVMDI_EVENT_FIELD_MODIFICATION ((jint)21)#define JVMDI_EVENT_EXCEPTION_CATCH ((jint)30)#define JVMDI_EVENT_METHOD_ENTRY ((jint)40)#define JVMDI_EVENT_METHOD_EXIT ((jint)41)#define JVMDI_EVENT_VM_INIT ((jint)90)#define JVMDI_EVENT_VM_DEATH ((jint)99)#define JVMDI_MAX_EVENT_TYPE_VAL ((jint)99)/* event handler hook */typedef void (*JVMDI_EventHook)(JNIEnv *env, JVMDI_Event *event);typedef jvmdiError (*JVMDI_AllocHook) (jlong size, jbyte** memPtr);typedef jvmdiError (*JVMDI_DeallocHook) (jbyte* buffer);/* * Class states used in JVMDI_GetClassStatus */#define JVMDI_CLASS_STATUS_VERIFIED ((jint)0x01)#define JVMDI_CLASS_STATUS_PREPARED ((jint)0x02)#define JVMDI_CLASS_STATUS_INITIALIZED ((jint)0x04) /* Error prevents initialization */#define JVMDI_CLASS_STATUS_ERROR ((jint)0x08) /* structure for returning line number information */typedef struct { jlocation start_location; jint line_number;} JVMDI_line_number_entry;/* structure for returning local variable information */typedef struct { jlocation start_location; /* variable valid start_location */ jint length; /* upto start_location+length */ char *name; /* name in UTF8 */ char *signature; /* type signature in UTF8 */ jint slot; /* variable slot, see JVMDI_GetLocal*() */} JVMDI_local_variable_entry;/* structure for returning exception handler information */typedef struct { jlocation start_location; jlocation end_location; jlocation handler_location; jclass exception; /* if null, all exceptions */} JVMDI_exception_handler_entry;#define JVMDI_OPERAND_TYPE_REFERENCE ((jint)1)#define JVMDI_OPERAND_TYPE_INT ((jint)2)#define JVMDI_OPERAND_TYPE_FLOAT ((jint)3)#define JVMDI_OPERAND_TYPE_LONG0 ((jint)4) /* least sig. 32 bits */#define JVMDI_OPERAND_TYPE_LONG1 ((jint)5) /* most sig. 32 bits */#define JVMDI_OPERAND_TYPE_DOUBLE0 ((jint)6) /* least sig. 32 bits */#define JVMDI_OPERAND_TYPE_DOUBLE1 ((jint)7) /* most sig. 32 bits */#define JVMDI_OPERAND_TYPE_RETURN_ADDRESS ((jint)8)typedef struct { jint word; /* 32 bit operand stack quantities */ jint type; /* type encoding of the operand word */ /* one of JVMDI_OPERAND_TYPE_* */} JVMDI_operand_stack_element;typedef struct { jint instance_field_count; /* number of instance fields referencing obj */ struct JVMDI_instance_field { jobject instance; /* instance referencing obj */ jfieldID field; /* field holding reference */ } *instance_fields; /* instanceField_count of them */ jint static_field_count; /* number of static fields referencing obj */ struct JVMDI_static_field { jclass clazz; /* class referencing obj */ jfieldID static_field; /* field holding reference */ } *static_fields; /* static_field_count of them */ jint array_element_count; /* number of array elements referencing obj */ struct JVMDI_array_element { jobjectArray array; /* array referencing obj */ jint index; /* index holding reference */ } *array_elements; /* array_element_count of them */ jint frame_slot_count; /* number of frame slots referencing obj */ struct JVMDI_frame_slot { jthread thread; /* thread of the frame */ jframeID frame; /* frame referencing obj */ jint slot; /* slot holding reference */ } *frame_slots; /* frame_slot_count of them */} JVMDI_object_reference_info;/* structure for defining a class*/typedef struct { jclass clazz; /* Class object for this class */ jint class_byte_count; /* number of bytes defining class (below) */ jbyte *class_bytes; /* bytes defining class (in JVM spec */ /* Class File Format) */} JVMDI_class_definition; /* For backwards compatibility */#define can_change_schema can_unrestrictedly_redefine_classestypedef struct { unsigned int can_watch_field_modification : 1; unsigned int can_watch_field_access : 1; unsigned int can_get_bytecodes : 1; unsigned int can_get_synthetic_attribute : 1; unsigned int can_get_owned_monitor_info : 1; unsigned int can_get_current_contended_monitor : 1; unsigned int can_get_monitor_info : 1; unsigned int can_get_heap_info : 1; unsigned int can_get_operand_stack : 1; unsigned int can_set_operand_stack : 1; unsigned int can_pop_frame : 1; unsigned int can_get_class_definition : 1; unsigned int can_redefine_classes : 1; unsigned int can_add_method : 1; unsigned int can_unrestrictedly_redefine_classes : 1; unsigned int can_suspend_resume_thread_lists : 1;} JVMDI_capabilities;typedef struct JVMDI_Interface_1_ { jvmdiError (JNICALL *SetEventHook) (JVMDI_EventHook hook); jvmdiError (JNICALL *SetEventNotificationMode) (jint mode, jint eventType, jthread thread, ...); jvmdiError (JNICALL *GetThreadStatus) (jthread thread, jint *threadStatusPtr, jint *suspendStatusPtr); jvmdiError (JNICALL *GetAllThreads) (jint *threadsCountPtr, jthread **threadsPtr); jvmdiError (JNICALL *SuspendThread) (jthread thread); jvmdiError (JNICALL *ResumeThread) (jthread thread); jvmdiError (JNICALL *StopThread) (jthread thread, jobject exception); jvmdiError (JNICALL *InterruptThread) (jthread thread); jvmdiError (JNICALL *GetThreadInfo) (jthread thread, JVMDI_thread_info *infoPtr); jvmdiError (JNICALL *GetOwnedMonitorInfo) (jthread thread, JVMDI_owned_monitor_info *infoPtr); jvmdiError (JNICALL *GetCurrentContendedMonitor) (jthread thread, jobject *monitor); jvmdiError (JNICALL *RunDebugThread) (jthread thread, JVMDI_StartFunction proc, void *arg, int priority); jvmdiError (JNICALL *GetTopThreadGroups) (jint *groupCountPtr, jthreadGroup **groupsPtr); jvmdiError (JNICALL *GetThreadGroupInfo) (jthreadGroup group, JVMDI_thread_group_info *infoPtr); jvmdiError (JNICALL *GetThreadGroupChildren) (jthreadGroup group, jint *threadCountPtr, jthread **threadsPtr, jint *groupCountPtr, jthreadGroup **groupsPtr); jvmdiError (JNICALL *GetFrameCount) (jthread thread, jint *countPtr); jvmdiError (JNICALL *GetCurrentFrame) (jthread thread, jframeID *framePtr); jvmdiError (JNICALL *GetCallerFrame) (jframeID called, jframeID *framePtr); jvmdiError (JNICALL *GetFrameLocation) (jframeID frame, jclass *classPtr, jmethodID *methodPtr, jlocation *locationPtr); jvmdiError (JNICALL *NotifyFramePop) (jframeID frame); jvmdiError (JNICALL *GetLocalObject) (jframeID frame, jint slot, jobject *valuePtr); jvmdiError (JNICALL *GetLocalInt) (jframeID frame, jint slot, jint *valuePtr); jvmdiError (JNICALL *GetLocalLong) (jframeID frame, jint slot, jlong *valuePtr); jvmdiError (JNICALL *GetLocalFloat) (jframeID frame, jint slot, jfloat *valuePtr); jvmdiError (JNICALL *GetLocalDouble) (jframeID frame, jint slot, jdouble *valuePtr); jvmdiError (JNICALL *SetLocalObject) (jframeID frame, jint slot, jobject value); jvmdiError (JNICALL *SetLocalInt) (jframeID frame, jint slot, jint value); jvmdiError (JNICALL *SetLocalLong) (jframeID frame, jint slot, jlong value); jvmdiError (JNICALL *SetLocalFloat) (jframeID frame, jint slot, jfloat value); jvmdiError (JNICALL *SetLocalDouble) (jframeID frame, jint slot, jdouble value); jvmdiError (JNICALL *CreateRawMonitor) (char *name, JVMDI_RawMonitor *monitorPtr); jvmdiError (JNICALL *DestroyRawMonitor) (JVMDI_RawMonitor monitor); jvmdiError (JNICALL *RawMonitorEnter) (JVMDI_RawMonitor monitor); jvmdiError (JNICALL *RawMonitorExit) (JVMDI_RawMonitor monitor); jvmdiError (JNICALL *RawMonitorWait) (JVMDI_RawMonitor monitor, jlong millis); jvmdiError (JNICALL *RawMonitorNotify) (JVMDI_RawMonitor monitor); jvmdiError (JNICALL *RawMonitorNotifyAll) (JVMDI_RawMonitor monitor); jvmdiError (JNICALL *SetBreakpoint) (jclass clazz, jmethodID method, jlocation location); jvmdiError (JNICALL *ClearBreakpoint) (jclass clazz, jmethodID method, jlocation location); jvmdiError (JNICALL *ClearAllBreakpoints) (); jvmdiError (JNICALL *SetFieldAccessWatch) (jclass clazz, jfieldID field); jvmdiError (JNICALL *ClearFieldAccessWatch) (jclass clazz, jfieldID field); jvmdiError (JNICALL *SetFieldModificationWatch) (jclass clazz, jfieldID field); jvmdiError (JNICALL *ClearFieldModificationWatch) (jclass clazz, jfieldID field); jvmdiError (JNICALL *SetAllocationHooks) (JVMDI_AllocHook ahook, JVMDI_DeallocHook dhook); jvmdiError (JNICALL *Allocate) (jlong size, jbyte** memPtr); jvmdiError (JNICALL *Deallocate) (jbyte* mem); jvmdiError (JNICALL *GetClassSignature) (jclass clazz, char **sigPtr); jvmdiError (JNICALL *GetClassStatus) (jclass clazz, jint *statusPtr); jvmdiError (JNICALL *GetSourceFileName) (jclass clazz, char **sourceNamePtr); jvmdiError (JNICALL *GetClassModifiers) (jclass clazz, jint *modifiersPtr); jvmdiError (JNICALL *GetClassMethods) (jclass clazz, jint *methodCountPtr, jmethodID **methodsPtr); jvmdiError (JNICALL *GetClassFields) (jclass clazz, jint *fieldCountPtr, jfieldID **fieldsPtr); jvmdiError (JNICALL *GetImplementedInterfaces) (jclass clazz, jint *interfaceCountPtr, jclass **interfacesPtr); jvmdiError (JNICALL *IsInterface) (jclass clazz, jboolean *isInterfacePtr); jvmdiError (JNICALL *IsArrayClass)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -