📄 debugger.h
字号:
#define JDWP_Tag_CHAR 67
#define JDWP_Tag_OBJECT 76
#define JDWP_Tag_FLOAT 70
#define JDWP_Tag_DOUBLE 68
#define JDWP_Tag_INT 73
#define JDWP_Tag_LONG 74
#define JDWP_Tag_SHORT 83
#define JDWP_Tag_VOID 86
#define JDWP_Tag_BOOLEAN 90
#define JDWP_Tag_STRING 115
#define JDWP_Tag_THREAD 116
#define JDWP_Tag_THREAD_GROUP 103
#define JDWP_Tag_CLASS_LOADER 108
#define JDWP_Tag_CLASS_OBJECT 99
#define JDWP_StepDepth_INTO 0
#define JDWP_StepDepth_OVER 1
#define JDWP_StepDepth_OUT 2
#define JDWP_StepSize_MIN 0
#define JDWP_StepSize_LINE 1
#define JDWP_SuspendPolicy_NONE 0
#define JDWP_SuspendPolicy_EVENT_THREAD 1
#define JDWP_SuspendPolicy_ALL 2
#define JDWP_InvokeOptions_INVOKE_SINGLE_THREADED 0x01
#define JDWP_InvokeOptions_INVOKE_NONVIRTUAL 0x02
#define KVM_CMDSET 128
#define KVM_HANDSHAKE_COMMAND 1
#define KVM_GETSTEPPINGINFO_COMMAND 2
#define KVM_STEPPING_EVENT_COMMAND 3
/*
* Misc control structures used by the debugger code
*/
#define SYS_OK 0
#define SYS_ERR -1
/*-------------------------------*/
struct location_mod {
unsigned long classID;
unsigned long methodIndex;
unsigned long offset;
unsigned long dupCurrentLineOffs;
unsigned long postDupLineOffs;
ByteCode opcode;
BYTE tag;
};
struct exception_mod {
unsigned long classID;
bool_t sig_caught;
bool_t sig_uncaught;
};
struct singleStep_mod {
unsigned long threadID;
long size, depth;
unsigned long startingOffset;
FRAME fp;
struct location_mod target;
};
struct classMatch {
char *className;
};
struct Modifiers {
struct Modifiers *next;
struct Modifiers *freeNext;
BYTE kind;
union {
unsigned long threadID;
struct location_mod loc;
struct exception_mod exp;
struct singleStep_mod step;
struct classMatch classMatch;
unsigned long classID;
} u;
bool_t inUse;
};
struct CE_Modifiers {
struct CE_Modifiers *next;
struct CE_Modifiers *nextEvent;
BYTE eventKind;
unsigned long threadID;
struct location_mod loc;
struct exception_mod exp;
struct singleStep_mod step;
bool_t inUse;
};
struct VmEvent {
struct VmEvent *next; /* next event */
struct VmEvent *sendNext; /* next event being sent */
BYTE kind;
BYTE suspendPolicy;
bool_t active;
long numModifiers;
struct Modifiers *mods;
bool_t count_active;
long count;
bool_t inUse;
};
#define SIZEOF_MODIFIERS StructSizeInCells(Modifiers)
#define SIZEOF_CEMODIFIERS StructSizeInCells(Modifiers)
#define SIZEOF_VMEVENT StructSizeInCells(VmEvent)
#define OBJECT_ROOT_SIZE 16
typedef struct VmEvent VMEvent, *VMEventPtr;
typedef struct Modifiers *EVENTMODIFIER;
typedef struct CE_Modifiers *CEModPtr;
#define MIN(x, y) ((x) < (y) ? (x) : (y))
#define MAX_INPUT_PACKET_SIZE 300
#define DEBUG_MAX_CLASSNAME 256
#define DEBUG_MAX_SIG 64
/* Must match what's in the debug agent */
#define ONLY_THREADGROUP_ID 0xFFFFFFE0
#define Dbg_EventKind_NONE 0x00000
#define Dbg_EventKind_ANY 0xFFFFF
#define Dbg_EventKind_VM_DISCONNECTED 0x40000
#define Dbg_EventKind_METHOD_EXIT 0x02000
#define Dbg_EventKind_EXCEPTION_CATCH 0x08000
#define Dbg_EventKind_USER_DEFINED 0x00010
#define Dbg_EventKind_METHOD_ENTRY 0x01000
#define Dbg_EventKind_VM_DEATH 0x20000
#define Dbg_EventKind_CLASS_UNLOAD 0x00100
#define Dbg_EventKind_CLASS_PREPARE 0x00080
#define Dbg_EventKind_SINGLE_STEP 0x00001
#define Dbg_EventKind_FIELD_MODIFICATION 0x04000
#define Dbg_EventKind_CLASS_LOAD 0x00200
#define Dbg_EventKind_THREAD_START 0x00040
#define Dbg_EventKind_FRAME_POP 0x00004
#define Dbg_EventKind_VM_INIT 0x10000
#define Dbg_EventKind_BREAKPOINT 0x00002
#define Dbg_EventKind_THREAD_END 0x00020
#define Dbg_EventKind_FIELD_ACCESS 0x00800
#define Dbg_EventKind_EXCEPTION 0x00008
#define Dbg_EventKind_VM_START Dbg_EventKind_VM_INIT
#define Dbg_EventKind_THREAD_DEATH Dbg_EventKind_THREAD_END
extern long debuggerNotifyList;
#define NOTIFY_WANTED(x) ( ( debuggerNotifyList & (x) ) == (x) )
#define checkNOTIFY_WANTED(x) if ( !NOTIFY_WANTED(x) ) return;
extern bool_t suspend; /* Suspend all threads on VM startup. */
extern bool_t vmDebugReady;
extern bool_t debuggerActive;
extern short debuggerPort;
typedef struct Debugger_ID_Hash_Entry {
struct Debugger_ID_Hash_Entry *next;
unsigned long key;
unsigned long rootIndex;
} *ID_HASH_ENTRY;
#define DEBUGGER_HASH_SIZE 32
#define SIZEOF_ID_HASH_ENTRY StructSizeInCells(Debugger_ID_Hash_Entry)
extern unsigned long uniqueDebuggerID;
#define DEBUGGER_ID_MASK 0x3FFFF
#define DEBUGGER_ID_SHIFT 14
#define DEBUGGER_INDEX_SHIFT 1
#define DEBUGGER_INDEX_MASK 0x1FFF
#define NEXT_UNIQUE_DEBUGGER_ID() ((uniqueDebuggerID++ & DEBUGGER_ID_MASK) << DEBUGGER_ID_SHIFT)
#define GET_OBJECT_DEBUGGERID(x) (inCurrentHeap(x) ? (getObjectID(x)) : (unsigned long)x)
/* Classes are always in permanent heap, so we can simplify */
#define GET_CLASS_DEBUGGERID(x) ((unsigned long)x)
#define GET_DEBUGGERID_CLASS(x) ((CLASS)x)
#define DEFAULT_DEBUGGER_PORT 2800
bool_t InitDebugger(void);
void CloseDebugger();
bool_t GetDebugger(int timeout);
void ProcessDebugCmds(int timeout);
void processBreakCommands(void);
ByteCode getBreakpointOpcode( VMEventPtr *, struct Modifiers ** );
void handleBreakpoint( THREAD thread );
int handleSingleStep(THREAD thread, THREAD *);
CEModPtr GetCEModifier();
void FreeCEModifier(CEModPtr);
ByteCode getVerifierBreakpointOpcode(METHOD, unsigned short);
int getJDWPClassStatus( INSTANCE_CLASS clazz );
bool_t verifyThread( THREAD thread );
void checkDebugEvent(THREAD);
void insertDebugEvent(CEModPtr);
void replaceEventOpcode(ByteCode);
void clearAllBreakpoints(void);
void sendAllClassPrepares(void);
void setEvent_VMInit( void );
void setEvent_VMDeath( void );
void setEvent_SingleStep(CEModPtr, THREAD);
void setEvent_Breakpoint(VMEventPtr ep, CEModPtr );
void setEvent_MethodEntry( void );
void setEvent_MethodExit( void );
void setEvent_Exception(INSTANCE, FRAME, BYTE *, METHOD, unsigned long, CEModPtr );
void setEvent_ExceptionCatch();
void setEvent_ThreadStart( CEModPtr );
void setEvent_ThreadDeath( CEModPtr );
void setEvent_ClassPrepare( CEModPtr );
void setEvent_ClassLoad( CEModPtr );
void setEvent_ClassUnload( CEModPtr );
void setEvent_FieldAccess( void );
void setEvent_FieldModification( void );
void setEvent_FramePop( void );
unsigned long getObjectID(OBJECT);
OBJECT getObjectPtr(unsigned long);
bool_t InitDebuggerIO(void);
void CloseDebuggerIO();
bool_t GetDebuggerChannel(int timeout);
bool_t dbgCharAvail(int timeout);
int dbgWrite(void *buf, int len);
int dbgAsyncWrite(void *buf, int len);
int dbgStdOutWrite(void *buf, int len);
int dbgRead(void *buf, int len, int flag);
int dbgReceivePacket(PACKET_INPUT_STREAM_HANDLE);
int dbgSendPacket(struct Packet *);
bool_t dbgInitialized(void);
void dbgFlush(void);
#endif /* __DEBUGGER_H__ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -