1 #ifndef __BARRYJDWP_PROTOCOL_H__
2 #define __BARRYJDWP_PROTOCOL_H__
10 #define JDWP_CMDSET_VIRTUALMACHINE 1
11 #define JDWP_CMDSET_REFERECENTYPE 2
12 #define JDWP_CMDSET_CLASSTYPE 3
13 #define JDWP_CMDSET_ARRAYTYPE 4
14 #define JDWP_CMDSET_INTERFACETYPE 5
15 #define JDWP_CMDSET_METHOD 6
16 #define JDWP_CMDSET_FIELD 8
17 #define JDWP_CMDSET_OBJECTREFERENCE 9
18 #define JDWP_CMDSET_STRINGREFERENCE 10
19 #define JDWP_CMDSET_THREADREFERENCE 11
20 #define JDWP_CMDSET_THREADGROUPREFERENCE 12
21 #define JDWP_CMDSET_ARRAYREFERENCE 13
22 #define JDWP_CMDSET_CLASSLOADERREFERENCE 14
23 #define JDWP_CMDSET_EVENTREQUEST 15
24 #define JDWP_CMDSET_STACKFRAME 16
25 #define JDWP_CMDSET_CLASSOBJECTREFERENCE 17
26 #define JDWP_CMDSET_EVENT 64
28 // Command list - VirtualMachine
29 #define JDWP_CMD_VERSION 1
30 #define JDWP_CMD_ALLCLASSES 3
31 #define JDWP_CMD_ALLTHREADS 4
32 #define JDWP_CMD_DISPOSE 6
33 #define JDWP_CMD_IDSIZES 7
34 #define JDWP_CMD_SUSPEND 8
35 #define JDWP_CMD_RESUME 9
36 #define JDWP_CMD_CLASSPATHS 13
38 // Command list - EventRequest
39 #define JDWP_CMD_SET 1
42 namespace JDWP
{ namespace Protocol
{
47 struct PacketEventRequestSet
{
49 uint8_t suspendPolicy
;
51 } __attribute__ ((packed
));
54 struct PacketEventRequest
{
55 union PacketEventRequestData
{
56 PacketEventRequestSet set
;
57 } __attribute__ ((packed
)) u
;
58 } __attribute__ ((packed
));
61 struct PacketCommand
{
65 union PacketCommandData
{
66 PacketEventRequest eventRequest
;
67 } __attribute__ ((packed
)) u
;
68 } __attribute__ ((packed
));
70 #define JDWP_COMMAND_HEADER_SIZE (sizeof(Protocol::PacketCommand))
76 struct PacketVirtualMachineIDSizes
{
78 uint32_t methodIDSize
;
79 uint32_t objectIDSize
;
80 uint32_t referenceTypeIDSize
;
82 } __attribute__ ((packed
));
84 #define JDWP_PACKETVIRTUALMACHINEIDSIZES_DATA_SIZE sizeof(Protocol::PacketVirtualMachineIDSizes)
87 struct PacketVirtualMachine
{
88 union PacketVirtualMachineData
{
89 PacketVirtualMachineIDSizes IDSizes
;
90 } __attribute__ ((packed
)) u
;
91 } __attribute__ ((packed
));
94 struct PacketResponse
{
97 union PacketResponseData
{
98 PacketVirtualMachine virtualMachine
;
101 } __attribute__ ((packed
)) u
;
102 } __attribute__ ((packed
));
104 #define JDWP_RESPONSE_HEADER_SIZE (sizeof(Protocol::PacketResponse) - sizeof(Protocol::PacketResponse::PacketResponseData))
116 PacketCommand command
;
117 PacketResponse response
;
118 } __attribute__ ((packed
)) u
;
119 } __attribute__ ((packed
));
121 #define JDWP_PACKET_HEADER_SIZE (sizeof(Protocol::Packet) - sizeof(Protocol::Packet::PacketType))
124 #define MAKE_JDWPPACKET(var, data) const Protocol::Packet *var = (const Protocol::Packet *) (data).GetData()
125 #define MAKE_JDWPPACKETPTR_BUF(var, ptr) Protocol::Packet *var = (Protocol::Packet *)ptr
128 }} // namespace JDWP::Protocol