2005-04-25 14:44:48 +00:00
|
|
|
/*
|
|
|
|
* COPYRIGHT: See COPYING in the top level directory
|
|
|
|
* PROJECT: ReactOS Kernel
|
2015-10-04 11:54:25 +00:00
|
|
|
* FILE: ntoskrnl/kd/kdmain.c
|
2008-12-29 14:26:01 +00:00
|
|
|
* PURPOSE: Kernel Debugger Initialization
|
2005-05-09 01:38:29 +00:00
|
|
|
*
|
2005-04-25 14:44:48 +00:00
|
|
|
* PROGRAMMERS: Alex Ionescu (alex@relsoft.net)
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <ntoskrnl.h>
|
|
|
|
#define NDEBUG
|
2008-08-30 16:31:06 +00:00
|
|
|
#include <debug.h>
|
2005-04-25 14:44:48 +00:00
|
|
|
|
|
|
|
/* VARIABLES ***************************************************************/
|
|
|
|
|
2005-11-22 02:30:18 +00:00
|
|
|
BOOLEAN KdDebuggerEnabled = FALSE;
|
|
|
|
BOOLEAN KdEnteredDebugger = FALSE;
|
|
|
|
BOOLEAN KdDebuggerNotPresent = TRUE;
|
2007-01-24 19:48:34 +00:00
|
|
|
BOOLEAN KdBreakAfterSymbolLoad = FALSE;
|
2007-03-05 01:35:43 +00:00
|
|
|
BOOLEAN KdPitchDebugger = TRUE;
|
2009-10-17 14:31:38 +00:00
|
|
|
BOOLEAN KdIgnoreUmExceptions = FALSE;
|
2009-11-02 17:45:51 +00:00
|
|
|
KD_CONTEXT KdpContext;
|
|
|
|
ULONG Kd_WIN2000_Mask;
|
2019-05-20 10:17:22 +00:00
|
|
|
LONG KdpTimeSlipPending;
|
|
|
|
KDDEBUGGER_DATA64 KdDebuggerDataBlock;
|
2008-11-29 20:47:48 +00:00
|
|
|
VOID NTAPI PspDumpThreads(BOOLEAN SystemThreads);
|
2005-04-25 14:44:48 +00:00
|
|
|
|
- More sharing between ntdll/ntoskrnl: shared Dbg code.
- Added NtCreateDebugObject, NtDebugContinue, NtQueryDebugFilterState, NtSetDebugFilterState, NtWaitForDebugEvent to system call list.
- Added some debug constants to headers
- Updated RtlpCheckForActiveDebugger in ntoskrnl to return whatever we're expecting as the "normal" case.
- Added RtlpSetInDbgPrint to rtl support library for special DbgPrint implementation difference in user-mode
- Removed all the deprecated debug APIs in ntdll.
- Implemented NtQueryDebugFilterState and NtSetDebugFilterState based on royce's implementation.
- Started modifications on KeDebugService, and implemented DebugService in rtl
- Implemented all the Dbg* APIs in RTL.
- Implemented DbgUiConnectToDbg, DbgUiContinue, DbgUiWaitStateChange, DbgUiRemoteBreakin, DbgUiIssueRemoteBreakin
- Changed KD Print callbacks to also receive the length of the string.
Right now, one call that should be shared still isn't (the final DebugPrint call) because calling KeDebugService from kernel-mode seems to cause a hang. Also, DebugService does not currently cause an exception like it should (instead it still calls the Kdp handler), because those changes would've made the patch even bigger and are still untested.
svn path=/trunk/; revision=18078
2005-09-26 04:59:48 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
2015-08-28 14:01:58 +00:00
|
|
|
ULONG ComponentId;
|
|
|
|
ULONG Level;
|
- More sharing between ntdll/ntoskrnl: shared Dbg code.
- Added NtCreateDebugObject, NtDebugContinue, NtQueryDebugFilterState, NtSetDebugFilterState, NtWaitForDebugEvent to system call list.
- Added some debug constants to headers
- Updated RtlpCheckForActiveDebugger in ntoskrnl to return whatever we're expecting as the "normal" case.
- Added RtlpSetInDbgPrint to rtl support library for special DbgPrint implementation difference in user-mode
- Removed all the deprecated debug APIs in ntdll.
- Implemented NtQueryDebugFilterState and NtSetDebugFilterState based on royce's implementation.
- Started modifications on KeDebugService, and implemented DebugService in rtl
- Implemented all the Dbg* APIs in RTL.
- Implemented DbgUiConnectToDbg, DbgUiContinue, DbgUiWaitStateChange, DbgUiRemoteBreakin, DbgUiIssueRemoteBreakin
- Changed KD Print callbacks to also receive the length of the string.
Right now, one call that should be shared still isn't (the final DebugPrint call) because calling KeDebugService from kernel-mode seems to cause a hang. Also, DebugService does not currently cause an exception like it should (instead it still calls the Kdp handler), because those changes would've made the patch even bigger and are still untested.
svn path=/trunk/; revision=18078
2005-09-26 04:59:48 +00:00
|
|
|
} KD_COMPONENT_DATA;
|
|
|
|
#define MAX_KD_COMPONENT_TABLE_ENTRIES 128
|
2019-05-20 10:17:22 +00:00
|
|
|
KD_COMPONENT_DATA KdpComponentTable[MAX_KD_COMPONENT_TABLE_ENTRIES];
|
- More sharing between ntdll/ntoskrnl: shared Dbg code.
- Added NtCreateDebugObject, NtDebugContinue, NtQueryDebugFilterState, NtSetDebugFilterState, NtWaitForDebugEvent to system call list.
- Added some debug constants to headers
- Updated RtlpCheckForActiveDebugger in ntoskrnl to return whatever we're expecting as the "normal" case.
- Added RtlpSetInDbgPrint to rtl support library for special DbgPrint implementation difference in user-mode
- Removed all the deprecated debug APIs in ntdll.
- Implemented NtQueryDebugFilterState and NtSetDebugFilterState based on royce's implementation.
- Started modifications on KeDebugService, and implemented DebugService in rtl
- Implemented all the Dbg* APIs in RTL.
- Implemented DbgUiConnectToDbg, DbgUiContinue, DbgUiWaitStateChange, DbgUiRemoteBreakin, DbgUiIssueRemoteBreakin
- Changed KD Print callbacks to also receive the length of the string.
Right now, one call that should be shared still isn't (the final DebugPrint call) because calling KeDebugService from kernel-mode seems to cause a hang. Also, DebugService does not currently cause an exception like it should (instead it still calls the Kdp handler), because those changes would've made the patch even bigger and are still untested.
svn path=/trunk/; revision=18078
2005-09-26 04:59:48 +00:00
|
|
|
ULONG KdComponentTableEntries = 0;
|
|
|
|
|
2008-01-08 09:51:53 +00:00
|
|
|
ULONG Kd_DEFAULT_MASK = 1 << DPFLTR_ERROR_LEVEL;
|
|
|
|
|
2005-04-25 14:44:48 +00:00
|
|
|
/* PRIVATE FUNCTIONS *********************************************************/
|
|
|
|
|
|
|
|
ULONG
|
2008-11-29 20:47:48 +00:00
|
|
|
NTAPI
|
2005-04-25 14:44:48 +00:00
|
|
|
KdpServiceDispatcher(ULONG Service,
|
- More sharing between ntdll/ntoskrnl: shared Dbg code.
- Added NtCreateDebugObject, NtDebugContinue, NtQueryDebugFilterState, NtSetDebugFilterState, NtWaitForDebugEvent to system call list.
- Added some debug constants to headers
- Updated RtlpCheckForActiveDebugger in ntoskrnl to return whatever we're expecting as the "normal" case.
- Added RtlpSetInDbgPrint to rtl support library for special DbgPrint implementation difference in user-mode
- Removed all the deprecated debug APIs in ntdll.
- Implemented NtQueryDebugFilterState and NtSetDebugFilterState based on royce's implementation.
- Started modifications on KeDebugService, and implemented DebugService in rtl
- Implemented all the Dbg* APIs in RTL.
- Implemented DbgUiConnectToDbg, DbgUiContinue, DbgUiWaitStateChange, DbgUiRemoteBreakin, DbgUiIssueRemoteBreakin
- Changed KD Print callbacks to also receive the length of the string.
Right now, one call that should be shared still isn't (the final DebugPrint call) because calling KeDebugService from kernel-mode seems to cause a hang. Also, DebugService does not currently cause an exception like it should (instead it still calls the Kdp handler), because those changes would've made the patch even bigger and are still untested.
svn path=/trunk/; revision=18078
2005-09-26 04:59:48 +00:00
|
|
|
PVOID Buffer1,
|
2017-12-14 10:43:57 +00:00
|
|
|
ULONG Buffer1Length,
|
|
|
|
KPROCESSOR_MODE PreviousMode)
|
2005-04-25 14:44:48 +00:00
|
|
|
{
|
|
|
|
ULONG Result = 0;
|
|
|
|
|
|
|
|
switch (Service)
|
|
|
|
{
|
- More sharing between ntdll/ntoskrnl: shared Dbg code.
- Added NtCreateDebugObject, NtDebugContinue, NtQueryDebugFilterState, NtSetDebugFilterState, NtWaitForDebugEvent to system call list.
- Added some debug constants to headers
- Updated RtlpCheckForActiveDebugger in ntoskrnl to return whatever we're expecting as the "normal" case.
- Added RtlpSetInDbgPrint to rtl support library for special DbgPrint implementation difference in user-mode
- Removed all the deprecated debug APIs in ntdll.
- Implemented NtQueryDebugFilterState and NtSetDebugFilterState based on royce's implementation.
- Started modifications on KeDebugService, and implemented DebugService in rtl
- Implemented all the Dbg* APIs in RTL.
- Implemented DbgUiConnectToDbg, DbgUiContinue, DbgUiWaitStateChange, DbgUiRemoteBreakin, DbgUiIssueRemoteBreakin
- Changed KD Print callbacks to also receive the length of the string.
Right now, one call that should be shared still isn't (the final DebugPrint call) because calling KeDebugService from kernel-mode seems to cause a hang. Also, DebugService does not currently cause an exception like it should (instead it still calls the Kdp handler), because those changes would've made the patch even bigger and are still untested.
svn path=/trunk/; revision=18078
2005-09-26 04:59:48 +00:00
|
|
|
case BREAKPOINT_PRINT: /* DbgPrint */
|
2017-12-14 10:43:57 +00:00
|
|
|
Result = KdpPrintString(Buffer1, Buffer1Length, PreviousMode);
|
2005-04-25 14:44:48 +00:00
|
|
|
break;
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2009-06-17 12:44:05 +00:00
|
|
|
#if DBG
|
2009-08-24 18:19:53 +00:00
|
|
|
case ' soR': /* ROS-INTERNAL */
|
2005-04-25 14:44:48 +00:00
|
|
|
{
|
2010-01-13 22:35:43 +00:00
|
|
|
switch ((ULONG_PTR)Buffer1)
|
2005-04-25 14:44:48 +00:00
|
|
|
{
|
|
|
|
case DumpAllThreads:
|
|
|
|
PspDumpThreads(TRUE);
|
|
|
|
break;
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2005-04-25 14:44:48 +00:00
|
|
|
case DumpUserThreads:
|
|
|
|
PspDumpThreads(FALSE);
|
|
|
|
break;
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2010-11-02 14:58:39 +00:00
|
|
|
case KdSpare3:
|
|
|
|
MmDumpArmPfnDatabase(FALSE);
|
2009-06-27 09:54:56 +00:00
|
|
|
break;
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2005-04-25 14:44:48 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2008-12-16 17:51:57 +00:00
|
|
|
break;
|
2005-04-25 14:44:48 +00:00
|
|
|
}
|
2008-12-16 15:25:51 +00:00
|
|
|
|
2015-08-28 14:01:58 +00:00
|
|
|
#if defined(_M_IX86) && !defined(_WINKD_) // See ke/i386/traphdlr.c
|
2011-02-19 21:50:11 +00:00
|
|
|
/* Register a debug callback */
|
|
|
|
case 'CsoR':
|
|
|
|
{
|
|
|
|
switch (Buffer1Length)
|
|
|
|
{
|
|
|
|
case ID_Win32PreServiceHook:
|
|
|
|
KeWin32PreServiceHook = Buffer1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_Win32PostServiceHook:
|
|
|
|
KeWin32PostServiceHook = Buffer1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2015-08-28 14:01:58 +00:00
|
|
|
#endif
|
2011-02-19 21:50:11 +00:00
|
|
|
|
2008-12-16 15:25:51 +00:00
|
|
|
/* Special case for stack frame dumps */
|
2009-08-24 18:19:53 +00:00
|
|
|
case 'DsoR':
|
2008-12-16 15:25:51 +00:00
|
|
|
{
|
|
|
|
KeRosDumpStackFrames((PULONG)Buffer1, Buffer1Length);
|
|
|
|
break;
|
|
|
|
}
|
2012-10-01 23:06:32 +00:00
|
|
|
|
2015-09-09 16:06:38 +00:00
|
|
|
#if defined(KDBG)
|
2012-10-01 23:06:32 +00:00
|
|
|
/* Register KDBG CLI callback */
|
|
|
|
case 'RbdK':
|
|
|
|
{
|
|
|
|
Result = KdbRegisterCliCallback(Buffer1, Buffer1Length);
|
2012-10-06 09:47:15 +00:00
|
|
|
break;
|
2012-10-01 23:06:32 +00:00
|
|
|
}
|
|
|
|
#endif /* KDBG */
|
|
|
|
#endif /* DBG */
|
2005-04-25 14:44:48 +00:00
|
|
|
default:
|
2013-01-01 16:42:07 +00:00
|
|
|
DPRINT1("Invalid debug service call!\n");
|
2013-10-13 23:04:13 +00:00
|
|
|
HalDisplayString("Invalid debug service call!\r\n");
|
2005-04-25 14:44:48 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return Result;
|
|
|
|
}
|
|
|
|
|
2006-09-17 07:06:35 +00:00
|
|
|
BOOLEAN
|
|
|
|
NTAPI
|
|
|
|
KdpEnterDebuggerException(IN PKTRAP_FRAME TrapFrame,
|
|
|
|
IN PKEXCEPTION_FRAME ExceptionFrame,
|
|
|
|
IN PEXCEPTION_RECORD ExceptionRecord,
|
|
|
|
IN PCONTEXT Context,
|
|
|
|
IN KPROCESSOR_MODE PreviousMode,
|
|
|
|
IN BOOLEAN SecondChance)
|
|
|
|
{
|
2009-06-22 13:47:10 +00:00
|
|
|
KD_CONTINUE_TYPE Return = kdHandleException;
|
2007-03-03 17:24:58 +00:00
|
|
|
ULONG ExceptionCommand = ExceptionRecord->ExceptionInformation[0];
|
|
|
|
|
|
|
|
/* Check if this was a breakpoint due to DbgPrint or Load/UnloadSymbols */
|
|
|
|
if ((ExceptionRecord->ExceptionCode == STATUS_BREAKPOINT) &&
|
|
|
|
(ExceptionRecord->NumberParameters > 0) &&
|
|
|
|
((ExceptionCommand == BREAKPOINT_LOAD_SYMBOLS) ||
|
|
|
|
(ExceptionCommand == BREAKPOINT_UNLOAD_SYMBOLS) ||
|
|
|
|
(ExceptionCommand == BREAKPOINT_COMMAND_STRING) ||
|
2009-10-23 22:51:39 +00:00
|
|
|
(ExceptionCommand == BREAKPOINT_PRINT) ||
|
|
|
|
(ExceptionCommand == BREAKPOINT_PROMPT)))
|
2007-03-03 17:24:58 +00:00
|
|
|
{
|
|
|
|
/* Check if this is a debug print */
|
|
|
|
if (ExceptionCommand == BREAKPOINT_PRINT)
|
|
|
|
{
|
|
|
|
/* Print the string */
|
|
|
|
KdpServiceDispatcher(BREAKPOINT_PRINT,
|
|
|
|
(PVOID)ExceptionRecord->ExceptionInformation[1],
|
2017-12-14 10:43:57 +00:00
|
|
|
ExceptionRecord->ExceptionInformation[2],
|
|
|
|
PreviousMode);
|
2009-10-04 16:53:15 +00:00
|
|
|
|
|
|
|
/* Return success */
|
|
|
|
KeSetContextReturnRegister(Context, STATUS_SUCCESS);
|
2007-03-03 17:24:58 +00:00
|
|
|
}
|
2009-10-23 22:51:39 +00:00
|
|
|
#ifdef KDBG
|
2007-07-06 09:02:16 +00:00
|
|
|
else if (ExceptionCommand == BREAKPOINT_LOAD_SYMBOLS)
|
|
|
|
{
|
2017-12-08 13:45:26 +00:00
|
|
|
PKD_SYMBOLS_INFO SymbolsInfo;
|
|
|
|
KD_SYMBOLS_INFO CapturedSymbolsInfo;
|
2009-09-22 21:31:55 +00:00
|
|
|
PLDR_DATA_TABLE_ENTRY LdrEntry;
|
|
|
|
|
2017-12-08 13:45:26 +00:00
|
|
|
SymbolsInfo = (PKD_SYMBOLS_INFO)ExceptionRecord->ExceptionInformation[2];
|
|
|
|
if (PreviousMode != KernelMode)
|
|
|
|
{
|
|
|
|
_SEH2_TRY
|
|
|
|
{
|
|
|
|
ProbeForRead(SymbolsInfo,
|
|
|
|
sizeof(*SymbolsInfo),
|
|
|
|
1);
|
|
|
|
RtlCopyMemory(&CapturedSymbolsInfo,
|
|
|
|
SymbolsInfo,
|
|
|
|
sizeof(*SymbolsInfo));
|
|
|
|
SymbolsInfo = &CapturedSymbolsInfo;
|
|
|
|
}
|
|
|
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
|
|
|
{
|
|
|
|
SymbolsInfo = NULL;
|
|
|
|
}
|
|
|
|
_SEH2_END;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (SymbolsInfo != NULL)
|
|
|
|
{
|
|
|
|
/* Load symbols. Currently implemented only for KDBG! */
|
|
|
|
if (KdbpSymFindModule(SymbolsInfo->BaseOfDll, NULL, -1, &LdrEntry))
|
|
|
|
{
|
|
|
|
KdbSymProcessSymbols(LdrEntry);
|
|
|
|
}
|
|
|
|
}
|
2007-07-06 09:02:16 +00:00
|
|
|
}
|
2009-10-23 22:51:39 +00:00
|
|
|
else if (ExceptionCommand == BREAKPOINT_PROMPT)
|
|
|
|
{
|
|
|
|
ULONG ReturnValue;
|
|
|
|
LPSTR OutString;
|
|
|
|
USHORT OutStringLength;
|
|
|
|
|
|
|
|
/* Get the response string and length */
|
|
|
|
OutString = (LPSTR)Context->Ebx;
|
|
|
|
OutStringLength = (USHORT)Context->Edi;
|
|
|
|
|
|
|
|
/* Call KDBG */
|
|
|
|
ReturnValue = KdpPrompt((LPSTR)ExceptionRecord->
|
|
|
|
ExceptionInformation[1],
|
|
|
|
(USHORT)ExceptionRecord->
|
|
|
|
ExceptionInformation[2],
|
|
|
|
OutString,
|
2017-12-08 13:39:31 +00:00
|
|
|
OutStringLength,
|
2019-05-20 10:17:22 +00:00
|
|
|
PreviousMode,
|
|
|
|
TrapFrame,
|
|
|
|
ExceptionFrame);
|
2009-10-23 22:51:39 +00:00
|
|
|
|
|
|
|
/* Return the number of characters that we received */
|
|
|
|
Context->Eax = ReturnValue;
|
|
|
|
}
|
|
|
|
#endif
|
2006-09-17 07:06:35 +00:00
|
|
|
|
2009-10-04 16:53:15 +00:00
|
|
|
/* This we can handle: simply bump the Program Counter */
|
|
|
|
KeSetContextPc(Context, KeGetContextPc(Context) + KD_BREAKPOINT_SIZE);
|
2007-03-03 19:49:36 +00:00
|
|
|
return TRUE;
|
2007-03-03 17:24:58 +00:00
|
|
|
}
|
2006-09-17 07:06:35 +00:00
|
|
|
|
2009-10-23 22:51:39 +00:00
|
|
|
#ifdef KDBG
|
|
|
|
/* Check if this is an assertion failure */
|
|
|
|
if (ExceptionRecord->ExceptionCode == STATUS_ASSERTION_FAILURE)
|
|
|
|
{
|
2014-10-16 21:33:32 +00:00
|
|
|
/* Bump EIP to the instruction following the int 2C */
|
2009-10-23 22:51:39 +00:00
|
|
|
Context->Eip += 2;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2006-09-17 07:06:35 +00:00
|
|
|
/* Get out of here if the Debugger isn't connected */
|
|
|
|
if (KdDebuggerNotPresent) return FALSE;
|
|
|
|
|
2009-06-22 11:32:58 +00:00
|
|
|
#ifdef KDBG
|
2006-09-17 07:06:35 +00:00
|
|
|
/* Call KDBG if available */
|
|
|
|
Return = KdbEnterDebuggerException(ExceptionRecord,
|
|
|
|
PreviousMode,
|
|
|
|
Context,
|
|
|
|
TrapFrame,
|
|
|
|
!SecondChance);
|
2009-06-22 11:32:58 +00:00
|
|
|
#else /* not KDBG */
|
|
|
|
if (WrapperInitRoutine)
|
|
|
|
{
|
|
|
|
/* Call GDB */
|
|
|
|
Return = WrapperTable.KdpExceptionRoutine(ExceptionRecord,
|
|
|
|
Context,
|
|
|
|
TrapFrame);
|
|
|
|
}
|
|
|
|
#endif /* not KDBG */
|
2006-09-17 07:06:35 +00:00
|
|
|
|
2008-06-12 08:56:13 +00:00
|
|
|
/* Debugger didn't handle it, please handle! */
|
|
|
|
if (Return == kdHandleException) return FALSE;
|
|
|
|
|
|
|
|
/* Debugger handled it */
|
2008-06-11 11:34:04 +00:00
|
|
|
return TRUE;
|
2006-09-17 07:06:35 +00:00
|
|
|
}
|
|
|
|
|
2009-10-17 14:31:38 +00:00
|
|
|
BOOLEAN
|
|
|
|
NTAPI
|
|
|
|
KdIsThisAKdTrap(IN PEXCEPTION_RECORD ExceptionRecord,
|
|
|
|
IN PCONTEXT Context,
|
|
|
|
IN KPROCESSOR_MODE PreviousMode)
|
|
|
|
{
|
|
|
|
/* KDBG has its own mechanism for ignoring user mode exceptions */
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2005-04-25 14:44:48 +00:00
|
|
|
/* PUBLIC FUNCTIONS *********************************************************/
|
|
|
|
|
2019-05-20 10:17:22 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
KdUpdateDataBlock(VOID)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
- Export KeI386MachineType and KeInitializeThreadedDpc
- Stubplement and export IoEnumerateRegisteredFiltersList, IoGetPagingIoPriority, KdRefreshDebuggerNotPresent, KeAcquireInStackQueuedSpinLockForDpc, KeReleaseInStackQueuedSpinLockForDpc, KeAcquireSpinLockForDpc, KeReleaseSpinLockForDpc, KeRegisterNmiCallback, KeDeregisterNmiCallback, KeInitializeCrashDumpHeader, KeTestSpinLock and MmAllocatePagesForMdlEx
- Add IO_PAGING_PRIORITY enumeration and PNMI_CALLBACK prototype to headers
svn path=/trunk/; revision=35103
2008-08-04 15:48:46 +00:00
|
|
|
/*
|
|
|
|
* @implemented
|
|
|
|
*/
|
|
|
|
BOOLEAN
|
|
|
|
NTAPI
|
|
|
|
KdRefreshDebuggerNotPresent(VOID)
|
|
|
|
{
|
|
|
|
UNIMPLEMENTED;
|
|
|
|
|
|
|
|
/* Just return whatever was set previously -- FIXME! */
|
|
|
|
return KdDebuggerNotPresent;
|
|
|
|
}
|
|
|
|
|
2005-04-25 14:44:48 +00:00
|
|
|
/*
|
|
|
|
* @implemented
|
|
|
|
*/
|
2006-09-07 22:38:06 +00:00
|
|
|
NTSTATUS
|
2008-11-29 20:47:48 +00:00
|
|
|
NTAPI
|
2005-04-25 14:44:48 +00:00
|
|
|
KdDisableDebugger(VOID)
|
|
|
|
{
|
|
|
|
KIRQL OldIrql;
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2005-04-25 14:44:48 +00:00
|
|
|
/* Raise IRQL */
|
|
|
|
KeRaiseIrql(DISPATCH_LEVEL, &OldIrql);
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2005-04-25 14:44:48 +00:00
|
|
|
/* TODO: Disable any breakpoints */
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2005-04-25 14:44:48 +00:00
|
|
|
/* Disable the Debugger */
|
|
|
|
KdDebuggerEnabled = FALSE;
|
2016-10-06 19:01:33 +00:00
|
|
|
SharedUserData->KdDebuggerEnabled = FALSE;
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2005-04-25 14:44:48 +00:00
|
|
|
/* Lower the IRQL */
|
|
|
|
KeLowerIrql(OldIrql);
|
2006-09-07 22:38:06 +00:00
|
|
|
|
|
|
|
/* Return success */
|
|
|
|
return STATUS_SUCCESS;
|
2005-04-25 14:44:48 +00:00
|
|
|
}
|
|
|
|
|
2019-05-20 10:17:22 +00:00
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
KdEnableDebuggerWithLock(IN BOOLEAN NeedLock)
|
|
|
|
{
|
|
|
|
return STATUS_ACCESS_DENIED;
|
|
|
|
}
|
|
|
|
|
2005-04-25 14:44:48 +00:00
|
|
|
/*
|
|
|
|
* @implemented
|
|
|
|
*/
|
2006-09-07 22:38:06 +00:00
|
|
|
NTSTATUS
|
2008-11-29 20:47:48 +00:00
|
|
|
NTAPI
|
2005-04-25 14:44:48 +00:00
|
|
|
KdEnableDebugger(VOID)
|
|
|
|
{
|
|
|
|
KIRQL OldIrql;
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2005-04-25 14:44:48 +00:00
|
|
|
/* Raise IRQL */
|
|
|
|
KeRaiseIrql(DISPATCH_LEVEL, &OldIrql);
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2005-04-25 14:44:48 +00:00
|
|
|
/* TODO: Re-enable any breakpoints */
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2005-04-25 14:44:48 +00:00
|
|
|
/* Enable the Debugger */
|
|
|
|
KdDebuggerEnabled = TRUE;
|
2016-10-06 19:01:33 +00:00
|
|
|
SharedUserData->KdDebuggerEnabled = TRUE;
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2005-04-25 14:44:48 +00:00
|
|
|
/* Lower the IRQL */
|
|
|
|
KeLowerIrql(OldIrql);
|
2006-09-07 22:38:06 +00:00
|
|
|
|
|
|
|
/* Return success */
|
|
|
|
return STATUS_SUCCESS;
|
2005-04-25 14:44:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* @implemented
|
|
|
|
*/
|
2005-05-09 01:38:29 +00:00
|
|
|
BOOLEAN
|
2008-11-29 20:47:48 +00:00
|
|
|
NTAPI
|
2005-04-25 14:44:48 +00:00
|
|
|
KdPollBreakIn(VOID)
|
|
|
|
{
|
2019-05-20 11:35:08 +00:00
|
|
|
return FALSE;
|
2005-04-25 14:44:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* @unimplemented
|
|
|
|
*/
|
|
|
|
NTSTATUS
|
2008-11-29 20:47:48 +00:00
|
|
|
NTAPI
|
2005-04-25 14:44:48 +00:00
|
|
|
KdPowerTransition(ULONG PowerState)
|
|
|
|
{
|
|
|
|
UNIMPLEMENTED;
|
|
|
|
return STATUS_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
2006-12-06 20:55:42 +00:00
|
|
|
/*
|
|
|
|
* @unimplemented
|
|
|
|
*/
|
2007-03-02 18:25:23 +00:00
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
2006-12-06 20:55:42 +00:00
|
|
|
KdChangeOption(IN KD_OPTION Option,
|
|
|
|
IN ULONG InBufferLength OPTIONAL,
|
|
|
|
IN PVOID InBuffer,
|
|
|
|
IN ULONG OutBufferLength OPTIONAL,
|
|
|
|
OUT PVOID OutBuffer,
|
|
|
|
OUT PULONG OutBufferRequiredLength OPTIONAL)
|
|
|
|
{
|
|
|
|
UNIMPLEMENTED;
|
2007-03-02 18:25:23 +00:00
|
|
|
return STATUS_NOT_IMPLEMENTED;
|
2006-12-06 20:55:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
- More sharing between ntdll/ntoskrnl: shared Dbg code.
- Added NtCreateDebugObject, NtDebugContinue, NtQueryDebugFilterState, NtSetDebugFilterState, NtWaitForDebugEvent to system call list.
- Added some debug constants to headers
- Updated RtlpCheckForActiveDebugger in ntoskrnl to return whatever we're expecting as the "normal" case.
- Added RtlpSetInDbgPrint to rtl support library for special DbgPrint implementation difference in user-mode
- Removed all the deprecated debug APIs in ntdll.
- Implemented NtQueryDebugFilterState and NtSetDebugFilterState based on royce's implementation.
- Started modifications on KeDebugService, and implemented DebugService in rtl
- Implemented all the Dbg* APIs in RTL.
- Implemented DbgUiConnectToDbg, DbgUiContinue, DbgUiWaitStateChange, DbgUiRemoteBreakin, DbgUiIssueRemoteBreakin
- Changed KD Print callbacks to also receive the length of the string.
Right now, one call that should be shared still isn't (the final DebugPrint call) because calling KeDebugService from kernel-mode seems to cause a hang. Also, DebugService does not currently cause an exception like it should (instead it still calls the Kdp handler), because those changes would've made the patch even bigger and are still untested.
svn path=/trunk/; revision=18078
2005-09-26 04:59:48 +00:00
|
|
|
NTSTATUS
|
2008-01-08 09:51:53 +00:00
|
|
|
NTAPI
|
- More sharing between ntdll/ntoskrnl: shared Dbg code.
- Added NtCreateDebugObject, NtDebugContinue, NtQueryDebugFilterState, NtSetDebugFilterState, NtWaitForDebugEvent to system call list.
- Added some debug constants to headers
- Updated RtlpCheckForActiveDebugger in ntoskrnl to return whatever we're expecting as the "normal" case.
- Added RtlpSetInDbgPrint to rtl support library for special DbgPrint implementation difference in user-mode
- Removed all the deprecated debug APIs in ntdll.
- Implemented NtQueryDebugFilterState and NtSetDebugFilterState based on royce's implementation.
- Started modifications on KeDebugService, and implemented DebugService in rtl
- Implemented all the Dbg* APIs in RTL.
- Implemented DbgUiConnectToDbg, DbgUiContinue, DbgUiWaitStateChange, DbgUiRemoteBreakin, DbgUiIssueRemoteBreakin
- Changed KD Print callbacks to also receive the length of the string.
Right now, one call that should be shared still isn't (the final DebugPrint call) because calling KeDebugService from kernel-mode seems to cause a hang. Also, DebugService does not currently cause an exception like it should (instead it still calls the Kdp handler), because those changes would've made the patch even bigger and are still untested.
svn path=/trunk/; revision=18078
2005-09-26 04:59:48 +00:00
|
|
|
NtQueryDebugFilterState(IN ULONG ComponentId,
|
|
|
|
IN ULONG Level)
|
|
|
|
{
|
2008-01-08 09:51:53 +00:00
|
|
|
ULONG i;
|
|
|
|
|
|
|
|
/* Convert Level to mask if it isn't already one */
|
|
|
|
if (Level < 32)
|
|
|
|
Level = 1 << Level;
|
|
|
|
|
|
|
|
/* Check if it is not the default component */
|
2015-09-25 19:28:05 +00:00
|
|
|
if (ComponentId != MAXULONG)
|
2008-01-08 09:51:53 +00:00
|
|
|
{
|
|
|
|
/* No, search for an existing entry in the table */
|
|
|
|
for (i = 0; i < KdComponentTableEntries; i++)
|
|
|
|
{
|
|
|
|
/* Check if it is the right component */
|
2019-05-20 10:17:22 +00:00
|
|
|
if (ComponentId == KdpComponentTable[i].ComponentId)
|
2008-01-08 09:51:53 +00:00
|
|
|
{
|
|
|
|
/* Check if mask are matching */
|
2019-05-20 10:17:22 +00:00
|
|
|
return (Level & KdpComponentTable[i].Level) ? TRUE : FALSE;
|
2008-01-08 09:51:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Entry not found in the table, use default mask */
|
2009-10-25 15:56:38 +00:00
|
|
|
return (Level & Kd_DEFAULT_MASK) ? TRUE : FALSE;
|
- More sharing between ntdll/ntoskrnl: shared Dbg code.
- Added NtCreateDebugObject, NtDebugContinue, NtQueryDebugFilterState, NtSetDebugFilterState, NtWaitForDebugEvent to system call list.
- Added some debug constants to headers
- Updated RtlpCheckForActiveDebugger in ntoskrnl to return whatever we're expecting as the "normal" case.
- Added RtlpSetInDbgPrint to rtl support library for special DbgPrint implementation difference in user-mode
- Removed all the deprecated debug APIs in ntdll.
- Implemented NtQueryDebugFilterState and NtSetDebugFilterState based on royce's implementation.
- Started modifications on KeDebugService, and implemented DebugService in rtl
- Implemented all the Dbg* APIs in RTL.
- Implemented DbgUiConnectToDbg, DbgUiContinue, DbgUiWaitStateChange, DbgUiRemoteBreakin, DbgUiIssueRemoteBreakin
- Changed KD Print callbacks to also receive the length of the string.
Right now, one call that should be shared still isn't (the final DebugPrint call) because calling KeDebugService from kernel-mode seems to cause a hang. Also, DebugService does not currently cause an exception like it should (instead it still calls the Kdp handler), because those changes would've made the patch even bigger and are still untested.
svn path=/trunk/; revision=18078
2005-09-26 04:59:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
NTSTATUS
|
2008-01-08 09:51:53 +00:00
|
|
|
NTAPI
|
- More sharing between ntdll/ntoskrnl: shared Dbg code.
- Added NtCreateDebugObject, NtDebugContinue, NtQueryDebugFilterState, NtSetDebugFilterState, NtWaitForDebugEvent to system call list.
- Added some debug constants to headers
- Updated RtlpCheckForActiveDebugger in ntoskrnl to return whatever we're expecting as the "normal" case.
- Added RtlpSetInDbgPrint to rtl support library for special DbgPrint implementation difference in user-mode
- Removed all the deprecated debug APIs in ntdll.
- Implemented NtQueryDebugFilterState and NtSetDebugFilterState based on royce's implementation.
- Started modifications on KeDebugService, and implemented DebugService in rtl
- Implemented all the Dbg* APIs in RTL.
- Implemented DbgUiConnectToDbg, DbgUiContinue, DbgUiWaitStateChange, DbgUiRemoteBreakin, DbgUiIssueRemoteBreakin
- Changed KD Print callbacks to also receive the length of the string.
Right now, one call that should be shared still isn't (the final DebugPrint call) because calling KeDebugService from kernel-mode seems to cause a hang. Also, DebugService does not currently cause an exception like it should (instead it still calls the Kdp handler), because those changes would've made the patch even bigger and are still untested.
svn path=/trunk/; revision=18078
2005-09-26 04:59:48 +00:00
|
|
|
NtSetDebugFilterState(IN ULONG ComponentId,
|
|
|
|
IN ULONG Level,
|
|
|
|
IN BOOLEAN State)
|
|
|
|
{
|
2008-01-08 09:51:53 +00:00
|
|
|
ULONG i;
|
|
|
|
|
|
|
|
/* Convert Level to mask if it isn't already one */
|
2007-12-25 10:45:14 +00:00
|
|
|
if (Level < 32)
|
|
|
|
Level = 1 << Level;
|
2008-05-15 20:43:26 +00:00
|
|
|
Level &= ~DPFLTR_MASK;
|
2007-12-25 10:45:14 +00:00
|
|
|
|
2008-01-08 09:51:53 +00:00
|
|
|
/* Check if it is the default component */
|
2015-09-25 19:28:05 +00:00
|
|
|
if (ComponentId == MAXULONG)
|
2008-01-08 09:51:53 +00:00
|
|
|
{
|
|
|
|
/* Yes, modify the default mask */
|
|
|
|
if (State)
|
|
|
|
Kd_DEFAULT_MASK |= Level;
|
|
|
|
else
|
|
|
|
Kd_DEFAULT_MASK &= ~Level;
|
|
|
|
|
|
|
|
return STATUS_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Search for an existing entry */
|
|
|
|
for (i = 0; i < KdComponentTableEntries; i++ )
|
|
|
|
{
|
2019-05-20 10:17:22 +00:00
|
|
|
if (ComponentId == KdpComponentTable[i].ComponentId)
|
2008-01-08 09:51:53 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Check if we have found an existing entry */
|
|
|
|
if (i == KdComponentTableEntries)
|
|
|
|
{
|
|
|
|
/* Check if we have enough space in the table */
|
|
|
|
if (i == MAX_KD_COMPONENT_TABLE_ENTRIES)
|
|
|
|
return STATUS_INVALID_PARAMETER_1;
|
|
|
|
|
|
|
|
/* Add a new entry */
|
|
|
|
++KdComponentTableEntries;
|
2019-05-20 10:17:22 +00:00
|
|
|
KdpComponentTable[i].ComponentId = ComponentId;
|
|
|
|
KdpComponentTable[i].Level = Kd_DEFAULT_MASK;
|
2008-01-08 09:51:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Update entry table */
|
|
|
|
if (State)
|
2019-05-20 10:17:22 +00:00
|
|
|
KdpComponentTable[i].Level |= Level;
|
2008-01-08 09:51:53 +00:00
|
|
|
else
|
2019-05-20 10:17:22 +00:00
|
|
|
KdpComponentTable[i].Level &= ~Level;
|
2008-01-08 09:51:53 +00:00
|
|
|
|
|
|
|
return STATUS_SUCCESS;
|
- More sharing between ntdll/ntoskrnl: shared Dbg code.
- Added NtCreateDebugObject, NtDebugContinue, NtQueryDebugFilterState, NtSetDebugFilterState, NtWaitForDebugEvent to system call list.
- Added some debug constants to headers
- Updated RtlpCheckForActiveDebugger in ntoskrnl to return whatever we're expecting as the "normal" case.
- Added RtlpSetInDbgPrint to rtl support library for special DbgPrint implementation difference in user-mode
- Removed all the deprecated debug APIs in ntdll.
- Implemented NtQueryDebugFilterState and NtSetDebugFilterState based on royce's implementation.
- Started modifications on KeDebugService, and implemented DebugService in rtl
- Implemented all the Dbg* APIs in RTL.
- Implemented DbgUiConnectToDbg, DbgUiContinue, DbgUiWaitStateChange, DbgUiRemoteBreakin, DbgUiIssueRemoteBreakin
- Changed KD Print callbacks to also receive the length of the string.
Right now, one call that should be shared still isn't (the final DebugPrint call) because calling KeDebugService from kernel-mode seems to cause a hang. Also, DebugService does not currently cause an exception like it should (instead it still calls the Kdp handler), because those changes would've made the patch even bigger and are still untested.
svn path=/trunk/; revision=18078
2005-09-26 04:59:48 +00:00
|
|
|
}
|
|
|
|
|
2007-03-04 19:54:39 +00:00
|
|
|
/*
|
|
|
|
* @unimplemented
|
|
|
|
*/
|
2007-03-04 19:20:03 +00:00
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
KdSystemDebugControl(IN SYSDBG_COMMAND Command,
|
|
|
|
IN PVOID InputBuffer,
|
|
|
|
IN ULONG InputBufferLength,
|
|
|
|
OUT PVOID OutputBuffer,
|
|
|
|
IN ULONG OutputBufferLength,
|
|
|
|
IN OUT PULONG ReturnLength,
|
|
|
|
IN KPROCESSOR_MODE PreviousMode)
|
|
|
|
{
|
|
|
|
/* HACK */
|
2017-12-14 10:43:57 +00:00
|
|
|
return KdpServiceDispatcher(Command,
|
|
|
|
InputBuffer,
|
|
|
|
InputBufferLength,
|
|
|
|
PreviousMode);
|
2007-03-04 19:20:03 +00:00
|
|
|
}
|
|
|
|
|
2006-09-17 07:06:35 +00:00
|
|
|
PKDEBUG_ROUTINE KiDebugRoutine = KdpEnterDebuggerException;
|
|
|
|
|
2005-04-25 14:44:48 +00:00
|
|
|
/* EOF */
|