dbgproto.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827
  1. /*++
  2. Copyright (c) 2012 Minoca Corp. All Rights Reserved
  3. Module Name:
  4. dbgproto.h
  5. Abstract:
  6. This header contains definitions for the kernel debugging protocol. It is
  7. used by both the debugger and the target.
  8. Author:
  9. Evan Green 3-Jul-2012
  10. --*/
  11. //
  12. // --------------------------------------------------------------------- Macros
  13. //
  14. //
  15. // ---------------------------------------------------------------- Definitions
  16. //
  17. //
  18. // Define the debugger protocol version.
  19. //
  20. #define DEBUG_PROTOCOL_MAJOR_VERSION 1
  21. #define DEBUG_PROTOCOL_REVISION 3
  22. //
  23. // Define some size limits.
  24. //
  25. #define BREAK_NOTIFICATION_STREAM_SIZE 16
  26. //
  27. // Define machine types.
  28. //
  29. #define MACHINE_TYPE_X86 0x1
  30. #define MACHINE_TYPE_ARM 0x2
  31. //
  32. // Define the maximum size of a debug packet, including the header.
  33. //
  34. #define DEBUG_PACKET_SIZE 1500
  35. //
  36. // Define the maximum size of the debug payload.
  37. //
  38. #define DEBUG_PAYLOAD_SIZE (DEBUG_PACKET_SIZE - sizeof(DEBUG_PACKET_HEADER))
  39. //
  40. // Define the magic value that signifies the beginning of a packet.
  41. //
  42. #define DEBUG_PACKET_MAGIC_BYTE1 0x45
  43. #define DEBUG_PACKET_MAGIC_BYTE2 0x47
  44. #define DEBUG_PACKET_MAGIC \
  45. ((DEBUG_PACKET_MAGIC_BYTE2 << 8) | DEBUG_PACKET_MAGIC_BYTE1)
  46. //
  47. // Define the size of the magic field, in bytes.
  48. //
  49. #define DEBUG_PACKET_MAGIC_SIZE 2
  50. //
  51. // Define two single-byte resynchronization constants, one that is sent by the
  52. // host, and one that is sent by the target. Them being different prevents
  53. // false positives from a loopback device.
  54. //
  55. #define DEBUG_SYNCHRONIZE_HOST 0x3F
  56. #define DEBUG_SYNCHRONIZE_TARGET 0x21
  57. //
  58. // Define the escaped characters.
  59. //
  60. #define DEBUG_ESCAPE 'X'
  61. #define DEBUG_XON 0x11
  62. #define DEBUG_XOFF 0x13
  63. //
  64. // ------------------------------------------------------ Data Type Definitions
  65. //
  66. typedef enum _DEBUG_REBOOT_TYPE {
  67. DebugRebootInvalid,
  68. DebugRebootShutdown,
  69. DebugRebootWarm,
  70. DebugRebootCold,
  71. DebugRebootTypeCount
  72. } DEBUG_REBOOT_TYPE, *PDEBUG_REBOOT_TYPE;
  73. /*++
  74. Structure Description:
  75. This structure defines what a debug packet header looks like being sent
  76. across the wire. It is assumed values are being sent in little endian order.
  77. Members:
  78. Magic - Stores a magic value that signifies the start of a packet. This
  79. field is used to get the host and target in sync.
  80. Command - Stores the definition for the contents of the payload. This could
  81. either be a command from the debugger or a response from the debuggee.
  82. Checksum - Stores the checksum of the entire packet, including the packet
  83. header and the payload. The only field not checksummed is the checksum
  84. field itself, which is taken to be zero.
  85. PayloadSize - Stores the size of the rest of the packet, which follows
  86. immediately after this field.
  87. PayloadSizeComplement - Stores the one's complement of the payload size,
  88. for header validation.
  89. Padding - Stores padding to align the structure.
  90. --*/
  91. typedef struct _DEBUG_PACKET_HEADER {
  92. USHORT Magic;
  93. USHORT Command;
  94. USHORT Checksum;
  95. USHORT PayloadSize;
  96. USHORT PayloadSizeComplement;
  97. USHORT Padding;
  98. // Data
  99. } PACKED DEBUG_PACKET_HEADER, *PDEBUG_PACKET_HEADER;
  100. /*++
  101. Structure Description:
  102. This structure stores the format for a debug packet being sent across the
  103. wire. It is assumed values are being sent in little endian order. A debugger
  104. or debuggee won't necessarily transmit the entire size of this structure.
  105. Members:
  106. Header - Stores the packet header.
  107. Payload - Stores the packet contents, which are interpreted differently
  108. depending on the contents of the header.
  109. --*/
  110. typedef struct _DEBUG_PACKET {
  111. DEBUG_PACKET_HEADER Header;
  112. UCHAR Payload[DEBUG_PAYLOAD_SIZE];
  113. } PACKED DEBUG_PACKET, *PDEBUG_PACKET;
  114. typedef enum _DEBUGGER_COMMAND {
  115. DbgInvalidCommand,
  116. DbgConnectionRequest,
  117. DbgConnectionAcknowledge,
  118. DbgConnectionWrongVersion,
  119. DbgConnectionUninitialized,
  120. DbgConnectionInvalidRequest,
  121. DbgBreakRequest,
  122. DbgBreakNotification,
  123. DbgCommandGo,
  124. DbgCommandSingleStep,
  125. DbgCommandRangeStep,
  126. DbgCommandSetRegisters,
  127. DbgCommandSwitchProcessor,
  128. DbgModuleListHeaderRequest,
  129. DbgModuleListEntriesRequest,
  130. DbgModuleListHeader,
  131. DbgModuleListEntry,
  132. DbgModuleListError,
  133. DbgMemoryReadVirtual,
  134. DbgMemoryWriteVirtual,
  135. DbgMemoryContents,
  136. DbgMemoryWriteAcknowledgement,
  137. DbgPrintString,
  138. DbgShutdownNotification,
  139. DbgPacketAcknowledge,
  140. DbgPacketResend,
  141. DbgProfilerNotification,
  142. DbgCommandGetSpecialRegisters,
  143. DbgCommandReturnSpecialRegisters,
  144. DbgCommandSetSpecialRegisters,
  145. DbgCommandReboot,
  146. } DEBUGGER_COMMAND, *PDEBUGGER_COMMAND;
  147. typedef enum _EXCEPTION_TYPE {
  148. ExceptionInvalid,
  149. ExceptionDebugBreak,
  150. ExceptionSingleStep,
  151. ExceptionAssertionFailure,
  152. ExceptionAccessViolation,
  153. ExceptionDoubleFault,
  154. ExceptionSignal,
  155. ExceptionIllegalInstruction,
  156. ExceptionUnknown
  157. } EXCEPTION_TYPE, *PEXCEPTION_TYPE;
  158. typedef enum _SHUTDOWN_TYPE {
  159. ShutdownTypeInvalid,
  160. ShutdownTypeTransition,
  161. ShutdownTypeExit,
  162. ShutdownTypeSynchronizationLost
  163. } SHUTDOWN_TYPE, *PSHUTDOWN_TYPE;
  164. /*++
  165. Structure Description:
  166. This structure stores a connection request. This is sent by the debugger to
  167. attempt to connect to the debuggee.
  168. Members:
  169. ProtocolMajorVersion - Supplies the major version of the debugging protocol.
  170. ProtocolMinorVersion - Supplies the revision of the debugging protocol.
  171. BreakRequested - Supplies a flag indicating whether the debugger wants an
  172. immediate breakpoint (TRUE) or just wants to connect (FALSE).
  173. --*/
  174. typedef struct _CONNECTION_REQUEST {
  175. ULONG ProtocolMajorVersion;
  176. ULONG ProtocolRevision;
  177. UCHAR BreakRequested;
  178. } PACKED CONNECTION_REQUEST, *PCONNECTION_REQUEST;
  179. /*++
  180. Structure Description:
  181. This structure stores the response to a connection request. It is sent by
  182. the debuggee in response to a connection request packet. The kernel banner
  183. immediately follows this structure.
  184. Members:
  185. ProtocolMajorVersion - Stores the major version of the debuggee's debug
  186. protocol. This should match with the connection request.
  187. ProtocolMinorVersion - Stores the minor version of the debuggee's debug
  188. protocol. It's TBD whether or not this has to be exactly the same as
  189. the connection request.
  190. SystemMajorVersion - Stores the major version of the system.
  191. SystemMinorVersion - Stores the minor version of the system.
  192. SystemRevision - Stores the revision number of the system.
  193. SystemReleaseLevel - Stores the release level of the system.
  194. SystemBuildDebugLevel - Stores the debug level of the system.
  195. Machine - Stores the machine type of the debuggee.
  196. ProductNameOffset - Stores the offset from the beginning of this structure
  197. to the product name string, or 0 if none is present.
  198. BuildStringOffset - Stores the offset from the beginning of this structure
  199. to the build string, or 0 if none is present.
  200. SystemSerialVersion - Stores the serial revision number of the system.
  201. SystemBuildTime - Stores the build time of the system.
  202. --*/
  203. typedef struct _CONNECTION_RESPONSE {
  204. USHORT ProtocolMajorVersion;
  205. USHORT ProtocolRevision;
  206. USHORT SystemMajorVersion;
  207. USHORT SystemMinorVersion;
  208. USHORT SystemRevision;
  209. USHORT SystemReleaseLevel;
  210. USHORT SystemBuildDebugLevel;
  211. USHORT Machine;
  212. ULONG ProductNameOffset;
  213. ULONG BuildStringOffset;
  214. ULONGLONG SystemSerialVersion;
  215. ULONGLONG SystemBuildTime;
  216. } PACKED CONNECTION_RESPONSE, *PCONNECTION_RESPONSE;
  217. /*++
  218. Structure Description:
  219. This structure stores information about a "range" breakpoint. The range
  220. break essentially breaks within a certain range of addresses. It also
  221. allows a small exception to this range (ie. for the current source line).
  222. The range step is much slower than a regular breakpoint since it is
  223. implemented by putting the processor into single step mode and manually
  224. checking the range at every instruction.
  225. Members:
  226. BreakRangeMinimum - Stores the first valid address in the breakpoint range.
  227. BreakRangeMaximum - Stores the first invalid address in the breakpoint
  228. range. Said differently, everything below (but not including) this
  229. address is in the break range.
  230. RangeHoleMinimum - Stores the start of a hole in the break range.
  231. Addresses in the hole do not cause a breakpoint.
  232. RangeHoleMaximum - Stores the first invalid address in the range hole.
  233. --*/
  234. typedef struct _RANGE_STEP {
  235. ULONGLONG BreakRangeMinimum;
  236. ULONGLONG BreakRangeMaximum;
  237. ULONGLONG RangeHoleMinimum;
  238. ULONGLONG RangeHoleMaximum;
  239. } PACKED RANGE_STEP, *PRANGE_STEP;
  240. /*++
  241. Structure Description:
  242. This structure stores the state of the general registers of an x86 or x64
  243. processor.
  244. Members:
  245. Registers - Store the contents of the respective registers. The member
  246. fields are made 64-bits wide so they can alias correctly on top of the
  247. 64-bit registers.
  248. --*/
  249. typedef struct _X86_GENERAL_REGISTERS {
  250. ULONGLONG Eax;
  251. ULONGLONG Ebx;
  252. ULONGLONG Ecx;
  253. ULONGLONG Edx;
  254. ULONGLONG Ebp;
  255. ULONGLONG Esp;
  256. ULONGLONG Esi;
  257. ULONGLONG Edi;
  258. ULONGLONG Eip;
  259. ULONGLONG Eflags;
  260. USHORT Cs;
  261. USHORT Ds;
  262. USHORT Es;
  263. USHORT Fs;
  264. USHORT Gs;
  265. USHORT Ss;
  266. } PACKED X86_GENERAL_REGISTERS, *PX86_GENERAL_REGISTERS;
  267. /*++
  268. Structure Description:
  269. This structure stores the state of the general registers of an ARM
  270. processor
  271. Members:
  272. Registers - Store the contents of the respective registers.
  273. --*/
  274. typedef struct _ARM_GENERAL_REGISTERS {
  275. ULONG R0;
  276. ULONG R1;
  277. ULONG R2;
  278. ULONG R3;
  279. ULONG R4;
  280. ULONG R5;
  281. ULONG R6;
  282. ULONG R7;
  283. ULONG R8;
  284. ULONG R9;
  285. ULONG R10;
  286. ULONG R11Fp;
  287. ULONG R12Ip;
  288. ULONG R13Sp;
  289. ULONG R14Lr;
  290. ULONG R15Pc;
  291. ULONG Cpsr;
  292. } PACKED ARM_GENERAL_REGISTERS, *PARM_GENERAL_REGISTERS;
  293. /*++
  294. Structure Description:
  295. This union stores the state of the general registers in a processor.
  296. Members:
  297. X86 - Stores the IA-32 registers.
  298. Arm - Stores the ARM registers.
  299. --*/
  300. typedef union _REGISTERS_UNION {
  301. X86_GENERAL_REGISTERS X86;
  302. ARM_GENERAL_REGISTERS Arm;
  303. } PACKED REGISTERS_UNION, *PREGISTERS_UNION;
  304. typedef struct _IA_TABLE_REGISTER {
  305. ULONG Limit;
  306. ULONG Base;
  307. } IA_TABLE_REGISTER, *PIA_TABLE_REGISTER;
  308. typedef struct _IA_SPECIAL_REGISTERS {
  309. ULONGLONG Cr0;
  310. ULONGLONG Cr2;
  311. ULONGLONG Cr3;
  312. ULONGLONG Cr4;
  313. ULONGLONG Dr0;
  314. ULONGLONG Dr1;
  315. ULONGLONG Dr2;
  316. ULONGLONG Dr3;
  317. ULONGLONG Dr6;
  318. ULONGLONG Dr7;
  319. IA_TABLE_REGISTER Idtr;
  320. IA_TABLE_REGISTER Gdtr;
  321. USHORT Tr;
  322. } PACKED IA_SPECIAL_REGISTERS, *PIA_SPECIAL_REGISTERS;
  323. /*++
  324. Structure Description:
  325. This structure stores the special register state in the ARM architecture.
  326. Members:
  327. Sctlr - Stores the system control register.
  328. Actlr - Stores the auxiliary control register.
  329. Ttbr0 - Stores the first translation table base register.
  330. Ttbr1 - Stores the second translation table base register.
  331. Dfsr - Stores the data fault status register.
  332. Ifsr - Stores the instruction fault status register.
  333. Dfar - Stores the data fault address register.
  334. Ifar - Stores the instruction fault address register.
  335. Prrr - Stores the primary region remap register.
  336. Nmrr - Stores the normal memory remap register.
  337. Vbar - Stores the virtual base address register.
  338. Tpidrprw - Stores the privileged thread register.
  339. Par - Stores the physical address register.
  340. Ats1Cpr - Stores the privileged level read translation register.
  341. Ats1Cpw - Stores the privileged level write translation register.
  342. Ats1Cur - Stores the unprivileged level read translation register.
  343. Ats1Cuw - Stores the unprivileged level write translation register.
  344. --*/
  345. typedef struct _ARM_SPECIAL_REGISTERS {
  346. ULONG Sctlr;
  347. ULONG Actlr;
  348. ULONGLONG Ttbr0;
  349. ULONGLONG Ttbr1;
  350. ULONG Dfsr;
  351. ULONG Ifsr;
  352. ULONGLONG Dfar;
  353. ULONGLONG Ifar;
  354. ULONG Prrr;
  355. ULONG Nmrr;
  356. ULONG Vbar;
  357. ULONGLONG Tpidrprw;
  358. ULONGLONG Par;
  359. ULONG Ats1Cpr;
  360. ULONG Ats1Cpw;
  361. ULONG Ats1Cur;
  362. ULONG Ats1Cuw;
  363. } PACKED ARM_SPECIAL_REGISTERS, *PARM_SPECIAL_REGISTERS;
  364. /*++
  365. Structure Description:
  366. This union stores the state of the special registers in a processor.
  367. Members:
  368. Ia - Stores the Intel PC registers.
  369. Arm - Stores the ARM registers.
  370. --*/
  371. typedef union _SPECIAL_REGISTERS_UNION {
  372. IA_SPECIAL_REGISTERS Ia;
  373. ARM_SPECIAL_REGISTERS Arm;
  374. } PACKED SPECIAL_REGISTERS_UNION, *PSPECIAL_REGISTERS_UNION;
  375. /*++
  376. Structure Description:
  377. This structure defines the command parameters for a set special registers
  378. command.
  379. Members:
  380. Original - Stores the original (current) contents of the registers.
  381. New - Stores the new (desired) contents of the registers. Only the
  382. registers that differ from the original will actually be written to.
  383. --*/
  384. typedef struct _SET_SPECIAL_REGISTERS {
  385. SPECIAL_REGISTERS_UNION Original;
  386. SPECIAL_REGISTERS_UNION New;
  387. } PACKED SET_SPECIAL_REGISTERS, *PSET_SPECIAL_REGISTERS;
  388. /*++
  389. Structure Description:
  390. This structure defines an exception notification. It is sent by the
  391. debuggee to the debugger when a break of some kind has been reached.
  392. Members:
  393. Exception - Stores the type of exception that occurred. Examples are a
  394. single step exception, breakpoint, or access violation. See
  395. EXCEPTION_TYPE values.
  396. ProcessorOrThreadNumber - Stores which processor is broken in for kernel
  397. debugger breaks, or which thread is broken in for user mode
  398. debugger notifications.
  399. ProcessorOrThreadCount - Stores the number of processors in the system for
  400. kernel debugger breaks, or the number of threads in the process for
  401. user mode breaks.
  402. Process - Stores the process ID of the current process. This may be 0 if
  403. the process is not known, there is no process, or this is the kernel
  404. process.
  405. ProcessorBlock - Stores the virtual address of the processor block for this
  406. processor.
  407. LoadedModuleSignature - Stores the sum of the timestamps and loaded lowest
  408. address of the currently loaded modules in the target. This allows the
  409. debugger to quickly see if it's modules are in sync with the target.
  410. LoadedModuleCount - Stores the number of modules loaded in the target.
  411. ErrorCode - Stores the error code if one was generated by the hardware
  412. during the exception.
  413. InstructionPointer - Stores the location of the instruction that is just
  414. about to execute.
  415. InstructionStream - Stores the contents of memory at the instruction
  416. pointer. The instruction stream is guaranteed to be big enough to
  417. disassemble exactly one instruction (the one at the instruction
  418. pointer).
  419. Registers - Stores the current state of all the general registers.
  420. --*/
  421. typedef struct _BREAK_NOTIFICATION {
  422. ULONG Exception;
  423. ULONG ProcessorOrThreadNumber;
  424. ULONG ProcessorOrThreadCount;
  425. ULONG Process;
  426. ULONGLONG ProcessorBlock;
  427. ULONGLONG LoadedModuleSignature;
  428. ULONG LoadedModuleCount;
  429. ULONG ErrorCode;
  430. ULONGLONG InstructionPointer;
  431. BYTE InstructionStream[BREAK_NOTIFICATION_STREAM_SIZE];
  432. REGISTERS_UNION Registers;
  433. } PACKED BREAK_NOTIFICATION, *PBREAK_NOTIFICATION;
  434. /*++
  435. Structure Description:
  436. This structure defines the beginning of a list of all loaded modules in the
  437. system. This is sent by the debuggee to the debugger when the debugger
  438. requests a complete list of loaded modules. An array of loaded module
  439. entries immediately follows this header.
  440. Members:
  441. ModuleCount - Stores the number of loaded modules in the system.
  442. Padding - Stores some padding to align the following members.
  443. Signature - Stores the sum of all the loaded module timestamps and loaded
  444. lowest addresses. Useful as a quick estimate as to whether or not the
  445. host and target are in sync.
  446. --*/
  447. typedef struct _MODULE_LIST_HEADER {
  448. ULONG ModuleCount;
  449. ULONG Padding;
  450. ULONGLONG Signature;
  451. // LOADED_MODULE_ENTRY Modules[ANYSIZE_ARRAY];
  452. } PACKED MODULE_LIST_HEADER, *PMODULE_LIST_HEADER;
  453. /*++
  454. Structure Description:
  455. This structure defines information about one loaded module in the kernel.
  456. An array of these structures are sent by the debuggee to the debugger when
  457. requesting a complete list of loaded modules.
  458. Members:
  459. StructureSize - Stores the total size of the structure in bytes, including
  460. the full null terminated binary string. This address plus this size
  461. will point to the next loaded module entry structure.
  462. Timestamp - Stores the modification date of this module in seconds since
  463. 2001.
  464. LowestAddress - Stores the lowest address in memory where the binary has
  465. memory. Subtracting the base difference from this value results in the
  466. image's preferred load address.
  467. Size - Stores the size of this module when loaded into memory.
  468. Process - Stores the ID of the process this module is specific to.
  469. BinaryName - Stores the name of the executable.
  470. --*/
  471. typedef struct _LOADED_MODULE_ENTRY {
  472. ULONG StructureSize;
  473. ULONGLONG Timestamp;
  474. ULONGLONG LowestAddress;
  475. ULONGLONG Size;
  476. ULONG Process;
  477. CHAR BinaryName[ANYSIZE_ARRAY];
  478. } PACKED LOADED_MODULE_ENTRY, *PLOADED_MODULE_ENTRY;
  479. /*++
  480. Structure Description:
  481. This structure defines a memory contents request. It is sent by the
  482. debugger when reading or writing debuggee memory. If it's a write request
  483. (as defined in the debug packet header), the data to write immediately
  484. follows after this request structure.
  485. Members:
  486. Address - Stores the virtual address of the memory that the debugger wants
  487. from the debuggee.
  488. Size - Stores the number of bytes the debuggee wants from the specified
  489. virtual address.
  490. --*/
  491. typedef struct _MEMORY_REQUEST {
  492. ULONGLONG Address;
  493. ULONG Size;
  494. // Write data follows here.
  495. } PACKED MEMORY_REQUEST, *PMEMORY_REQUEST;
  496. /*++
  497. Structure Description:
  498. This structure defines the header on debuggee memory contents. It is sent
  499. by the debuggee to the debugger after the debugger has requested to read
  500. memory. The actual data follows immediately after this header.
  501. Members:
  502. Address - Stores the virtual address of the data being returned.
  503. Size - Stores the number of bytes being returned to the debugger. Note that
  504. this can be smaller than the number of bytes requested, so it is
  505. important that the debugger look at this field.
  506. --*/
  507. typedef struct _MEMORY_CONTENTS {
  508. ULONGLONG Address;
  509. ULONG Size;
  510. // Data follows here
  511. } PACKED MEMORY_CONTENTS, *PMEMORY_CONTENTS;
  512. /*++
  513. Structure Description:
  514. This structure defines a write acknowledgment. It is sent by the debuggee
  515. to the debugger after the debugger has requested to write to the debuggee's
  516. memory.
  517. Members:
  518. Address - Stores the virtual address that was successfully written to.
  519. BytesWritten - Stores the number of bytes that were successfully written
  520. into the debuggee's memory. Note that this can be smaller than the
  521. number of bytes requested, so it is important that the debugger check
  522. this field.
  523. --*/
  524. typedef struct _WRITE_REQUEST_ACKNOWLEDGEMENT {
  525. ULONGLONG Address;
  526. ULONG BytesWritten;
  527. } PACKED WRITE_REQUEST_ACKNOWLEDGEMENT, *PWRITE_REQUEST_ACKNOWLEDGEMENT;
  528. /*++
  529. Structure Description:
  530. This structure defines a notification of debuggee shutdown. It is sent by
  531. the debuggee to the debugger whenever the kernel debugging system is torn
  532. down.
  533. Members:
  534. ShutdownType - Stores a code indicating why the debugger shut down.
  535. UnloadAllSymbols - Stores a boolean indicating whether or not the debugger
  536. should unload all of its loaded module information.
  537. Process - Stores the identifier of the process exiting for process exit
  538. notifications.
  539. ExitStatus - Stores a status code associated with the shutdown.
  540. --*/
  541. typedef struct _SHUTDOWN_NOTIFICATION {
  542. SHUTDOWN_TYPE ShutdownType;
  543. UCHAR UnloadAllSymbols;
  544. ULONG Process;
  545. ULONG ExitStatus;
  546. } PACKED SHUTDOWN_NOTIFICATION, *PSHUTDOWN_NOTIFICATION;
  547. /*++
  548. Structure Description:
  549. This structure defines a request to switch to another processor in the
  550. debugger.
  551. Members:
  552. ProcessorNumber - Stores the zero-based processor number to switch to.
  553. --*/
  554. typedef struct _SWITCH_PROCESSOR_REQUEST {
  555. ULONG ProcessorNumber;
  556. } PACKED SWITCH_PROCESSOR_REQUEST, *PSWITCH_PROCESSOR_REQUEST;
  557. /*++
  558. Structure Description:
  559. This structure defines the payload of an acknowledge command.
  560. Members:
  561. BreakInRequested - Stores a boolean indicating whether a break in is
  562. requested by the user or not.
  563. --*/
  564. typedef struct _DEBUG_PACKET_ACKNOWLEDGE {
  565. UCHAR BreakInRequested;
  566. } PACKED DEBUG_PACKET_ACKNOWLEDGE, *PDEBUG_PACKET_ACKNOWLEDGE;
  567. /*++
  568. Structure Description:
  569. This structure defines the payload of an acknowledge command.
  570. Members:
  571. ResetType - Stores the reset type to perform. See the DEBUG_REBOOT_TYPE
  572. type.
  573. --*/
  574. typedef struct _DEBUG_REBOOT_REQUEST {
  575. ULONG ResetType;
  576. } PACKED DEBUG_REBOOT_REQUEST, *PDEBUG_REBOOT_REQUEST;
  577. //
  578. // ----------------------------------------------- Internal Function Prototypes
  579. //