diff --git a/reactos/ntoskrnl/include/internal/dbg.h b/reactos/ntoskrnl/include/internal/dbg.h index a7d49f4dee7..32de5f0f40f 100644 --- a/reactos/ntoskrnl/include/internal/dbg.h +++ b/reactos/ntoskrnl/include/internal/dbg.h @@ -7,12 +7,53 @@ #define KdPrintEx(_x_) DbgPrintEx _x_ #if defined(KDBG) || defined(DBG) + +VOID +KdbSymLoadUserModuleSymbols(IN PLDR_MODULE LdrModule); + +VOID +KdbSymFreeProcessSymbols(IN PEPROCESS Process); + +VOID +KdbSymLoadDriverSymbols(IN PUNICODE_STRING Filename, + IN PMODULE_OBJECT Module); + +VOID +KdbSymUnloadDriverSymbols(IN PMODULE_OBJECT ModuleObject); + +VOID +KdbSymProcessBootSymbols(IN PCHAR FileName); + +VOID +KdbSymInit(IN PMODULE_TEXT_SECTION NtoskrnlTextSection, + IN PMODULE_TEXT_SECTION LdrHalTextSection); + +BOOLEAN +KdbSymPrintAddress(IN PVOID Address); + +VOID +KdbDeleteProcessHook(IN PEPROCESS Process); + +NTSTATUS +KdbSymGetAddressInformation(IN PROSSYM_INFO RosSymInfo, + IN ULONG_PTR RelativeAddress, + OUT PULONG LineNumber OPTIONAL, + OUT PCH FileName OPTIONAL, + OUT PCH FunctionName OPTIONAL); + +typedef struct _KDB_MODULE_INFO +{ + WCHAR Name[256]; + ULONG_PTR Base; + ULONG Size; + PROSSYM_INFO RosSymInfo; +} KDB_MODULE_INFO, *PKDB_MODULE_INFO; + # define KDB_LOADUSERMODULE_HOOK(LDRMOD) KdbSymLoadUserModuleSymbols(LDRMOD) # define KDB_LOADDRIVER_HOOK(FILENAME, MODULE) KdbSymLoadDriverSymbols(FILENAME, MODULE) # define KDB_UNLOADDRIVER_HOOK(MODULE) KdbSymUnloadDriverSymbols(MODULE) # define KDB_LOADERINIT_HOOK(NTOS, HAL) KdbSymInit(NTOS, HAL) # define KDB_SYMBOLFILE_HOOK(FILENAME) KdbSymProcessBootSymbols(FILENAME) -# define KDB_DELETEPROCESS_HOOK(PROCESS) KdbDeleteProcessHook(PROCESS) #else # define KDB_LOADUSERMODULE_HOOK(LDRMOD) do { } while (0) # define KDB_LOADDRIVER_HOOK(FILENAME, MODULE) do { } while (0) @@ -20,21 +61,20 @@ # define KDB_LOADERINIT_HOOK(NTOS, HAL) do { } while (0) # define KDB_SYMBOLFILE_HOOK(FILENAME) do { } while (0) # define KDB_CREATE_THREAD_HOOK(CONTEXT) do { } while (0) -# define KDB_DELETEPROCESS_HOOK(PROCESS) do { } while (0) #endif #ifdef KDBG # define KeRosPrintAddress(ADDRESS) KdbSymPrintAddress(ADDRESS) # define KdbInit() KdbpCliInit() # define KdbModuleLoaded(FILENAME) KdbpCliModuleLoaded(FILENAME) -//# define KdbBreak() KdbBreak() +# define KDB_DELETEPROCESS_HOOK(PROCESS) KdbDeleteProcessHook(PROCESS) #else # define KeRosPrintAddress(ADDRESS) KiRosPrintAddress(ADDRESS) # define KdbEnterDebuggerException(ER, PM, C, TF, F) kdHandleException # define KdbInit() do { } while (0) # define KdbEnter() do { } while (0) # define KdbModuleLoaded(X) do { } while (0) -//# define KdbBreak() do { } while (0) +# define KDB_DELETEPROCESS_HOOK(PROCESS) do { } while (0) #endif #endif /* __INCLUDE_INTERNAL_DBG_H */ diff --git a/reactos/ntoskrnl/include/internal/kdb.h b/reactos/ntoskrnl/include/internal/kdb.h index 3ec6d3a1d92..091722261f3 100644 --- a/reactos/ntoskrnl/include/internal/kdb.h +++ b/reactos/ntoskrnl/include/internal/kdb.h @@ -80,16 +80,6 @@ typedef enum _KDB_OUTPUT_SETTINGS KD_DEBUG_KDNOECHO } KDB_OUTPUT_SETTINGS; -/* from kdb_symbols.c */ -typedef struct _KDB_MODULE_INFO -{ - WCHAR Name[256]; - ULONG_PTR Base; - ULONG Size; - PROSSYM_INFO RosSymInfo; -} KDB_MODULE_INFO, *PKDB_MODULE_INFO; - - /* FUNCTIONS *****************************************************************/ /* from i386/i386-dis.c */ @@ -171,50 +161,6 @@ BOOLEAN KdbpSymFindModuleByIndex(IN INT Index, OUT PKDB_MODULE_INFO pInfo); -BOOLEAN -KdbSymPrintAddress(IN PVOID Address); - -NTSTATUS -KdbSymGetAddressInformation(IN PROSSYM_INFO RosSymInfo, - IN ULONG_PTR RelativeAddress, - OUT PULONG LineNumber OPTIONAL, - OUT PCH FileName OPTIONAL, - OUT PCH FunctionName OPTIONAL); - -VOID -KdbSymLoadUserModuleSymbols(IN PLDR_MODULE LdrModule); - -VOID -KdbSymFreeProcessSymbols(IN PEPROCESS Process); - -VOID -KdbSymLoadDriverSymbols(IN PUNICODE_STRING Filename, - IN PMODULE_OBJECT Module); - -VOID -KdbSymUnloadDriverSymbols(IN PMODULE_OBJECT ModuleObject); - -VOID -KdbSymProcessBootSymbols(IN PCHAR FileName); - -VOID -KdbSymInit(IN PMODULE_TEXT_SECTION NtoskrnlTextSection, - IN PMODULE_TEXT_SECTION LdrHalTextSection); - - -BOOLEAN -KdbSymPrintAddress(IN PVOID Address); - -KD_CONTINUE_TYPE -KdbEnterDebuggerException(PEXCEPTION_RECORD ExceptionRecord, - KPROCESSOR_MODE PreviousMode, - PCONTEXT Context, - PKTRAP_FRAME TrapFrame, - BOOLEAN FirstChance); - -VOID -KdbDeleteProcessHook(IN PEPROCESS Process); - /* from kdb.c */ extern PEPROCESS KdbCurrentProcess; @@ -291,6 +237,12 @@ VOID STDCALL KdbpGetCommandLineSettings(PCHAR p1); +KD_CONTINUE_TYPE +KdbEnterDebuggerException(PEXCEPTION_RECORD ExceptionRecord, + KPROCESSOR_MODE PreviousMode, + PCONTEXT Context, + PKTRAP_FRAME TrapFrame, + BOOLEAN FirstChance); /* other functions */ #define KdbpSafeReadMemory(dst, src, size) MmSafeCopyFromUser(dst, src, size) diff --git a/reactos/ntoskrnl/kdbg/kdb_symbols.c b/reactos/ntoskrnl/kdbg/kdb_symbols.c index 1f90150b996..b0098c25a57 100644 --- a/reactos/ntoskrnl/kdbg/kdb_symbols.c +++ b/reactos/ntoskrnl/kdbg/kdb_symbols.c @@ -11,25 +11,12 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include #include #define NDEBUG #include -#include - /* GLOBALS ******************************************************************/ #define TAG_KDBS TAG('K', 'D', 'B', 'S') diff --git a/reactos/ntoskrnl/ke/i386/syscall.S b/reactos/ntoskrnl/ke/i386/syscall.S index 0ef89d06ac8..06e04e064dd 100644 --- a/reactos/ntoskrnl/ke/i386/syscall.S +++ b/reactos/ntoskrnl/ke/i386/syscall.S @@ -97,7 +97,7 @@ _KiSystemService: pushl %gs // + 0x48 sub $0x28, %esp // + 0x70 -#ifdef GDB +#ifdef DBG /* Trick gdb 6 into backtracing over the system call */ mov 0x6c(%esp), %ebx pushl 4(%ebx) /* DebugEIP */ // + 0x74 @@ -124,7 +124,7 @@ _KiSystemService: CheckValidCall: -#ifdef GDB +#ifdef DBG /* * GDB thinks the function starts here and * wants a standard prolog, so let's give it