47#define hex_to_pid hex_to_tid
132 KDDBGPRINT(
"Checking if %p is alive.\n", Tid);
140 KDDBGPRINT(
"Checking if p%p.%p is alive.\n", Pid, Tid);
163 return send_gdb_packet(
"PacketSize=1000;multiprocess+;qXfer:libraries:read+;");
207 if (CurrentProcessEntry ==
NULL)
229 CurrentProcessEntry = CurrentProcessEntry->
Flink)
236 for ( CurrentThreadEntry =
Process->ThreadListHead.Flink;
237 CurrentThreadEntry != &
Process->ThreadListHead;
238 CurrentThreadEntry = CurrentThreadEntry->
Flink)
343 char str_helper[256];
344 char name_helper[64];
350 KDDBGPRINT(
"KDGDB: qXfer:libraries:read !\n");
384 CurrentEntry = CurrentEntry->
Flink)
395 if (name_helper[
i] >=
'A' && name_helper[
i] <=
'Z')
396 name_helper[
i] +=
'a' -
'A';
401 mem_length =
_snprintf(str_helper, 256,
"<library name=\"C:\\%s\"><segment address=\"0x%p\"/></library>", &name_helper, DllBase);
410 if ((
Sent + mem_length) > ToSend)
419 if ((ToSend -
Sent) > 15)
450 MessageData->Length = 0;
468 KDDBGPRINT(
"Wrong packet type (%lu) received after DbgKdReadVirtualMemoryApi request.\n", PacketType);
474 KDDBGPRINT(
"Wrong API number (%lu) after DbgKdReadVirtualMemoryApi request.\n",
State->ApiNumber);
514 MessageData->Length = 0;
523 if (AttachedThread ==
NULL)
525 KDDBGPRINT(
"The current GDB debug thread is invalid!");
529 AttachedProcess = AttachedThread->
Tcb.
Process;
530 if (AttachedProcess ==
NULL)
532 KDDBGPRINT(
"The current GDB debug thread is invalid!");
541 if (AttachedProcess ==
NULL)
543 KDDBGPRINT(
"The current GDB debug thread is invalid!");
572 KDDBGPRINT(
"Wrong packet type (%lu) received after DbgKdWriteVirtualMemoryApi request.\n", PacketType);
578 KDDBGPRINT(
"Wrong API number (%lu) after DbgKdWriteVirtualMemoryApi request.\n",
State->ApiNumber);
629 if (AttachedThread ==
NULL)
631 KDDBGPRINT(
"The current GDB debug thread is invalid!");
635 AttachedProcess = AttachedThread->
Tcb.
Process;
636 if (AttachedProcess ==
NULL)
638 KDDBGPRINT(
"The current GDB debug thread is invalid!");
647 if (AttachedProcess ==
NULL)
649 KDDBGPRINT(
"The current GDB debug thread is invalid!");
690 *OutPtr++ = *blob_ptr++;
712 KDDBGPRINT(
"Wrong packet type (%lu) received after DbgKdWriteBreakPointApi request.\n", PacketType);
718 KDDBGPRINT(
"Wrong API number (%lu) after DbgKdWriteBreakPointApi request.\n",
State->ApiNumber);
760 MessageData->Length = 0;
782 KDDBGPRINT(
"No breakpoint slot available!\n");
813 KDDBGPRINT(
"Wrong packet type (%lu) received after DbgKdRestoreBreakPointApi request.\n", PacketType);
819 KDDBGPRINT(
"Wrong API number (%lu) after DbgKdRestoreBreakPointApi request.\n",
State->ApiNumber);
854 MessageData->Length = 0;
882 State->u.RestoreBreakPoint.BreakPointHandle =
Handle;
927#if defined(_M_IX86) || defined(_M_AMD64)
int strcmp(const char *String1, const char *String2)
char * strstr(char *String1, char *String2)
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
KDSTATUS gdb_send_registers(void)
KDSTATUS gdb_send_register(void)
#define NT_SUCCESS(StatCode)
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
KDSTATUS NTAPI gdb_receive_packet(_Inout_ PKD_CONTEXT KdContext)
KDSTATUS gdb_send_debug_io(_In_ PSTRING String, _In_ BOOLEAN WithPrefix)
void send_gdb_ntstatus(_In_ NTSTATUS Status)
KDSTATUS send_gdb_memory(_In_ const VOID *Buffer, _In_ size_t Length)
void send_gdb_partial_packet(_In_ const CHAR *Buffer)
void start_gdb_packet(void)
KDSTATUS gdb_send_exception()
KDSTATUS finish_gdb_packet(void)
ULONG send_gdb_partial_binary(_In_ const VOID *Buffer, _In_ size_t Length)
KDSTATUS send_gdb_packet(_In_ const CHAR *Buffer)
GLint GLint GLint GLint GLint x
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
__INTRIN_INLINE void __writecr3(unsigned int Data)
#define gdb_pid_to_handle
KDP_SEND_HANDLER KdpSendPacketHandler
KDP_MANIPULATESTATE_HANDLER KdpManipulateStateHandler
KDSTATUS SetContextManipulateHandler(_Out_ DBGKD_MANIPULATE_STATE64 *State, _Out_ PSTRING MessageData, _Out_ PULONG MessageLength, _Inout_ PKD_CONTEXT KdContext)
PEPROCESS find_process(_In_ UINT_PTR Pid)
DBGKD_ANY_WAIT_STATE_CHANGE CurrentStateChange
#define handle_to_gdb_pid
FORCEINLINE HANDLE gdb_tid_to_handle(UINT_PTR Tid)
FORCEINLINE UINT_PTR handle_to_gdb_tid(HANDLE Handle)
KDSTATUS ContinueManipulateStateHandler(_Out_ DBGKD_MANIPULATE_STATE64 *State, _Out_ PSTRING MessageData, _Out_ PULONG MessageLength, _Inout_ PKD_CONTEXT KdContext)
LIST_ENTRY * ModuleListHead
LIST_ENTRY * ProcessListHead
PETHREAD find_thread(_In_ UINT_PTR Pid, _In_ UINT_PTR Tid)
#define sprintf(buf, format,...)
unsigned __int3264 UINT_PTR
_In_ ULONG _In_ ULONG Offset
#define KD_BREAKPOINT_TYPE
#define KD_BREAKPOINT_VALUE
#define KD_BREAKPOINT_SIZE
HANDLE NTAPI PsGetCurrentProcessId(VOID)
HANDLE NTAPI PsGetThreadId(IN PETHREAD Thread)
HANDLE NTAPI PsGetThreadProcessId(IN PETHREAD Thread)
#define STATUS_ASSERTION_FAILURE
#define STATUS_BREAKPOINT
_In_ UCHAR _In_ ULONG _Out_ PUCHAR _Outptr_result_bytebuffer_ OutBufferLength PVOID * OutBuffer
union _DBGKD_ANY_WAIT_STATE_CHANGE::@3641 u
DBGKM_EXCEPTION64 Exception
EXCEPTION_RECORD64 ExceptionRecord
ULONG_PTR DirectoryTableBase
struct _LIST_ENTRY * Flink
#define CONTAINING_RECORD(address, type, field)
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG BufferLength
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
#define DbgKdGetContextApi
#define DbgKdWriteVirtualMemoryApi
#define PACKET_TYPE_KD_STATE_MANIPULATE
#define DbgKdReadVirtualMemoryApi
#define DbgKdWriteBreakPointApi
#define DbgKdExceptionStateChange
#define DbgKdRestoreBreakPointApi
_Must_inspect_result_ typedef _In_ ULONG TableEntry
#define PsGetCurrentProcess