ReactOS 0.4.15-dev-7788-g1ad9096
kd64.h File Reference

Go to the source code of this file.

Classes

struct  _BREAKPOINT_ENTRY
 

Macros

#define KD_DEFAULT_LOG_BUFFER_SIZE   0x1000
 
#define KDP_MSG_BUFFER_SIZE   0x1000
 
#define KD_BREAKPOINT_MAX   32
 
#define KD_HIGHEST_USER_BREAKPOINT_ADDRESS   (PVOID)0x60000000
 
#define KD_BREAKPOINT_ACTIVE   0x01
 
#define KD_BREAKPOINT_PENDING   0x02
 
#define KD_BREAKPOINT_SUSPENDED   0x04
 
#define KD_BREAKPOINT_EXPIRED   0x08
 
#define MAX_KD_COMPONENT_TABLE_ENTRIES   (DPFLTR_ENDOFTABLE_ID + 1)
 

Typedefs

typedef struct _BREAKPOINT_ENTRY BREAKPOINT_ENTRY
 
typedef struct _BREAKPOINT_ENTRYPBREAKPOINT_ENTRY
 
typedef BOOLEAN(NTAPIPKDEBUG_ROUTINE) (IN PKTRAP_FRAME TrapFrame, IN PKEXCEPTION_FRAME ExceptionFrame, IN PEXCEPTION_RECORD ExceptionRecord, IN PCONTEXT Context, IN KPROCESSOR_MODE PreviousMode, IN BOOLEAN SecondChance)
 
typedef BOOLEAN(NTAPIPKDEBUG_SWITCH_ROUTINE) (IN PEXCEPTION_RECORD ExceptionRecord, IN PCONTEXT Context, IN BOOLEAN SecondChance)
 

Functions

BOOLEAN NTAPI KdInitSystem (_In_ ULONG BootPhase, _In_opt_ PLOADER_PARAMETER_BLOCK LoaderBlock)
 
VOID NTAPI KdUpdateDataBlock (VOID)
 
BOOLEAN NTAPI KdIsThisAKdTrap (IN PEXCEPTION_RECORD ExceptionRecord, IN PCONTEXT Context, IN KPROCESSOR_MODE PreviousMode)
 
BOOLEAN NTAPI KdpSwitchProcessor (IN PEXCEPTION_RECORD ExceptionRecord, IN OUT PCONTEXT ContextRecord, IN BOOLEAN SecondChanceException)
 
VOID NTAPI KdpTimeSlipWork (IN PVOID Context)
 
VOID NTAPI KdpTimeSlipDpcRoutine (IN PKDPC Dpc, IN PVOID DeferredContext, IN PVOID SystemArgument1, IN PVOID SystemArgument2)
 
BOOLEAN NTAPI KdpStub (IN PKTRAP_FRAME TrapFrame, IN PKEXCEPTION_FRAME ExceptionFrame, IN PEXCEPTION_RECORD ExceptionRecord, IN PCONTEXT ContextRecord, IN KPROCESSOR_MODE PreviousMode, IN BOOLEAN SecondChanceException)
 
BOOLEAN NTAPI KdpTrap (IN PKTRAP_FRAME TrapFrame, IN PKEXCEPTION_FRAME ExceptionFrame, IN PEXCEPTION_RECORD ExceptionRecord, IN PCONTEXT ContextRecord, IN KPROCESSOR_MODE PreviousMode, IN BOOLEAN SecondChanceException)
 
VOID NTAPI KdpPortLock (VOID)
 
VOID NTAPI KdpPortUnlock (VOID)
 
BOOLEAN NTAPI KdpPollBreakInWithPortLock (VOID)
 
BOOLEAN NTAPI KdEnterDebugger (IN PKTRAP_FRAME TrapFrame, IN PKEXCEPTION_FRAME ExceptionFrame)
 
VOID NTAPI KdExitDebugger (IN BOOLEAN Enable)
 
NTSTATUS NTAPI KdEnableDebuggerWithLock (IN BOOLEAN NeedLock)
 
NTSTATUS NTAPI KdDisableDebuggerWithLock (IN BOOLEAN NeedLock)
 
NTSTATUS NTAPI KdpPrint (_In_ ULONG ComponentId, _In_ ULONG Level, _In_reads_bytes_(Length) PCHAR String, _In_ USHORT Length, _In_ KPROCESSOR_MODE PreviousMode, _In_ PKTRAP_FRAME TrapFrame, _In_ PKEXCEPTION_FRAME ExceptionFrame, _Out_ PBOOLEAN Handled)
 
USHORT NTAPI KdpPrompt (_In_reads_bytes_(PromptLength) PCHAR PromptString, _In_ USHORT PromptLength, _Out_writes_bytes_(MaximumResponseLength) PCHAR ResponseString, _In_ USHORT MaximumResponseLength, _In_ KPROCESSOR_MODE PreviousMode, _In_ PKTRAP_FRAME TrapFrame, _In_ PKEXCEPTION_FRAME ExceptionFrame)
 
VOID NTAPI KdpSymbol (IN PSTRING DllPath, IN PKD_SYMBOLS_INFO SymbolInfo, IN BOOLEAN Unload, IN KPROCESSOR_MODE PreviousMode, IN PCONTEXT ContextRecord, IN PKTRAP_FRAME TrapFrame, IN PKEXCEPTION_FRAME ExceptionFrame)
 
VOID NTAPI KdpCommandString (IN PSTRING NameString, IN PSTRING CommandString, IN KPROCESSOR_MODE PreviousMode, IN PCONTEXT ContextRecord, IN PKTRAP_FRAME TrapFrame, IN PKEXCEPTION_FRAME ExceptionFrame)
 
VOID NTAPI KdpReportLoadSymbolsStateChange (IN PSTRING PathName, IN PKD_SYMBOLS_INFO SymbolInfo, IN BOOLEAN Unload, IN OUT PCONTEXT Context)
 
VOID NTAPI KdpReportCommandStringStateChange (IN PSTRING NameString, IN PSTRING CommandString, IN OUT PCONTEXT Context)
 
BOOLEAN NTAPI KdpReportExceptionStateChange (IN PEXCEPTION_RECORD ExceptionRecord, IN OUT PCONTEXT Context, IN BOOLEAN SecondChanceException)
 
ULONG NTAPI KdpAddBreakpoint (IN PVOID Address)
 
VOID NTAPI KdSetOwedBreakpoints (VOID)
 
BOOLEAN NTAPI KdpDeleteBreakpoint (IN ULONG BpEntry)
 
BOOLEAN NTAPI KdpDeleteBreakpointRange (IN PVOID Base, IN PVOID Limit)
 
VOID NTAPI KdpSuspendBreakPoint (IN ULONG BpEntry)
 
VOID NTAPI KdpRestoreAllBreakpoints (VOID)
 
VOID NTAPI KdpSuspendAllBreakPoints (VOID)
 
NTSTATUS NTAPI KdpAllowDisable (VOID)
 
NTSTATUS NTAPI KdpCopyMemoryChunks (_In_ ULONG64 Address, _In_ PVOID Buffer, _In_ ULONG TotalSize, _In_ ULONG ChunkSize, _In_ ULONG Flags, _Out_opt_ PULONG ActualSize)
 
VOID NTAPI KdpMoveMemory (_In_ PVOID Destination, _In_ PVOID Source, _In_ SIZE_T Length)
 
VOID NTAPI KdpZeroMemory (_In_ PVOID Destination, _In_ SIZE_T Length)
 
VOID NTAPI KdpSysGetVersion (IN PDBGKD_GET_VERSION64 Version)
 
VOID NTAPI KdpGetStateChange (IN PDBGKD_MANIPULATE_STATE64 State, IN PCONTEXT Context)
 
VOID NTAPI KdpSetContextState (IN PDBGKD_ANY_WAIT_STATE_CHANGE WaitStateChange, IN PCONTEXT Context)
 
NTSTATUS NTAPI KdpSysReadMsr (IN ULONG Msr, OUT PLARGE_INTEGER MsrValue)
 
NTSTATUS NTAPI KdpSysWriteMsr (IN ULONG Msr, IN PLARGE_INTEGER MsrValue)
 
NTSTATUS NTAPI KdpSysReadBusData (IN ULONG BusDataType, IN ULONG BusNumber, IN ULONG SlotNumber, IN ULONG Offset, IN PVOID Buffer, IN ULONG Length, OUT PULONG ActualLength)
 
NTSTATUS NTAPI KdpSysWriteBusData (IN ULONG BusDataType, IN ULONG BusNumber, IN ULONG SlotNumber, IN ULONG Offset, IN PVOID Buffer, IN ULONG Length, OUT PULONG ActualLength)
 
NTSTATUS NTAPI KdpSysReadControlSpace (IN ULONG Processor, IN ULONG64 BaseAddress, IN PVOID Buffer, IN ULONG Length, OUT PULONG ActualLength)
 
NTSTATUS NTAPI KdpSysWriteControlSpace (IN ULONG Processor, IN ULONG64 BaseAddress, IN PVOID Buffer, IN ULONG Length, OUT PULONG ActualLength)
 
NTSTATUS NTAPI KdpSysReadIoSpace (IN ULONG InterfaceType, IN ULONG BusNumber, IN ULONG AddressSpace, IN ULONG64 IoAddress, IN PVOID DataValue, IN ULONG DataSize, OUT PULONG ActualDataSize)
 
NTSTATUS NTAPI KdpSysWriteIoSpace (IN ULONG InterfaceType, IN ULONG BusNumber, IN ULONG AddressSpace, IN ULONG64 IoAddress, IN PVOID DataValue, IN ULONG DataSize, OUT PULONG ActualDataSize)
 
NTSTATUS NTAPI KdpSysCheckLowMemory (IN ULONG Flags)
 
VOID __cdecl KdpDprintf (_In_ PCSTR Format,...)
 
BOOLEAN NTAPI KdpPrintString (_In_ PSTRING Output)
 
VOID NTAPI KdLogDbgPrint (_In_ PSTRING String)
 

Variables

DBGKD_GET_VERSION64 KdVersionBlock
 
KDDEBUGGER_DATA64 KdDebuggerDataBlock
 
LIST_ENTRY KdpDebuggerDataListHead
 
KSPIN_LOCK KdpDataSpinLock
 
LARGE_INTEGER KdPerformanceCounterRate
 
LARGE_INTEGER KdTimerStart
 
ULONG KdDisableCount
 
KD_CONTEXT KdpContext
 
PKDEBUG_ROUTINE KiDebugRoutine
 
PKDEBUG_SWITCH_ROUTINE KiDebugSwitchRoutine
 
BOOLEAN KdBreakAfterSymbolLoad
 
BOOLEAN KdPitchDebugger
 
BOOLEAN KdAutoEnableOnEvent
 
BOOLEAN KdBlockEnable
 
BOOLEAN KdIgnoreUmExceptions
 
BOOLEAN KdPreviouslyEnabled
 
BOOLEAN KdpDebuggerStructuresInitialized
 
BOOLEAN KdEnteredDebugger
 
KDPC KdpTimeSlipDpc
 
KTIMER KdpTimeSlipTimer
 
WORK_QUEUE_ITEM KdpTimeSlipWorkItem
 
LONG KdpTimeSlipPending
 
PKEVENT KdpTimeSlipEvent
 
KSPIN_LOCK KdpTimeSlipEventLock
 
BOOLEAN KdpPortLocked
 
BOOLEAN KdpControlCPressed
 
BOOLEAN KdpContextSent
 
KSPIN_LOCK KdpDebuggerLock
 
LARGE_INTEGER KdTimerStop
 
LARGE_INTEGER KdTimerDifference
 
CHAR KdpMessageBuffer [KDP_MSG_BUFFER_SIZE]
 
CHAR KdpPathBuffer [KDP_MSG_BUFFER_SIZE]
 
CHAR KdPrintDefaultCircularBuffer [KD_DEFAULT_LOG_BUFFER_SIZE]
 
PCHAR KdPrintWritePointer
 
ULONG KdPrintRolloverCount
 
PCHAR KdPrintCircularBuffer
 
ULONG KdPrintBufferSize
 
ULONG KdPrintBufferChanges
 
KSPIN_LOCK KdpPrintSpinLock
 
BREAKPOINT_ENTRY KdpBreakpointTable [KD_BREAKPOINT_MAX]
 
KD_BREAKPOINT_TYPE KdpBreakpointInstruction
 
BOOLEAN KdpOweBreakpoint
 
BOOLEAN BreakpointsSuspended
 
ULONG KdpNumInternalBreakpoints
 
ULONG_PTR KdpCurrentSymbolStart
 
ULONG_PTR KdpCurrentSymbolEnd
 
ULONG TraceDataBuffer [40]
 
ULONG TraceDataBufferPosition
 
ULONG KdComponentTableSize
 
PULONG KdComponentTable [MAX_KD_COMPONENT_TABLE_ENTRIES]
 
ULONG Kd_WIN2000_Mask
 
ULONG Kd_SYSTEM_Mask
 
ULONG Kd_SMSS_Mask
 
ULONG Kd_SETUP_Mask
 
ULONG Kd_NTFS_Mask
 
ULONG Kd_FSTUB_Mask
 
ULONG Kd_CRASHDUMP_Mask
 
ULONG Kd_CDAUDIO_Mask
 
ULONG Kd_CDROM_Mask
 
ULONG Kd_CLASSPNP_Mask
 
ULONG Kd_DISK_Mask
 
ULONG Kd_REDBOOK_Mask
 
ULONG Kd_STORPROP_Mask
 
ULONG Kd_SCSIPORT_Mask
 
ULONG Kd_SCSIMINIPORT_Mask
 
ULONG Kd_CONFIG_Mask
 
ULONG Kd_I8042PRT_Mask
 
ULONG Kd_SERMOUSE_Mask
 
ULONG Kd_LSERMOUS_Mask
 
ULONG Kd_KBDHID_Mask
 
ULONG Kd_MOUHID_Mask
 
ULONG Kd_KBDCLASS_Mask
 
ULONG Kd_MOUCLASS_Mask
 
ULONG Kd_TWOTRACK_Mask
 
ULONG Kd_WMILIB_Mask
 
ULONG Kd_ACPI_Mask
 
ULONG Kd_AMLI_Mask
 
ULONG Kd_HALIA64_Mask
 
ULONG Kd_VIDEO_Mask
 
ULONG Kd_SVCHOST_Mask
 
ULONG Kd_VIDEOPRT_Mask
 
ULONG Kd_TCPIP_Mask
 
ULONG Kd_DMSYNTH_Mask
 
ULONG Kd_NTOSPNP_Mask
 
ULONG Kd_FASTFAT_Mask
 
ULONG Kd_SAMSS_Mask
 
ULONG Kd_PNPMGR_Mask
 
ULONG Kd_NETAPI_Mask
 
ULONG Kd_SCSERVER_Mask
 
ULONG Kd_SCCLIENT_Mask
 
ULONG Kd_SERIAL_Mask
 
ULONG Kd_SERENUM_Mask
 
ULONG Kd_UHCD_Mask
 
ULONG Kd_RPCPROXY_Mask
 
ULONG Kd_AUTOCHK_Mask
 
ULONG Kd_DCOMSS_Mask
 
ULONG Kd_UNIMODEM_Mask
 
ULONG Kd_SIS_Mask
 
ULONG Kd_FLTMGR_Mask
 
ULONG Kd_WMICORE_Mask
 
ULONG Kd_BURNENG_Mask
 
ULONG Kd_IMAPI_Mask
 
ULONG Kd_SXS_Mask
 
ULONG Kd_FUSION_Mask
 
ULONG Kd_IDLETASK_Mask
 
ULONG Kd_SOFTPCI_Mask
 
ULONG Kd_TAPE_Mask
 
ULONG Kd_MCHGR_Mask
 
ULONG Kd_IDEP_Mask
 
ULONG Kd_PCIIDE_Mask
 
ULONG Kd_FLOPPY_Mask
 
ULONG Kd_FDC_Mask
 
ULONG Kd_TERMSRV_Mask
 
ULONG Kd_W32TIME_Mask
 
ULONG Kd_PREFETCHER_Mask
 
ULONG Kd_RSFILTER_Mask
 
ULONG Kd_FCPORT_Mask
 
ULONG Kd_PCI_Mask
 
ULONG Kd_DMIO_Mask
 
ULONG Kd_DMCONFIG_Mask
 
ULONG Kd_DMADMIN_Mask
 
ULONG Kd_WSOCKTRANSPORT_Mask
 
ULONG Kd_VSS_Mask
 
ULONG Kd_PNPMEM_Mask
 
ULONG Kd_PROCESSOR_Mask
 
ULONG Kd_DMSERVER_Mask
 
ULONG Kd_SR_Mask
 
ULONG Kd_INFINIBAND_Mask
 
ULONG Kd_IHVDRIVER_Mask
 
ULONG Kd_IHVVIDEO_Mask
 
ULONG Kd_IHVAUDIO_Mask
 
ULONG Kd_IHVNETWORK_Mask
 
ULONG Kd_IHVSTREAMING_Mask
 
ULONG Kd_IHVBUS_Mask
 
ULONG Kd_HPS_Mask
 
ULONG Kd_RTLTHREADPOOL_Mask
 
ULONG Kd_LDR_Mask
 
ULONG Kd_TCPIP6_Mask
 
ULONG Kd_ISAPNP_Mask
 
ULONG Kd_SHPC_Mask
 
ULONG Kd_STORPORT_Mask
 
ULONG Kd_STORMINIPORT_Mask
 
ULONG Kd_PRINTSPOOLER_Mask
 
ULONG Kd_VSSDYNDISK_Mask
 
ULONG Kd_VERIFIER_Mask
 
ULONG Kd_VDS_Mask
 
ULONG Kd_VDSBAS_Mask
 
ULONG Kd_VDSDYN_Mask
 
ULONG Kd_VDSDYNDR_Mask
 
ULONG Kd_VDSLDR_Mask
 
ULONG Kd_VDSUTIL_Mask
 
ULONG Kd_DFRGIFC_Mask
 
ULONG Kd_DEFAULT_Mask
 
ULONG Kd_MM_Mask
 
ULONG Kd_DFSC_Mask
 
ULONG Kd_WOW64_Mask
 
ULONG Kd_ALPC_Mask
 
ULONG Kd_WDI_Mask
 
ULONG Kd_PERFLIB_Mask
 
ULONG Kd_KTM_Mask
 
ULONG Kd_IOSTRESS_Mask
 
ULONG Kd_HEAP_Mask
 
ULONG Kd_WHEA_Mask
 
ULONG Kd_USERGDI_Mask
 
ULONG Kd_MMCSS_Mask
 
ULONG Kd_TPM_Mask
 
ULONG Kd_THREADORDER_Mask
 
ULONG Kd_ENVIRON_Mask
 
ULONG Kd_EMS_Mask
 
ULONG Kd_WDT_Mask
 
ULONG Kd_FVEVOL_Mask
 
ULONG Kd_NDIS_Mask
 
ULONG Kd_NVCTRACE_Mask
 
ULONG Kd_LUAFV_Mask
 
ULONG Kd_APPCOMPAT_Mask
 
ULONG Kd_USBSTOR_Mask
 
ULONG Kd_SBP2PORT_Mask
 
ULONG Kd_COVERAGE_Mask
 
ULONG Kd_CACHEMGR_Mask
 
ULONG Kd_MOUNTMGR_Mask
 
ULONG Kd_CFR_Mask
 
ULONG Kd_TXF_Mask
 
ULONG Kd_KSECDD_Mask
 
ULONG Kd_FLTREGRESS_Mask
 
ULONG Kd_MPIO_Mask
 
ULONG Kd_MSDSM_Mask
 
ULONG Kd_UDFS_Mask
 
ULONG Kd_PSHED_Mask
 
ULONG Kd_STORVSP_Mask
 
ULONG Kd_LSASS_Mask
 
ULONG Kd_SSPICLI_Mask
 
ULONG Kd_CNG_Mask
 
ULONG Kd_EXFAT_Mask
 
ULONG Kd_FILETRACE_Mask
 
ULONG Kd_XSAVE_Mask
 
ULONG Kd_SE_Mask
 
ULONG Kd_DRIVEEXTENDER_Mask
 
ULONG Kd_POWER_Mask
 
ULONG Kd_CRASHDUMPXHCI_Mask
 
ULONG Kd_GPIO_Mask
 
ULONG Kd_REFS_Mask
 
ULONG Kd_WER_Mask
 
ULONG Kd_CAPIMG_Mask
 
ULONG Kd_VPCI_Mask
 
ULONG Kd_STORAGECLASSMEMORY_Mask
 
ULONG Kd_FSLIB_Mask
 

Macro Definition Documentation

◆ KD_BREAKPOINT_ACTIVE

#define KD_BREAKPOINT_ACTIVE   0x01

Definition at line 45 of file kd64.h.

◆ KD_BREAKPOINT_EXPIRED

#define KD_BREAKPOINT_EXPIRED   0x08

Definition at line 48 of file kd64.h.

◆ KD_BREAKPOINT_MAX

#define KD_BREAKPOINT_MAX   32

Definition at line 28 of file kd64.h.

◆ KD_BREAKPOINT_PENDING

#define KD_BREAKPOINT_PENDING   0x02

Definition at line 46 of file kd64.h.

◆ KD_BREAKPOINT_SUSPENDED

#define KD_BREAKPOINT_SUSPENDED   0x04

Definition at line 47 of file kd64.h.

◆ KD_DEFAULT_LOG_BUFFER_SIZE

#define KD_DEFAULT_LOG_BUFFER_SIZE   0x1000

Definition at line 17 of file kd64.h.

◆ KD_HIGHEST_USER_BREAKPOINT_ADDRESS

#define KD_HIGHEST_USER_BREAKPOINT_ADDRESS   (PVOID)0x60000000

Definition at line 40 of file kd64.h.

◆ KDP_MSG_BUFFER_SIZE

#define KDP_MSG_BUFFER_SIZE   0x1000

Definition at line 23 of file kd64.h.

◆ MAX_KD_COMPONENT_TABLE_ENTRIES

#define MAX_KD_COMPONENT_TABLE_ENTRIES   (DPFLTR_ENDOFTABLE_ID + 1)

Definition at line 587 of file kd64.h.

Typedef Documentation

◆ BREAKPOINT_ENTRY

◆ PBREAKPOINT_ENTRY

◆ PKDEBUG_ROUTINE

typedef BOOLEAN(NTAPI * PKDEBUG_ROUTINE) (IN PKTRAP_FRAME TrapFrame, IN PKEXCEPTION_FRAME ExceptionFrame, IN PEXCEPTION_RECORD ExceptionRecord, IN PCONTEXT Context, IN KPROCESSOR_MODE PreviousMode, IN BOOLEAN SecondChance)

Definition at line 65 of file kd64.h.

◆ PKDEBUG_SWITCH_ROUTINE

typedef BOOLEAN(NTAPI * PKDEBUG_SWITCH_ROUTINE) (IN PEXCEPTION_RECORD ExceptionRecord, IN PCONTEXT Context, IN BOOLEAN SecondChance)

Definition at line 76 of file kd64.h.

Function Documentation

◆ KdDisableDebuggerWithLock()

NTSTATUS NTAPI KdDisableDebuggerWithLock ( IN BOOLEAN  NeedLock)

Definition at line 2040 of file kdapi.c.

2041{
2042 KIRQL OldIrql;
2044
2045#if defined(__GNUC__)
2046 /* Make gcc happy */
2048#endif
2049
2050 /*
2051 * If enabling the debugger is blocked
2052 * then there is nothing to disable (duh)
2053 */
2054 if (KdBlockEnable)
2055 {
2056 /* Fail */
2057 return STATUS_ACCESS_DENIED;
2058 }
2059
2060 /* Check if we need to acquire the lock */
2061 if (NeedLock)
2062 {
2063 /* Lock the port */
2065 KdpPortLock();
2066 }
2067
2068 /* Check if we're not disabled */
2069 if (!KdDisableCount)
2070 {
2071 /* Check if the debugger was never actually initialized */
2073 {
2074 /* It wasn't, so don't re-enable it later */
2076 }
2077 else
2078 {
2079 /* It was, so we will re-enable it later */
2081 }
2082
2083 /* Check if we were called from the exported API and are enabled */
2084 if ((NeedLock) && (KdPreviouslyEnabled))
2085 {
2086 /* Check if it is safe to disable the debugger */
2088 if (!NT_SUCCESS(Status))
2089 {
2090 /* Release the lock and fail */
2091 KdpPortUnlock();
2093 return Status;
2094 }
2095 }
2096
2097 /* Only disable the debugger if it is enabled */
2099 {
2100 /*
2101 * Disable the debugger; suspend breakpoints
2102 * and reset the debug stub
2103 */
2106
2107 /* We are disabled now */
2109 SharedUserData->KdDebuggerEnabled = FALSE;
2110 }
2111 }
2112
2113 /* Increment the disable count */
2115
2116 /* Check if we had locked the port before */
2117 if (NeedLock)
2118 {
2119 /* Yes, now unlock it */
2120 KdpPortUnlock();
2122 }
2123
2124 /* We're done */
2125 return STATUS_SUCCESS;
2126}
LONG NTSTATUS
Definition: precomp.h:26
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define KeRaiseIrql(irql, oldIrql)
Definition: env_spec_w32.h:597
#define KeLowerIrql(oldIrql)
Definition: env_spec_w32.h:602
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
Status
Definition: gdiplustypes.h:25
BOOLEAN KdPreviouslyEnabled
Definition: kddata.c:87
BOOLEAN KdPitchDebugger
Definition: kddata.c:81
BOOLEAN KdBlockEnable
Definition: kddata.c:85
VOID NTAPI KdpPortLock(VOID)
Definition: kdlock.c:19
ULONG KdDisableCount
Definition: kddata.c:90
PKDEBUG_ROUTINE KiDebugRoutine
Definition: kddata.c:74
VOID NTAPI KdpPortUnlock(VOID)
Definition: kdlock.c:27
BOOLEAN NTAPI KdpStub(IN PKTRAP_FRAME TrapFrame, IN PKEXCEPTION_FRAME ExceptionFrame, IN PEXCEPTION_RECORD ExceptionRecord, IN PCONTEXT ContextRecord, IN KPROCESSOR_MODE PreviousMode, IN BOOLEAN SecondChanceException)
Definition: kdtrap.c:266
NTSTATUS NTAPI KdpAllowDisable(VOID)
Definition: kdx64.c:364
VOID NTAPI KdpSuspendAllBreakPoints(VOID)
Definition: kdbreak.c:407
BOOLEAN KdDebuggerEnabled
Definition: kddata.c:83
#define SharedUserData
#define STATUS_SUCCESS
Definition: shellext.h:65
#define STATUS_ACCESS_DENIED
Definition: udferr_usr.h:145
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:778

Referenced by KdDisableDebugger(), and KdInitSystem().

◆ KdEnableDebuggerWithLock()

NTSTATUS NTAPI KdEnableDebuggerWithLock ( IN BOOLEAN  NeedLock)

Definition at line 1964 of file kdapi.c.

1965{
1966 KIRQL OldIrql;
1967
1968#if defined(__GNUC__)
1969 /* Make gcc happy */
1971#endif
1972
1973 /* Check if enabling the debugger is blocked */
1974 if (KdBlockEnable)
1975 {
1976 /* It is, fail the enable */
1977 return STATUS_ACCESS_DENIED;
1978 }
1979
1980 /* Check if we need to acquire the lock */
1981 if (NeedLock)
1982 {
1983 /* Lock the port */
1985 KdpPortLock();
1986 }
1987
1988 /* Check if we're not disabled */
1989 if (!KdDisableCount)
1990 {
1991 /* Check if we had locked the port before */
1992 if (NeedLock)
1993 {
1994 /* Do the unlock */
1995 KdpPortUnlock();
1997
1998 /* Fail: We're already enabled */
2000 }
2001 else
2002 {
2003 /*
2004 * This can only happen if we are called from a bugcheck
2005 * and were never initialized, so initialize the debugger now.
2006 */
2007 KdInitSystem(0, NULL);
2008
2009 /* Return success since we initialized */
2010 return STATUS_SUCCESS;
2011 }
2012 }
2013
2014 /* Decrease the disable count */
2015 if (!(--KdDisableCount))
2016 {
2017 /* We're now enabled again! Were we enabled before, too? */
2019 {
2020 /* Reinitialize the Debugger */
2021 KdInitSystem(0, NULL);
2023 }
2024 }
2025
2026 /* Check if we had locked the port before */
2027 if (NeedLock)
2028 {
2029 /* Yes, now unlock it */
2030 KdpPortUnlock();
2032 }
2033
2034 /* We're done */
2035 return STATUS_SUCCESS;
2036}
#define NULL
Definition: types.h:112
BOOLEAN NTAPI KdInitSystem(_In_ ULONG BootPhase, _In_opt_ PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: kdinit.c:142
VOID NTAPI KdpRestoreAllBreakpoints(VOID)
Definition: kdbreak.c:368
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135

Referenced by KdEnableDebugger(), and KeBugCheckWithTf().

◆ KdEnterDebugger()

BOOLEAN NTAPI KdEnterDebugger ( IN PKTRAP_FRAME  TrapFrame,
IN PKEXCEPTION_FRAME  ExceptionFrame 
)

Definition at line 1876 of file kdapi.c.

1878{
1880
1881 /* Check if we have a trap frame */
1882 if (TrapFrame)
1883 {
1884 /* Calculate the time difference for the enter */
1888 }
1889 else
1890 {
1891 /* No trap frame, so can't calculate */
1893 }
1894
1895 /* Save the current IRQL */
1896 KeGetCurrentPrcb()->DebuggerSavedIRQL = KeGetCurrentIrql();
1897
1898 /* Freeze all CPUs, raising also the IRQL to HIGH_LEVEL */
1899 Enable = KeFreezeExecution(TrapFrame, ExceptionFrame);
1900
1901 /* Lock the port, save the state and set debugger entered */
1903 KdSave(FALSE);
1905
1906 /* Check freeze flag */
1907 if (KiFreezeFlag & 1)
1908 {
1909 /* Print out errror */
1910 KdpDprintf("FreezeLock was jammed! Backup SpinLock was used!\n");
1911 }
1912
1913 /* Check processor state */
1914 if (KiFreezeFlag & 2)
1915 {
1916 /* Print out errror */
1917 KdpDprintf("Some processors not frozen in debugger!\n");
1918 }
1919
1920 /* Make sure we acquired the port */
1921 if (!KdpPortLocked) KdpDprintf("Port lock was not acquired!\n");
1922
1923 /* Return if interrupts needs to be re-enabled */
1924 return Enable;
1925}
unsigned char BOOLEAN
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
LARGE_INTEGER KdTimerStop
Definition: kddata.c:122
BOOLEAN KdEnteredDebugger
Definition: kddata.c:89
LARGE_INTEGER KdTimerStart
Definition: kd64.h:562
KSPIN_LOCK KdpDebuggerLock
Definition: kddata.c:67
BOOLEAN KdpPortLocked
Definition: kddata.c:66
LARGE_INTEGER KdTimerDifference
Definition: kd64.h:562
LARGE_INTEGER NTAPI KdpQueryPerformanceCounter(IN PKTRAP_FRAME TrapFrame)
Definition: kdapi.c:1859
NTSTATUS NTAPI KdSave(IN BOOLEAN SleepTransition)
Definition: kdcom.c:113
#define KdpDprintf(...)
Definition: mmdbg.c:19
FORCEINLINE struct _KPRCB * KeGetCurrentPrcb(VOID)
Definition: ketypes.h:1148
_In_ ULONGLONG _In_ ULONGLONG _In_ BOOLEAN Enable
Definition: ntddpcm.h:142
ULONG KiFreezeFlag
Definition: freeze.c:20
BOOLEAN NTAPI KeFreezeExecution(IN PKTRAP_FRAME TrapFrame, IN PKEXCEPTION_FRAME ExceptionFrame)
Definition: freeze.c:26
BOOLEAN FASTCALL KeTryToAcquireSpinLockAtDpcLevel(IN OUT PKSPIN_LOCK SpinLock)
Definition: spinlock.c:309
LONGLONG QuadPart
Definition: typedefs.h:114

Referenced by KdpCommandString(), KdpPrint(), KdpPrompt(), KdpReport(), KdpSymbol(), KdRefreshDebuggerNotPresent(), and KdSetOwedBreakpoints().

◆ KdExitDebugger()

VOID NTAPI KdExitDebugger ( IN BOOLEAN  Enable)

Definition at line 1929 of file kdapi.c.

1930{
1931 ULONG TimeSlip;
1932
1933 /* Restore the state and unlock the port */
1936
1937 /* Unfreeze the CPUs, restoring also the IRQL */
1939
1940 /* Compare time with the one from KdEnterDebugger */
1941 if (!KdTimerStop.QuadPart)
1942 {
1943 /* We didn't get a trap frame earlier in so never got the time */
1945 }
1946 else
1947 {
1948 /* Query the timer */
1950 }
1951
1952 /* Check if a Time Slip was on queue */
1954 if (TimeSlip == 1)
1955 {
1956 /* Queue a DPC for the time slip */
1958 KeInsertQueueDpc(&KdpTimeSlipDpc, NULL, NULL); // FIXME: this can trigger context switches!
1959 }
1960}
#define InterlockedIncrement
Definition: armddk.h:53
BOOLEAN NTAPI KeInsertQueueDpc(IN PKDPC Dpc, IN PVOID SystemArgument1, IN PVOID SystemArgument2)
Definition: dpc.c:725
LARGE_INTEGER NTAPI KeQueryPerformanceCounter(IN PLARGE_INTEGER PerformanceFreq)
Definition: timer.c:138
LONG KdpTimeSlipPending
Definition: kddata.c:119
KDPC KdpTimeSlipDpc
Definition: kddata.c:116
NTSTATUS NTAPI KdRestore(IN BOOLEAN SleepTransition)
Definition: kdcom.c:121
VOID NTAPI KeThawExecution(IN BOOLEAN Enable)
Definition: freeze.c:64
uint32_t ULONG
Definition: typedefs.h:59

Referenced by KdpCommandString(), KdpPrint(), KdpPrompt(), KdpReport(), KdpSymbol(), KdRefreshDebuggerNotPresent(), and KdSetOwedBreakpoints().

◆ KdInitSystem()

BOOLEAN NTAPI KdInitSystem ( _In_ ULONG  BootPhase,
_In_opt_ PLOADER_PARAMETER_BLOCK  LoaderBlock 
)

Definition at line 142 of file kdinit.c.

145{
146 BOOLEAN EnableKd, DisableKdAfterInit = FALSE, BlockEnable;
147 PSTR CommandLine, DebugLine, DebugOptionStart, DebugOptionEnd;
149 PLDR_DATA_TABLE_ENTRY LdrEntry;
150 PLIST_ENTRY NextEntry;
151 ULONG i, j, Length;
152 SIZE_T DebugOptionLength;
153 SIZE_T MemSizeMBs;
154 CHAR NameBuffer[256];
155 PWCHAR Name;
156
157#if defined(__GNUC__)
158 /* Make gcc happy */
159 BlockEnable = FALSE;
160#endif
161
162 /* Check if this is Phase 1 */
163 if (BootPhase)
164 {
165 /* Just query the performance counter */
167 return TRUE;
168 }
169
170 /* Check if we already initialized once */
171 if (KdDebuggerEnabled) return TRUE;
172
173 /* Set the Debug Routine as the Stub for now */
175
176 /* Disable break after symbol load for now */
178
179 /* Check if the Debugger Data Block was already initialized */
181 {
182 /* It wasn't...Initialize the KD Data Listhead */
184
185 /* Register the Debugger Data Block */
188 sizeof(KdDebuggerDataBlock));
189
190 /* Fill out the KD Version Block */
193
194#ifdef CONFIG_SMP
195 /* This is an MP Build */
197#endif
198
199 /* Save Pointers to Loaded Module List and Debugger Data */
202
203 /* Set protocol limits */
208 KdVersionBlock.Unused[0] = 0;
209
210 /* Link us in the KPCR */
211 KeGetPcr()->KdVersionBlock = &KdVersionBlock;
212 }
213
214 /* Check if we have a loader block */
215 if (LoaderBlock)
216 {
217 /* Get the image entry */
218 LdrEntry = CONTAINING_RECORD(LoaderBlock->LoadOrderListHead.Flink,
220 InLoadOrderLinks);
221
222 /* Save the Kernel Base */
223 PsNtosImageBase = (ULONG_PTR)LdrEntry->DllBase;
225
226 /* Check if we have a command line */
227 CommandLine = LoaderBlock->LoadOptions;
228 if (CommandLine)
229 {
230 /* Upcase it */
231 _strupr(CommandLine);
232
233 /* Assume we'll disable KD */
234 EnableKd = FALSE;
235
236 /* Check for CRASHDEBUG, NODEBUG and just DEBUG */
237 if (strstr(CommandLine, "CRASHDEBUG"))
238 {
239 /* Don't enable KD now, but allow it to be enabled later */
241 }
242 else if (strstr(CommandLine, "NODEBUG"))
243 {
244 /* Don't enable KD and don't let it be enabled later */
246 }
247 else if ((DebugLine = strstr(CommandLine, "DEBUG")) != NULL)
248 {
249 /* Enable KD */
250 EnableKd = TRUE;
251
252 /* Check if there are any options */
253 if (DebugLine[5] == '=')
254 {
255 /* Save pointers */
256 DebugOptionStart = DebugOptionEnd = &DebugLine[6];
257
258 /* Scan the string for debug options */
259 for (;;)
260 {
261 /* Loop until we reach the end of the string */
262 while (*DebugOptionEnd != ANSI_NULL)
263 {
264 /* Check if this is a comma, a space or a tab */
265 if ((*DebugOptionEnd == ',') ||
266 (*DebugOptionEnd == ' ') ||
267 (*DebugOptionEnd == '\t'))
268 {
269 /*
270 * We reached the end of the option or
271 * the end of the string, break out
272 */
273 break;
274 }
275 else
276 {
277 /* Move on to the next character */
278 DebugOptionEnd++;
279 }
280 }
281
282 /* Calculate the length of the current option */
283 DebugOptionLength = (DebugOptionEnd - DebugOptionStart);
284
285 /*
286 * Break out if we reached the last option
287 * or if there were no options at all
288 */
289 if (!DebugOptionLength) break;
290
291 /* Now check which option this is */
292 if ((DebugOptionLength == 10) &&
293 !(strncmp(DebugOptionStart, "AUTOENABLE", 10)))
294 {
295 /*
296 * Disable the debugger, but
297 * allow it to be reenabled
298 */
299 DisableKdAfterInit = TRUE;
300 BlockEnable = FALSE;
302 }
303 else if ((DebugOptionLength == 7) &&
304 !(strncmp(DebugOptionStart, "DISABLE", 7)))
305 {
306 /* Disable the debugger */
307 DisableKdAfterInit = TRUE;
308 BlockEnable = TRUE;
310 }
311 else if ((DebugOptionLength == 6) &&
312 !(strncmp(DebugOptionStart, "NOUMEX", 6)))
313 {
314 /* Ignore user mode exceptions */
316 }
317
318 /*
319 * If there are more options then
320 * the next character should be a comma
321 */
322 if (*DebugOptionEnd != ',')
323 {
324 /* It isn't, break out */
325 break;
326 }
327
328 /* Move on to the next option */
329 DebugOptionEnd++;
330 DebugOptionStart = DebugOptionEnd;
331 }
332 }
333 }
334 }
335 else
336 {
337 /* No command line options? Disable debugger by default */
339 EnableKd = FALSE;
340 }
341 }
342 else
343 {
344 /* Called from a bugcheck or a re-enable. Save the Kernel Base. */
346
347 /* Unconditionally enable KD */
348 EnableKd = TRUE;
349 }
350
351 /* Set the Kernel Base in the Data Block */
353
354 /* Initialize the debugger if requested */
355 if (EnableKd && (NT_SUCCESS(KdDebuggerInitialize0(LoaderBlock))))
356 {
357 /* Now set our real KD routine */
359
360 /* Check if we've already initialized our structures */
362 {
363 /* Set the Debug Switch Routine and Retries */
366
367 /* Initialize breakpoints owed flag and table */
369 for (i = 0; i < KD_BREAKPOINT_MAX; i++)
370 {
374 }
375
376 /* Initialize the Time Slip DPC */
380
381 /* First-time initialization done! */
383 }
384
385 /* Initialize the timer */
387
388 /* Officially enable KD */
391
392 /* Let user-mode know that it's enabled as well */
393 SharedUserData->KdDebuggerEnabled = TRUE;
394
395 /* Display separator + ReactOS version at start of the debug log */
396 MemSizeMBs = KdpGetMemorySizeInMBs(KeLoaderBlock);
397 KdpPrintBanner(MemSizeMBs);
398
399 /* Check if the debugger should be disabled initially */
400 if (DisableKdAfterInit)
401 {
402 /* Disable it */
404
405 /*
406 * Save the enable block state and return initialized
407 * (the debugger is active but disabled).
408 */
409 KdBlockEnable = BlockEnable;
410 return TRUE;
411 }
412
413 /* Check if we have a loader block */
414 if (LoaderBlock)
415 {
416 /* Loop boot images */
417 NextEntry = LoaderBlock->LoadOrderListHead.Flink;
418 i = 0;
419 while ((NextEntry != &LoaderBlock->LoadOrderListHead) && (i < 2))
420 {
421 /* Get the image entry */
422 LdrEntry = CONTAINING_RECORD(NextEntry,
424 InLoadOrderLinks);
425
426 /* Generate the image name */
427 Name = LdrEntry->FullDllName.Buffer;
428 Length = LdrEntry->FullDllName.Length / sizeof(WCHAR);
429 j = 0;
430 do
431 {
432 /* Do cheap Unicode to ANSI conversion */
433 NameBuffer[j++] = (CHAR)*Name++;
434 } while (j < Length);
435
436 /* Null-terminate */
437 NameBuffer[j] = ANSI_NULL;
438
439 /* Load symbols for image */
440 RtlInitString(&ImageName, NameBuffer);
442 LdrEntry->DllBase,
444
445 /* Go to the next entry */
446 NextEntry = NextEntry->Flink;
447 i++;
448 }
449 }
450
451 /* Check for incoming breakin and break on symbol load if we have it */
453 }
454 else
455 {
456 /* Disable debugger */
458 }
459
460 /* Return initialized */
461 return TRUE;
462}
char * strstr(char *String1, char *String2)
Definition: utclib.c:653
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
Definition: utclib.c:534
struct NameRec_ * Name
Definition: cdprocs.h:460
#define CHAR(Char)
VOID NTAPI KeInitializeDpc(IN PKDPC Dpc, IN PKDEFERRED_ROUTINE DeferredRoutine, IN PVOID DeferredContext)
Definition: dpc.c:712
#define ULONG_PTR
Definition: config.h:101
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
std::wstring STRING
Definition: fontsub.cpp:33
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
Definition: glfuncs.h:248
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 GLint GLint j
Definition: glfuncs.h:250
BOOLEAN NTAPI KdpTrap(IN PKTRAP_FRAME TrapFrame, IN PKEXCEPTION_FRAME ExceptionFrame, IN PEXCEPTION_RECORD ExceptionRecord, IN PCONTEXT ContextRecord, IN KPROCESSOR_MODE PreviousMode, IN BOOLEAN SecondChanceException)
Definition: kdtrap.c:135
#define KD_BREAKPOINT_MAX
Definition: kd64.h:28
BREAKPOINT_ENTRY KdpBreakpointTable[KD_BREAKPOINT_MAX]
Definition: kddata.c:96
NTSTATUS NTAPI KdDisableDebuggerWithLock(IN BOOLEAN NeedLock)
Definition: kdapi.c:2040
LARGE_INTEGER KdPerformanceCounterRate
Definition: kddata.c:91
BOOLEAN KdBreakAfterSymbolLoad
Definition: kddata.c:80
BOOLEAN NTAPI KdpSwitchProcessor(IN PEXCEPTION_RECORD ExceptionRecord, IN OUT PCONTEXT ContextRecord, IN BOOLEAN SecondChanceException)
Definition: kdapi.c:1838
DBGKD_GET_VERSION64 KdVersionBlock
Definition: kddata.c:496
VOID NTAPI KdpTimeSlipWork(IN PVOID Context)
Definition: kdapi.c:1816
BOOLEAN KdIgnoreUmExceptions
Definition: kddata.c:86
PKDEBUG_SWITCH_ROUTINE KiDebugSwitchRoutine
Definition: kddata.c:75
WORK_QUEUE_ITEM KdpTimeSlipWorkItem
Definition: kddata.c:118
KD_CONTEXT KdpContext
Definition: kddata.c:65
LIST_ENTRY KdpDebuggerDataListHead
Definition: kddata.c:490
BOOLEAN KdpDebuggerStructuresInitialized
Definition: kddata.c:88
VOID NTAPI KdpTimeSlipDpcRoutine(IN PKDPC Dpc, IN PVOID DeferredContext, IN PVOID SystemArgument1, IN PVOID SystemArgument2)
Definition: kdapi.c:1790
BOOLEAN KdpOweBreakpoint
Definition: kddata.c:98
KTIMER KdpTimeSlipTimer
Definition: kddata.c:117
BOOLEAN KdAutoEnableOnEvent
Definition: kddata.c:84
NTSTATUS NTAPI KdDebuggerInitialize0(IN PLOADER_PARAMETER_BLOCK LoaderBlock OPTIONAL)
Definition: kdcom.c:158
BOOLEAN KdDebuggerNotPresent
Definition: kddata.c:82
KDDEBUGGER_DATA64 * KdDebuggerDataBlock
Definition: kdpacket.c:21
BOOLEAN NTAPI KdRegisterDebuggerDataBlock(IN ULONG Tag, IN PDBGKD_DEBUG_DATA_HEADER64 DataHeader, IN ULONG Size)
Definition: kdinit.c:98
BOOLEAN NTAPI KdPollBreakIn(VOID)
Definition: kdlock.c:75
PLOADER_PARAMETER_BLOCK KeLoaderBlock
Definition: krnlinit.c:29
if(dx< 0)
Definition: linetemp.h:194
unsigned __int64 ULONG64
Definition: imports.h:198
static const char * ImageName
Definition: image.c:34
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define KeGetPcr()
Definition: ketypes.h:81
VOID NTAPI DbgLoadImageSymbols(_In_ PSTRING Name, _In_ PVOID Base, _In_ ULONG_PTR ProcessId)
NTSYSAPI VOID NTAPI RtlInitString(PSTRING DestinationString, PCSZ SourceString)
#define ANSI_NULL
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
HANDLE NTAPI PsGetCurrentProcessId(VOID)
Definition: process.c:1123
unsigned short USHORT
Definition: pedump.c:61
LIST_ENTRY PsLoadedModuleList
Definition: sysldr.c:21
ULONG_PTR PsNtosImageBase
Definition: sysldr.c:25
_CRTIMP char *__cdecl _strupr(_Inout_z_ char *_String)
#define DBGKD_VERS_FLAG_MP
Definition: wdbgexts.h:27
#define KDBG_TAG
Definition: wdbgexts.h:34
@ DBGKD_MAJOR_NT
Definition: wdbgexts.h:38
ULONG NtBuildNumber
Definition: init.c:50
ULONG_PTR DirectoryTableBase
Definition: kd64.h:56
ULONG Flags
Definition: kd64.h:55
PVOID Address
Definition: kd64.h:57
ULONG64 DebuggerDataList
Definition: wdbgexts.h:167
ULONG64 PsLoadedModuleList
Definition: wdbgexts.h:166
USHORT Unused[1]
Definition: wdbgexts.h:164
DBGKD_DEBUG_DATA_HEADER64 Header
Definition: wdbgexts.h:192
ULONG64 KernBase
Definition: wdbgexts.h:193
ULONG KdpDefaultRetries
Definition: windbgkd.h:226
Definition: btrfs_drv.h:1876
UNICODE_STRING FullDllName
Definition: btrfs_drv.h:1882
PVOID DllBase
Definition: btrfs_drv.h:1880
Definition: typedefs.h:120
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
VOID NTAPI KeInitializeTimer(OUT PKTIMER Timer)
Definition: timerobj.c:233
#define LONG_PTR
Definition: treelist.c:79
char * PSTR
Definition: typedefs.h:51
ULONG_PTR SIZE_T
Definition: typedefs.h:80
uint32_t ULONG_PTR
Definition: typedefs.h:65
uint16_t * PWCHAR
Definition: typedefs.h:56
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
#define DbgKdMaximumStateChange
Definition: windbgkd.h:62
#define DbgKdMinimumStateChange
Definition: windbgkd.h:58
#define DbgKdMaximumManipulate
Definition: windbgkd.h:117
#define DbgKdMinimumManipulate
Definition: windbgkd.h:73
#define ExInitializeWorkItem(Item, Routine, Context)
Definition: exfuncs.h:265
__wchar_t WCHAR
Definition: xmlstorage.h:180
char CHAR
Definition: xmlstorage.h:175

Referenced by KdEnableDebuggerWithLock(), KeEnterKernelDebugger(), KiInitializeSystem(), KiSystemStartup(), and Phase1InitializationDiscard().

◆ KdIsThisAKdTrap()

BOOLEAN NTAPI KdIsThisAKdTrap ( IN PEXCEPTION_RECORD  ExceptionRecord,
IN PCONTEXT  Context,
IN KPROCESSOR_MODE  PreviousMode 
)

Definition at line 317 of file kdtrap.c.

320{
321#ifdef _WINKD_
322 /*
323 * Determine if this is a valid debug service call and make sure that
324 * it isn't a software breakpoint
325 */
326 if ((ExceptionRecord->ExceptionCode == STATUS_BREAKPOINT) &&
327 (ExceptionRecord->NumberParameters > 0) &&
328 (ExceptionRecord->ExceptionInformation[0] != BREAKPOINT_BREAK))
329 {
330 /* Then we have to handle it */
331 return TRUE;
332 }
333 else
334 {
335 /* We don't have to handle it */
336 return FALSE;
337 }
338#else
339 /* KDBG has its own mechanism for ignoring user mode exceptions */
340 return FALSE;
341#endif
342}
#define BREAKPOINT_BREAK
Definition: kdtypes.h:50
#define STATUS_BREAKPOINT
Definition: ntstatus.h:184

Referenced by KiDispatchException().

◆ KdLogDbgPrint()

VOID NTAPI KdLogDbgPrint ( _In_ PSTRING  String)

Definition at line 63 of file kdprint.c.

65{
66 SIZE_T Length, Remaining;
68
69 /* If the string is empty, bail out */
70 if (!String->Buffer || (String->Length == 0))
71 return;
72
73 /* If no log buffer available, bail out */
74 if (!KdPrintCircularBuffer /*|| (KdPrintBufferSize == 0)*/)
75 return;
76
77 /* Acquire the log spinlock without waiting at raised IRQL */
79
82
83 if (Length < Remaining)
84 {
87 }
88 else
89 {
90 KdpMoveMemory(KdPrintWritePointer, String->Buffer, Remaining);
91 Length -= Remaining;
92 if (Length > 0)
93 KdpMoveMemory(KdPrintCircularBuffer, String->Buffer + Remaining, Length);
94
96
97 /* Got a rollover, update count (handle wrapping, must always be >= 1) */
99 if (KdPrintRolloverCount == 0)
101 }
102
103 /* Release the spinlock */
105}
ULONG KdPrintBufferSize
Definition: kddata.c:137
ULONG KdPrintRolloverCount
Definition: kddata.c:135
KSPIN_LOCK KdpPrintSpinLock
Definition: kddata.c:139
PCHAR KdPrintWritePointer
Definition: kddata.c:134
VOID NTAPI KdpMoveMemory(_In_ PVOID Destination, _In_ PVOID Source, _In_ SIZE_T Length)
Definition: kdapi.c:27
PCHAR KdPrintCircularBuffer
Definition: kddata.c:136
KIRQL NTAPI KdpAcquireLock(_In_ PKSPIN_LOCK SpinLock)
Definition: kdprint.c:22
VOID NTAPI KdpReleaseLock(_In_ PKSPIN_LOCK SpinLock, _In_ KIRQL OldIrql)
Definition: kdprint.c:49
#define min(a, b)
Definition: monoChain.cc:55
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
Definition: wdfdevice.h:2433

Referenced by KdpPrint(), and KdpPrompt().

◆ KdpAddBreakpoint()

ULONG NTAPI KdpAddBreakpoint ( IN PVOID  Address)

Definition at line 20 of file kdbreak.c.

21{
22 KD_BREAKPOINT_TYPE Content;
23 ULONG i;
25
26 /* Check whether we are not setting a breakpoint twice */
27 for (i = 0; i < KD_BREAKPOINT_MAX; i++)
28 {
29 /* Check if the breakpoint is valid */
32 {
33 /* Were we not able to remove it earlier? */
35 {
36 /* Just re-use it! */
37 KdpBreakpointTable[i].Flags &= ~KD_BREAKPOINT_EXPIRED;
38 return i + 1;
39 }
40 else
41 {
42 /* Fail */
43 return 0;
44 }
45 }
46 }
47
48 /* Find a free entry */
49 for (i = 0; i < KD_BREAKPOINT_MAX; i++)
50 {
51 if (KdpBreakpointTable[i].Flags == 0)
52 break;
53 }
54
55 /* Fail if no free entry was found */
56 if (i == KD_BREAKPOINT_MAX) return 0;
57
58 /* Save the breakpoint */
60
61 /* If we are setting the breakpoint in user space, save the active process context */
63 KdpBreakpointTable[i].DirectoryTableBase = KeGetCurrentThread()->ApcState.Process->DirectoryTableBase[0];
64
65 /* Try to save the old instruction */
67 &Content,
69 0,
71 NULL);
72 if (NT_SUCCESS(Status))
73 {
74 /* Memory accessible, set the breakpoint */
75 KdpBreakpointTable[i].Content = Content;
77
78 /* Write the breakpoint */
82 0,
84 NULL);
85 if (!NT_SUCCESS(Status))
86 {
87 /* This should never happen */
88 KdpDprintf("Unable to write breakpoint to address 0x%p\n", Address);
89 }
90 }
91 else
92 {
93 /* Memory is inaccessible now, setting breakpoint is deferred */
94 KdpDprintf("Failed to set breakpoint at address 0x%p, adding deferred breakpoint.\n", Address);
97 }
98
99 /* Return the breakpoint handle */
100 return i + 1;
101}
#define KeGetCurrentThread
Definition: hal.h:55
#define KD_BREAKPOINT_EXPIRED
Definition: kd64.h:48
KD_BREAKPOINT_TYPE KdpBreakpointInstruction
Definition: kddata.c:97
#define KD_BREAKPOINT_ACTIVE
Definition: kd64.h:45
#define KD_BREAKPOINT_PENDING
Definition: kd64.h:46
NTSTATUS NTAPI KdpCopyMemoryChunks(_In_ ULONG64 Address, _In_ PVOID Buffer, _In_ ULONG TotalSize, _In_ ULONG ChunkSize, _In_ ULONG Flags, _Out_opt_ PULONG ActualSize)
Definition: kdapi.c:55
#define KD_HIGHEST_USER_BREAKPOINT_ADDRESS
Definition: kd64.h:40
#define KD_BREAKPOINT_TYPE
Definition: ke.h:121
#define KD_BREAKPOINT_SIZE
Definition: ke.h:122
#define MMDBG_COPY_UNSAFE
Definition: mm.h:77
#define MMDBG_COPY_WRITE
Definition: mm.h:75
static WCHAR Address[46]
Definition: ping.c:68
KD_BREAKPOINT_TYPE Content
Definition: kd64.h:58
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170

Referenced by KdpWriteBreakpoint().

◆ KdpAllowDisable()

NTSTATUS NTAPI KdpAllowDisable ( VOID  )

Definition at line 364 of file kdx64.c.

365{
368}
#define UNIMPLEMENTED_DBGBREAK(...)
Definition: debug.h:57

Referenced by KdDisableDebuggerWithLock().

◆ KdpCommandString()

VOID NTAPI KdpCommandString ( IN PSTRING  NameString,
IN PSTRING  CommandString,
IN KPROCESSOR_MODE  PreviousMode,
IN PCONTEXT  ContextRecord,
IN PKTRAP_FRAME  TrapFrame,
IN PKEXCEPTION_FRAME  ExceptionFrame 
)

Definition at line 224 of file kdprint.c.

230{
232 PKPRCB Prcb = KeGetCurrentPrcb();
233
234 /* Check if we need to do anything */
235 if ((PreviousMode != KernelMode) || (KdDebuggerNotPresent)) return;
236
237 /* Enter the debugger */
238 Enable = KdEnterDebugger(TrapFrame, ExceptionFrame);
239
240 /* Save the CPU Control State and save the context */
244 sizeof(CONTEXT));
245
246 /* Send the command string to the debugger */
248 CommandString,
250
251 /* Restore the processor state */
254 sizeof(CONTEXT));
256
257 /* Exit the debugger and return */
259}
VOID NTAPI KdpReportCommandStringStateChange(IN PSTRING NameString, IN PSTRING CommandString, IN OUT PCONTEXT Context)
Definition: kdapi.c:1658
BOOLEAN NTAPI KdEnterDebugger(IN PKTRAP_FRAME TrapFrame, IN PKEXCEPTION_FRAME ExceptionFrame)
Definition: kdapi.c:1876
VOID NTAPI KdExitDebugger(IN BOOLEAN Enable)
Definition: kdapi.c:1929
#define KernelMode
Definition: asm.h:34
_IRQL_requires_same_ _In_ PVOID _Inout_ struct _CONTEXT * ContextRecord
Definition: ntbasedef.h:654
VOID NTAPI KiRestoreProcessorControlState(IN PKPROCESSOR_STATE ProcessorState)
VOID NTAPI KiSaveProcessorControlState(OUT PKPROCESSOR_STATE ProcessorState)
Definition: cpu.c:576
KPROCESSOR_STATE ProcessorState
Definition: ketypes.h:649
CONTEXT ContextFrame
Definition: ketypes.h:601
_In_ KPROCESSOR_MODE PreviousMode
Definition: sefuncs.h:103

Referenced by KdpTrap().

◆ KdpCopyMemoryChunks()

NTSTATUS NTAPI KdpCopyMemoryChunks ( _In_ ULONG64  Address,
_In_ PVOID  Buffer,
_In_ ULONG  TotalSize,
_In_ ULONG  ChunkSize,
_In_ ULONG  Flags,
_Out_opt_ PULONG  ActualSize 
)

Definition at line 55 of file kdapi.c.

62{
64 ULONG RemainingLength, CopyChunk;
65
66 /* Check if we didn't get a chunk size or if it is too big */
67 if (ChunkSize == 0)
68 {
69 /* Default to 4 byte chunks */
70 ChunkSize = 4;
71 }
73 {
74 /* Normalize to maximum size */
76 }
77
78 /* Copy the whole range in aligned chunks */
79 RemainingLength = TotalSize;
80 CopyChunk = 1;
81 while (RemainingLength > 0)
82 {
83 /*
84 * Determine the best chunk size for this round.
85 * The ideal size is aligned, isn't larger than the
86 * the remaining length and respects the chunk limit.
87 */
88 while (((CopyChunk * 2) <= RemainingLength) &&
89 (CopyChunk < ChunkSize) &&
90 ((Address & ((CopyChunk * 2) - 1)) == 0))
91 {
92 /* Increase it */
93 CopyChunk *= 2;
94 }
95
96 /*
97 * The chunk size can be larger than the remaining size if this
98 * isn't the first round, so check if we need to shrink it back.
99 */
100 while (CopyChunk > RemainingLength)
101 {
102 /* Shrink it */
103 CopyChunk /= 2;
104 }
105
106 /* Do the copy */
107 Status = MmDbgCopyMemory(Address, Buffer, CopyChunk, Flags);
108 if (!NT_SUCCESS(Status))
109 {
110 /* Copy failed, break out */
111 break;
112 }
113
114 /* Update pointers and length for the next run */
115 Address = Address + CopyChunk;
116 Buffer = (PVOID)((ULONG_PTR)Buffer + CopyChunk);
117 RemainingLength = RemainingLength - CopyChunk;
118 }
119
120 /* We may have modified executable code, flush the instruction cache */
121 KeSweepICache((PVOID)(ULONG_PTR)Address, TotalSize);
122
123 /*
124 * Return the size we managed to copy and return
125 * success if we could copy the whole range.
126 */
127 if (ActualSize) *ActualSize = TotalSize - RemainingLength;
128 return RemainingLength == 0 ? STATUS_SUCCESS : STATUS_UNSUCCESSFUL;
129}
Definition: bufpool.h:45
FORCEINLINE VOID KeSweepICache(IN PVOID BaseAddress, IN SIZE_T FlushSize)
Definition: ke.h:280
#define MMDBG_COPY_MAX_SIZE
Definition: mm.h:85
NTSTATUS NTAPI MmDbgCopyMemory(IN ULONG64 Address, IN PVOID Buffer, IN ULONG Size, IN ULONG Flags)
Definition: mmdbg.c:124
void * PVOID
Definition: typedefs.h:50
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
_Inout_ PUCHAR _In_ PUCHAR _Out_ PUCHAR _Out_ PULONG ChunkSize
Definition: rtlfuncs.h:2277

Referenced by KdbpSafeReadMemory(), KdbpSafeWriteMemory(), KdpAddBreakpoint(), KdpLowRestoreBreakpoint(), KdpLowWriteContent(), KdpReadPhysicalMemory(), KdpReadVirtualMemory(), KdpReportCommandStringStateChange(), KdpReportLoadSymbolsStateChange(), KdpSetCommonState(), KdpSysReadControlSpace(), KdpSysWriteControlSpace(), KdpWritePhysicalMemory(), KdpWriteVirtualMemory(), and KdSetOwedBreakpoints().

◆ KdpDeleteBreakpoint()

BOOLEAN NTAPI KdpDeleteBreakpoint ( IN ULONG  BpEntry)

Definition at line 311 of file kdbreak.c.

312{
313 ULONG BpIndex = BpEntry - 1;
314
315 /* Check for invalid breakpoint entry */
316 if (!BpEntry || (BpEntry > KD_BREAKPOINT_MAX)) return FALSE;
317
318 /* If the specified breakpoint table entry is not valid, then return FALSE. */
319 if (!KdpBreakpointTable[BpIndex].Flags) return FALSE;
320
321 /* Check if the breakpoint is suspended */
323 {
324 /* Check if breakpoint is not being deleted */
326 {
327 /* Invalidate it and return success */
328 KdpBreakpointTable[BpIndex].Flags = 0;
329 return TRUE;
330 }
331 }
332
333 /* Restore original data, then invalidate it and return success */
334 if (KdpLowWriteContent(BpIndex)) KdpBreakpointTable[BpIndex].Flags = 0;
335 return TRUE;
336}
#define KD_BREAKPOINT_SUSPENDED
Definition: kd64.h:47
BOOLEAN NTAPI KdpLowWriteContent(IN ULONG BpIndex)
Definition: kdbreak.c:226

Referenced by KdpDeleteBreakpointRange(), and KdpRestoreBreakpoint().

◆ KdpDeleteBreakpointRange()

BOOLEAN NTAPI KdpDeleteBreakpointRange ( IN PVOID  Base,
IN PVOID  Limit 
)

Definition at line 340 of file kdbreak.c.

342{
343 ULONG BpIndex;
344 BOOLEAN DeletedBreakpoints;
345
346 /* Assume no breakpoints will be deleted */
347 DeletedBreakpoints = FALSE;
348
349 /* Loop the breakpoint table */
350 for (BpIndex = 0; BpIndex < KD_BREAKPOINT_MAX; BpIndex++)
351 {
352 /* Make sure that the breakpoint is active and matches the range. */
354 ((KdpBreakpointTable[BpIndex].Address >= Base) &&
355 (KdpBreakpointTable[BpIndex].Address <= Limit)))
356 {
357 /* Delete it, and remember if we succeeded at least once */
358 if (KdpDeleteBreakpoint(BpIndex + 1)) DeletedBreakpoints = TRUE;
359 }
360 }
361
362 /* Return whether we deleted anything */
363 return DeletedBreakpoints;
364}
BOOLEAN NTAPI KdpDeleteBreakpoint(IN ULONG BpEntry)
Definition: kdbreak.c:311
_In_opt_ ULONG Base
Definition: rtlfuncs.h:2439
_In_ LONG _In_ LONG Limit
Definition: kefuncs.h:304

Referenced by KdpSetCommonState().

◆ KdpDprintf()

VOID __cdecl KdpDprintf ( _In_ PCSTR  Format,
  ... 
)

Definition at line 528 of file kdprint.c.

531{
534 va_list ap;
535 CHAR Buffer[512];
536
537 /* Format the string */
540 sizeof(Buffer),
541 Format,
542 ap);
543 va_end(ap);
544
545 /* Set it up */
546 String.Buffer = Buffer;
547 String.Length = String.MaximumLength = Length;
548
549 /* Send it to the debugger directly */
551}
char * va_list
Definition: acmsvcex.h:78
#define va_end(ap)
Definition: acmsvcex.h:90
#define va_start(ap, A)
Definition: acmsvcex.h:91
BOOLEAN NTAPI KdpPrintString(_In_ PSTRING Output)
Definition: kdprint.c:109
void int int ULONGLONG int va_list * ap
Definition: winesup.h:36
#define _vsnprintf
Definition: xmlstorage.h:202

◆ KdpGetStateChange()

VOID NTAPI KdpGetStateChange ( IN PDBGKD_MANIPULATE_STATE64  State,
IN PCONTEXT  Context 
)

Definition at line 22 of file kdx64.c.

24{
25 PKPRCB Prcb;
26 ULONG i;
27
28 /* Check for success */
29 if (NT_SUCCESS(State->u.Continue2.ContinueStatus))
30 {
31 /* Check if we're tracing */
32 if (State->u.Continue2.ControlSet.TraceFlag)
33 {
34 /* Enable TF */
35 Context->EFlags |= EFLAGS_TF;
36 }
37 else
38 {
39 /* Remove it */
40 Context->EFlags &= ~EFLAGS_TF;
41 }
42
43 /* Loop all processors */
44 for (i = 0; i < KeNumberProcessors; i++)
45 {
46 /* Get the PRCB and update DR7 and DR6 */
47 Prcb = KiProcessorBlock[i];
49 State->u.Continue2.ControlSet.Dr7;
51 }
52
53 /* Check if we have new symbol information */
54 if (State->u.Continue2.ControlSet.CurrentSymbolStart != 1)
55 {
56 /* Update it */
58 State->u.Continue2.ControlSet.CurrentSymbolStart;
59 KdpCurrentSymbolEnd= State->u.Continue2.ControlSet.CurrentSymbolEnd;
60 }
61 }
62}
ULONG_PTR KdpCurrentSymbolEnd
Definition: kd64.h:580
ULONG_PTR KdpCurrentSymbolStart
Definition: kddata.c:105
CCHAR KeNumberProcessors
Definition: krnlinit.c:35
#define EFLAGS_TF
Definition: ketypes.h:186
PKPRCB KiProcessorBlock[]
Definition: krnlinit.c:32
KSPECIAL_REGISTERS SpecialRegisters
Definition: ketypes.h:600
ULONG64 KernelDr7
Definition: ketypes.h:575
ULONG64 KernelDr6
Definition: ketypes.h:574

Referenced by KdpSendWaitContinue().

◆ KdpMoveMemory()

VOID NTAPI KdpMoveMemory ( _In_ PVOID  Destination,
_In_ PVOID  Source,
_In_ SIZE_T  Length 
)

Definition at line 27 of file kdapi.c.

31{
32 PCHAR DestinationBytes, SourceBytes;
33
34 /* Copy the buffers 1 byte at a time */
35 DestinationBytes = Destination;
36 SourceBytes = Source;
37 while (Length--) *DestinationBytes++ = *SourceBytes++;
38}
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3169
_In_ PUNICODE_STRING _Inout_ PUNICODE_STRING Destination
Definition: rtlfuncs.h:3004
char * PCHAR
Definition: typedefs.h:51

Referenced by KdLogDbgPrint(), KdpCommandString(), KdpGetContext(), KdpGetContextEx(), KdpPrintFromUser(), KdpPrintString(), KdpPrompt(), KdpPromptString(), KdpReport(), KdpReportExceptionStateChange(), KdpSetContext(), KdpSetContextEx(), KdpSymbol(), and KdpSysGetVersion().

◆ KdpPollBreakInWithPortLock()

BOOLEAN NTAPI KdpPollBreakInWithPortLock ( VOID  )

Definition at line 35 of file kdlock.c.

36{
37 BOOLEAN DoBreak = FALSE;
38
39 /* First make sure that KD is enabled */
41 {
42 /* Check if a CTRL-C is in the queue */
44 {
45 /* Set it and prepare for break */
46 DoBreak = TRUE;
48 }
49 else
50 {
51 /* Now get a packet */
53 NULL,
54 NULL,
55 NULL,
57 {
58 /* Successful breakin */
59 DoBreak = TRUE;
60 }
61 }
62 }
63
64 /* Tell the caller to do a break */
65 return DoBreak;
66}
KDP_STATUS NTAPI KdReceivePacket(IN ULONG PacketType, OUT PSTRING MessageHeader, OUT PSTRING MessageData, OUT PULONG DataLength, IN OUT PKD_CONTEXT KdContext)
Definition: kddll.c:80
#define KdPacketReceived
Definition: kddll.h:5
BOOLEAN KdpControlCPending
Definition: windbgkd.h:227
#define PACKET_TYPE_KD_POLL_BREAKIN
Definition: windbgkd.h:49

Referenced by KdpPrintString().

◆ KdpPortLock()

VOID NTAPI KdpPortLock ( VOID  )

Definition at line 19 of file kdlock.c.

20{
21 /* Acquire the lock */
23}
VOID FASTCALL KiAcquireSpinLock(IN PKSPIN_LOCK SpinLock)
Definition: spinlock.c:287

Referenced by KdDisableDebuggerWithLock(), and KdEnableDebuggerWithLock().

◆ KdpPortUnlock()

VOID NTAPI KdpPortUnlock ( VOID  )

Definition at line 27 of file kdlock.c.

28{
29 /* Release the lock */
31}
VOID FASTCALL KiReleaseSpinLock(IN PKSPIN_LOCK SpinLock)
Definition: spinlock.c:298

Referenced by KdDisableDebuggerWithLock(), KdEnableDebuggerWithLock(), KdExitDebugger(), and KdPollBreakIn().

◆ KdpPrint()

NTSTATUS NTAPI KdpPrint ( _In_ ULONG  ComponentId,
_In_ ULONG  Level,
_In_reads_bytes_(Length) PCHAR  String,
_In_ USHORT  Length,
_In_ KPROCESSOR_MODE  PreviousMode,
_In_ PKTRAP_FRAME  TrapFrame,
_In_ PKEXCEPTION_FRAME  ExceptionFrame,
_Out_ PBOOLEAN  Handled 
)

Definition at line 445 of file kdprint.c.

454{
457 STRING OutputString;
458
460 {
461 /* Mask validation failed */
462 *Handled = TRUE;
463 return STATUS_SUCCESS;
464 }
465
466 /* Assume failure */
467 *Handled = FALSE;
468
469 /* Normalize the length */
471
472 /* Check if we need to verify the string */
474 {
475 /* This case requires a 512 byte stack buffer.
476 * We don't want to use that much stack in the kernel case, but we
477 * can't use _alloca due to PSEH. So the buffer exists in this
478 * helper function instead.
479 */
481 Level,
482 String,
483 Length,
485 TrapFrame,
486 ExceptionFrame,
487 Handled);
488 }
489
490 /* Setup the output string */
491 OutputString.Buffer = String;
492 OutputString.Length = OutputString.MaximumLength = Length;
493
494 /* Log the print */
495 KdLogDbgPrint(&OutputString);
496
497 /* Check for a debugger */
499 {
500 /* Fail */
501 *Handled = TRUE;
503 }
504
505 /* Enter the debugger */
506 Enable = KdEnterDebugger(TrapFrame, ExceptionFrame);
507
508 /* Print the string */
509 if (KdpPrintString(&OutputString))
510 {
511 /* User pressed CTRL-C, breakpoint on return */
513 }
514 else
515 {
516 /* String was printed */
518 }
519
520 /* Exit the debugger and return */
522 *Handled = TRUE;
523 return Status;
524}
ACPI_BUFFER *RetBuffer ACPI_BUFFER *RetBuffer char ACPI_WALK_RESOURCE_CALLBACK void *Context ACPI_BUFFER *RetBuffer UINT16 ACPI_RESOURCE **ResourcePtr ACPI_GENERIC_ADDRESS *Reg UINT32 *ReturnValue UINT8 UINT8 *Slp_TypB ACPI_PHYSICAL_ADDRESS PhysicalAddress64 UINT32 UINT32 *TimeElapsed UINT32 ACPI_STATUS const char UINT32 ACPI_STATUS const char UINT32 const char const char UINT32 ComponentId
Definition: acpixf.h:1281
NTSTATUS NTAPI NtQueryDebugFilterState(_In_ ULONG ComponentId, _In_ ULONG Level)
Definition: kdapi.c:2357
#define KD_PRINT_MAX_BYTES
Definition: kdprint.c:16
VOID NTAPI KdLogDbgPrint(_In_ PSTRING String)
Definition: kdprint.c:63
static NTSTATUS NTAPI KdpPrintFromUser(_In_ ULONG ComponentId, _In_ ULONG Level, _In_reads_bytes_(Length) PCHAR String, _In_ USHORT Length, _In_ KPROCESSOR_MODE PreviousMode, _In_ PKTRAP_FRAME TrapFrame, _In_ PKEXCEPTION_FRAME ExceptionFrame, _Out_ PBOOLEAN Handled)
Definition: kdprint.c:402
#define STATUS_DEVICE_NOT_CONNECTED
Definition: udferr_usr.h:160
_IRQL_requires_same_ typedef _In_ ULONG _In_ UCHAR Level
Definition: wmitypes.h:56
_In_ BOOLEAN Handled
Definition: ketypes.h:349

Referenced by KdpPrintFromUser(), and KdpTrap().

◆ KdpPrintString()

BOOLEAN NTAPI KdpPrintString ( _In_ PSTRING  Output)

Definition at line 109 of file kdprint.c.

111{
113 DBGKD_DEBUG_IO DebugIo;
115
116 /* Copy the string */
118 Output->Buffer,
119 Output->Length);
120
121 /* Make sure we don't exceed the KD Packet size */
122 Length = Output->Length;
123 if ((sizeof(DBGKD_DEBUG_IO) + Length) > PACKET_MAX_SIZE)
124 {
125 /* Normalize length */
127 }
128
129 /* Build the packet header */
132 DebugIo.Processor = KeGetCurrentPrcb()->Number;
134 Header.Length = sizeof(DBGKD_DEBUG_IO);
135 Header.Buffer = (PCHAR)&DebugIo;
136
137 /* Build the data */
138 Data.Length = Length;
139 Data.Buffer = KdpMessageBuffer;
140
141 /* Send the packet */
143
144 /* Check if the user pressed CTRL+C */
146}
Definition: Header.h:9
BOOLEAN NTAPI KdpPollBreakInWithPortLock(VOID)
Definition: kdlock.c:35
CHAR KdpMessageBuffer[KDP_MSG_BUFFER_SIZE]
Definition: kddata.c:127
VOID NTAPI KdSendPacket(IN ULONG PacketType, IN PSTRING MessageHeader, IN PSTRING MessageData, IN OUT PKD_CONTEXT KdContext)
Definition: kddll.c:314
#define PCHAR
Definition: match.c:90
USHORT KeProcessorLevel
Definition: krnlinit.c:20
@ Output
Definition: arc.h:85
union _DBGKD_DEBUG_IO::@3541 u
ULONG ApiNumber
Definition: windbgkd.h:421
USHORT Processor
Definition: windbgkd.h:423
USHORT ProcessorLevel
Definition: windbgkd.h:422
DBGKD_PRINT_STRING PrintString
Definition: windbgkd.h:426
#define DbgKdPrintStringApi
Definition: windbgkd.h:122
#define PACKET_MAX_SIZE
Definition: windbgkd.h:18
struct _DBGKD_DEBUG_IO DBGKD_DEBUG_IO
#define PACKET_TYPE_KD_DEBUG_IO
Definition: windbgkd.h:44

Referenced by KdpDprintf(), and KdpPrint().

◆ KdpPrompt()

USHORT NTAPI KdpPrompt ( _In_reads_bytes_(PromptLength) PCHAR  PromptString,
_In_ USHORT  PromptLength,
_Out_writes_bytes_(MaximumResponseLength) PCHAR  ResponseString,
_In_ USHORT  MaximumResponseLength,
_In_ KPROCESSOR_MODE  PreviousMode,
_In_ PKTRAP_FRAME  TrapFrame,
_In_ PKEXCEPTION_FRAME  ExceptionFrame 
)

Definition at line 304 of file kdprint.c.

312{
313 STRING PromptBuffer, ResponseBuffer;
314 BOOLEAN Enable, Resend;
315 PCHAR SafeResponseString;
316 CHAR CapturedPrompt[KD_PRINT_MAX_BYTES];
317 CHAR SafeResponseBuffer[KD_PRINT_MAX_BYTES];
318
319 /* Normalize the lengths */
320 PromptLength = min(PromptLength,
321 sizeof(CapturedPrompt));
323 sizeof(SafeResponseBuffer));
324
325 /* Check if we need to verify the string */
327 {
328 /* Handle user-mode buffers safely */
330 {
331 /* Probe and capture the prompt */
332 ProbeForRead(PromptString, PromptLength, 1);
333 KdpMoveMemory(CapturedPrompt, PromptString, PromptLength);
334 PromptString = CapturedPrompt;
335
336 /* Probe and make room for the response */
337 ProbeForWrite(ResponseString, MaximumResponseLength, 1);
338 SafeResponseString = SafeResponseBuffer;
339 }
341 {
342 /* Bad string pointer, bail out */
343 _SEH2_YIELD(return 0);
344 }
345 _SEH2_END;
346 }
347 else
348 {
349 SafeResponseString = ResponseString;
350 }
351
352 /* Setup the prompt and response buffers */
353 PromptBuffer.Buffer = PromptString;
354 PromptBuffer.Length = PromptBuffer.MaximumLength = PromptLength;
355 ResponseBuffer.Buffer = SafeResponseString;
356 ResponseBuffer.Length = 0;
357 ResponseBuffer.MaximumLength = MaximumResponseLength;
358
359 /* Log the print */
360 KdLogDbgPrint(&PromptBuffer);
361
362 /* Enter the debugger */
363 Enable = KdEnterDebugger(TrapFrame, ExceptionFrame);
364
365 /* Enter prompt loop */
366 do
367 {
368 /* Send the prompt and receive the response */
369 Resend = KdpPromptString(&PromptBuffer, &ResponseBuffer);
370
371 /* Loop while we need to resend */
372 } while (Resend);
373
374 /* Exit the debugger */
376
377 /* Copy back the response if required */
379 {
381 {
382 /* Safely copy back the response to user mode */
383 KdpMoveMemory(ResponseString,
384 ResponseBuffer.Buffer,
385 ResponseBuffer.Length);
386 }
388 {
389 /* String became invalid after we exited, fail */
390 _SEH2_YIELD(return 0);
391 }
392 _SEH2_END;
393 }
394
395 /* Return the number of characters received */
396 return ResponseBuffer.Length;
397}
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:102
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143
#define _SEH2_END
Definition: filesup.c:22
#define _SEH2_TRY
Definition: filesup.c:19
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
BOOLEAN NTAPI KdpPromptString(_In_ PSTRING PromptString, _In_ PSTRING ResponseString)
Definition: kdprint.c:150
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:34
#define _SEH2_YIELD(__stmt)
Definition: pseh2_64.h:162
_In_ ULONG MaximumResponseLength
Definition: kdfuncs.h:11

Referenced by KdpTrap().

◆ KdpReportCommandStringStateChange()

VOID NTAPI KdpReportCommandStringStateChange ( IN PSTRING  NameString,
IN PSTRING  CommandString,
IN OUT PCONTEXT  Context 
)

Definition at line 1658 of file kdapi.c.

1661{
1663 DBGKD_ANY_WAIT_STATE_CHANGE WaitStateChange;
1664 ULONG Length, ActualLength, TotalLength;
1666
1667 /* Start wait loop */
1668 do
1669 {
1670 /* Build the architecture common parts of the message */
1672 Context,
1673 &WaitStateChange);
1674
1675 /* Set the context */
1676 KdpSetContextState(&WaitStateChange, Context);
1677
1678 /* Clear the command string structure */
1679 KdpZeroMemory(&WaitStateChange.u.CommandString,
1680 sizeof(DBGKD_COMMAND_STRING));
1681
1682 /* Normalize name string to max */
1683 Length = min(128 - 1, NameString->Length);
1684
1685 /* Copy it to the message buffer */
1686 KdpCopyMemoryChunks((ULONG_PTR)NameString->Buffer,
1688 Length,
1689 0,
1691 &ActualLength);
1692
1693 /* Null terminate and calculate the total length */
1694 TotalLength = ActualLength;
1696
1697 /* Check if the command string is too long */
1698 Length = CommandString->Length;
1699 if (Length > (PACKET_MAX_SIZE -
1701 {
1702 /* Use maximum possible size */
1705 }
1706
1707 /* Copy it to the message buffer */
1708 KdpCopyMemoryChunks((ULONG_PTR)CommandString->Buffer,
1710 Length,
1711 0,
1713 &ActualLength);
1714
1715 /* Null terminate and calculate the total length */
1716 TotalLength += ActualLength;
1718
1719 /* Now set up the header and the data */
1720 Header.Length = sizeof(DBGKD_ANY_WAIT_STATE_CHANGE);
1721 Header.Buffer = (PCHAR)&WaitStateChange;
1722 Data.Length = (USHORT)TotalLength;
1723 Data.Buffer = KdpMessageBuffer;
1724
1725 /* Send State Change packet and wait for a reply */
1727 &Header,
1728 &Data,
1729 Context);
1731}
VOID NTAPI KdpSetContextState(IN PDBGKD_ANY_WAIT_STATE_CHANGE WaitStateChange, IN PCONTEXT Context)
Definition: kdx64.c:66
VOID NTAPI KdpSetCommonState(IN ULONG NewState, IN PCONTEXT Context, IN PDBGKD_ANY_WAIT_STATE_CHANGE WaitStateChange)
Definition: kdapi.c:386
VOID NTAPI KdpZeroMemory(_In_ PVOID Destination, _In_ SIZE_T Length)
Definition: kdapi.c:42
KCONTINUE_STATUS NTAPI KdpSendWaitContinue(IN ULONG PacketType, IN PSTRING SendHeader, IN PSTRING SendData OPTIONAL, IN OUT PCONTEXT Context)
Definition: kdapi.c:1265
NTSTATUS NTAPI KdpCopyMemoryChunks(_In_ ULONG64 Address, _In_ PVOID Buffer, _In_ ULONG TotalSize, _In_ ULONG ChunkSize, _In_ ULONG Flags, _Out_opt_ PULONG ActualSize)
Definition: kdapi.c:55
enum _KCONTINUE_STATUS KCONTINUE_STATUS
@ ContinueProcessorReselected
Definition: ketypes.h:451
union _DBGKD_ANY_WAIT_STATE_CHANGE::@3544 u
DBGKD_COMMAND_STRING CommandString
Definition: windbgkd.h:510
_In_ ULONG TotalLength
Definition: usbdlib.h:158
struct _DBGKD_ANY_WAIT_STATE_CHANGE DBGKD_ANY_WAIT_STATE_CHANGE
#define DbgKdCommandStringStateChange
Definition: windbgkd.h:61
#define PACKET_TYPE_KD_STATE_CHANGE64
Definition: windbgkd.h:48

Referenced by KdpCommandString().

◆ KdpReportExceptionStateChange()

BOOLEAN NTAPI KdpReportExceptionStateChange ( IN PEXCEPTION_RECORD  ExceptionRecord,
IN OUT PCONTEXT  Context,
IN BOOLEAN  SecondChanceException 
)

Definition at line 1735 of file kdapi.c.

1738{
1740 DBGKD_ANY_WAIT_STATE_CHANGE WaitStateChange;
1742
1743 /* Start report loop */
1744 do
1745 {
1746 /* Build the architecture common parts of the message */
1748
1749#if !defined(_WIN64)
1750
1751 /* Convert it and copy it over */
1753 &WaitStateChange.u.Exception.ExceptionRecord);
1754
1755#else
1756
1757 /* Just copy it directly, no need to convert */
1758 KdpMoveMemory(&WaitStateChange.u.Exception.ExceptionRecord,
1759 ExceptionRecord,
1760 sizeof(EXCEPTION_RECORD));
1761
1762#endif
1763
1764 /* Set the First Chance flag */
1765 WaitStateChange.u.Exception.FirstChance = !SecondChanceException;
1766
1767 /* Now finish creating the structure */
1768 KdpSetContextState(&WaitStateChange, Context);
1769
1770 /* Setup the actual header to send to KD */
1771 Header.Length = sizeof(DBGKD_ANY_WAIT_STATE_CHANGE);
1772 Header.Buffer = (PCHAR)&WaitStateChange;
1773
1774 /* Setup the trace data */
1776
1777 /* Send State Change packet and wait for a reply */
1779 &Header,
1780 &Data,
1781 Context);
1783
1784 /* Return */
1785 return Status;
1786}
VOID NTAPI DumpTraceData(IN PSTRING TraceData)
Definition: kdapi.c:371
VOID NTAPI KdpMoveMemory(_In_ PVOID Destination, _In_ PVOID Source, _In_ SIZE_T Length)
Definition: kdapi.c:27
DBGKM_EXCEPTION64 Exception
Definition: windbgkd.h:508
EXCEPTION_RECORD64 ExceptionRecord
Definition: windbgkd.h:312
#define DbgKdExceptionStateChange
Definition: windbgkd.h:59
static __inline VOID NTAPI ExceptionRecord32To64(IN PEXCEPTION_RECORD32 Ex32, OUT PEXCEPTION_RECORD64 Ex64)
Definition: windbgkd.h:917

Referenced by KdpReport(), and KdpSwitchProcessor().

◆ KdpReportLoadSymbolsStateChange()

VOID NTAPI KdpReportLoadSymbolsStateChange ( IN PSTRING  PathName,
IN PKD_SYMBOLS_INFO  SymbolInfo,
IN BOOLEAN  Unload,
IN OUT PCONTEXT  Context 
)

Definition at line 1586 of file kdapi.c.

1590{
1591 PSTRING ExtraData;
1593 DBGKD_ANY_WAIT_STATE_CHANGE WaitStateChange;
1594 ULONG PathNameLength;
1596
1597 /* Start wait loop */
1598 do
1599 {
1600 /* Build the architecture common parts of the message */
1602 Context,
1603 &WaitStateChange);
1604
1605 /* Now finish creating the structure */
1606 KdpSetContextState(&WaitStateChange, Context);
1607
1608 /* Fill out load data */
1609 WaitStateChange.u.LoadSymbols.UnloadSymbols = Unload;
1610 WaitStateChange.u.LoadSymbols.BaseOfDll = (ULONG64)(LONG_PTR)SymbolInfo->BaseOfDll;
1611 WaitStateChange.u.LoadSymbols.ProcessId = SymbolInfo->ProcessId;
1612 WaitStateChange.u.LoadSymbols.CheckSum = SymbolInfo->CheckSum;
1613 WaitStateChange.u.LoadSymbols.SizeOfImage = SymbolInfo->SizeOfImage;
1614
1615 /* Check if we have a path name */
1616 if (PathName)
1617 {
1618 /* Copy it to the path buffer */
1619 KdpCopyMemoryChunks((ULONG_PTR)PathName->Buffer,
1621 PathName->Length,
1622 0,
1624 &PathNameLength);
1625
1626 /* Null terminate */
1627 KdpPathBuffer[PathNameLength++] = ANSI_NULL;
1628
1629 /* Set the path length */
1630 WaitStateChange.u.LoadSymbols.PathNameLength = PathNameLength;
1631
1632 /* Set up the data */
1633 Data.Buffer = KdpPathBuffer;
1634 Data.Length = (USHORT)PathNameLength;
1635 ExtraData = &Data;
1636 }
1637 else
1638 {
1639 /* No name */
1640 WaitStateChange.u.LoadSymbols.PathNameLength = 0;
1641 ExtraData = NULL;
1642 }
1643
1644 /* Setup the header */
1645 Header.Length = sizeof(DBGKD_ANY_WAIT_STATE_CHANGE);
1646 Header.Buffer = (PCHAR)&WaitStateChange;
1647
1648 /* Send the packet */
1650 &Header,
1651 ExtraData,
1652 Context);
1654}
static VOID NTAPI Unload(PDRIVER_OBJECT DriverObject)
Definition: floppy.c:377
CHAR KdpPathBuffer[KDP_MSG_BUFFER_SIZE]
Definition: kddata.c:128
DBGKD_LOAD_SYMBOLS64 LoadSymbols
Definition: windbgkd.h:509
#define DbgKdLoadSymbolsStateChange
Definition: windbgkd.h:60

Referenced by KdpSymbol().

◆ KdpRestoreAllBreakpoints()

VOID NTAPI KdpRestoreAllBreakpoints ( VOID  )

Definition at line 368 of file kdbreak.c.

369{
370 ULONG BpIndex;
371
372 /* No more suspended Breakpoints */
374
375 /* Loop the breakpoints */
376 for (BpIndex = 0; BpIndex < KD_BREAKPOINT_MAX; BpIndex++)
377 {
378 /* Check if they are valid, suspended breakpoints */
381 {
382 /* Unsuspend them */
383 KdpBreakpointTable[BpIndex].Flags &= ~KD_BREAKPOINT_SUSPENDED;
385 }
386 }
387}
BOOLEAN BreakpointsSuspended
Definition: kddata.c:99
BOOLEAN NTAPI KdpLowRestoreBreakpoint(IN ULONG BpIndex)
Definition: kdbreak.c:268

Referenced by KdEnableDebuggerWithLock().

◆ KdpSetContextState()

VOID NTAPI KdpSetContextState ( IN PDBGKD_ANY_WAIT_STATE_CHANGE  WaitStateChange,
IN PCONTEXT  Context 
)

Definition at line 66 of file kdx64.c.

68{
69 PKPRCB Prcb = KeGetCurrentPrcb();
70
71 /* Copy i386 specific debug registers */
72 WaitStateChange->ControlReport.Dr6 = Prcb->ProcessorState.SpecialRegisters.
73 KernelDr6;
74 WaitStateChange->ControlReport.Dr7 = Prcb->ProcessorState.SpecialRegisters.
75 KernelDr7;
76
77 /* Copy i386 specific segments */
78 WaitStateChange->ControlReport.SegCs = (USHORT)Context->SegCs;
79 WaitStateChange->ControlReport.SegDs = (USHORT)Context->SegDs;
80 WaitStateChange->ControlReport.SegEs = (USHORT)Context->SegEs;
81 WaitStateChange->ControlReport.SegFs = (USHORT)Context->SegFs;
82
83 /* Copy EFlags */
84 WaitStateChange->ControlReport.EFlags = Context->EFlags;
85
86 /* Set Report Flags */
87 WaitStateChange->ControlReport.ReportFlags = REPORT_INCLUDES_SEGS;
88 if (WaitStateChange->ControlReport.SegCs == KGDT64_R0_CODE)
89 {
90 WaitStateChange->ControlReport.ReportFlags |= REPORT_STANDARD_CS;
91 }
92}
#define KGDT64_R0_CODE
Definition: ketypes.h:133
#define REPORT_INCLUDES_SEGS
Definition: windbgkd.h:147
#define REPORT_STANDARD_CS
Definition: windbgkd.h:148

Referenced by KdpReportCommandStringStateChange(), KdpReportExceptionStateChange(), and KdpReportLoadSymbolsStateChange().

◆ KdpStub()

BOOLEAN NTAPI KdpStub ( IN PKTRAP_FRAME  TrapFrame,
IN PKEXCEPTION_FRAME  ExceptionFrame,
IN PEXCEPTION_RECORD  ExceptionRecord,
IN PCONTEXT  ContextRecord,
IN KPROCESSOR_MODE  PreviousMode,
IN BOOLEAN  SecondChanceException 
)

Definition at line 266 of file kdtrap.c.

272{
273 ULONG_PTR ExceptionCommand;
274
275 /* Check if this was a breakpoint due to DbgPrint or Load/UnloadSymbols */
276 ExceptionCommand = ExceptionRecord->ExceptionInformation[0];
277 if ((ExceptionRecord->ExceptionCode == STATUS_BREAKPOINT) &&
278 (ExceptionRecord->NumberParameters > 0) &&
279 ((ExceptionCommand == BREAKPOINT_LOAD_SYMBOLS) ||
280 (ExceptionCommand == BREAKPOINT_UNLOAD_SYMBOLS) ||
281 (ExceptionCommand == BREAKPOINT_COMMAND_STRING) ||
282 (ExceptionCommand == BREAKPOINT_PRINT)))
283 {
284 /* This we can handle: simply bump the Program Counter */
287 return TRUE;
288 }
289 else if (KdPitchDebugger)
290 {
291 /* There's no debugger, fail. */
292 return FALSE;
293 }
294 else if ((KdAutoEnableOnEvent) &&
299 {
300 /* Debugging was Auto-Enabled. We can now send this to KD. */
301 return KdpTrap(TrapFrame,
302 ExceptionFrame,
303 ExceptionRecord,
306 SecondChanceException);
307 }
308 else
309 {
310 /* FIXME: All we can do in this case is trace this exception */
311 return FALSE;
312 }
313}
NTSTATUS NTAPI KdEnableDebugger(VOID)
Definition: kdapi.c:2135
BOOLEAN NTAPI KdpTrap(IN PKTRAP_FRAME TrapFrame, IN PKEXCEPTION_FRAME ExceptionFrame, IN PEXCEPTION_RECORD ExceptionRecord, IN PCONTEXT ContextRecord, IN KPROCESSOR_MODE PreviousMode, IN BOOLEAN SecondChanceException)
Definition: kdtrap.c:135
#define BREAKPOINT_PRINT
Definition: kdtypes.h:51
#define BREAKPOINT_COMMAND_STRING
Definition: kdtypes.h:55
#define BREAKPOINT_LOAD_SYMBOLS
Definition: kdtypes.h:53
#define BREAKPOINT_UNLOAD_SYMBOLS
Definition: kdtypes.h:54
#define KeSetContextPc(Context, ProgramCounter)
Definition: ke.h:34
#define KeGetContextPc(Context)
Definition: ke.h:31

Referenced by KdDisableDebuggerWithLock(), and KdInitSystem().

◆ KdpSuspendAllBreakPoints()

VOID NTAPI KdpSuspendAllBreakPoints ( VOID  )

Definition at line 407 of file kdbreak.c.

408{
409 ULONG BpEntry;
410
411 /* Breakpoints are suspended */
413
414 /* Loop every breakpoint */
415 for (BpEntry = 1; BpEntry <= KD_BREAKPOINT_MAX; BpEntry++)
416 {
417 /* Suspend it */
418 KdpSuspendBreakPoint(BpEntry);
419 }
420}
VOID NTAPI KdpSuspendBreakPoint(IN ULONG BpEntry)
Definition: kdbreak.c:391

Referenced by KdDisableDebuggerWithLock().

◆ KdpSuspendBreakPoint()

VOID NTAPI KdpSuspendBreakPoint ( IN ULONG  BpEntry)

Definition at line 391 of file kdbreak.c.

392{
393 ULONG BpIndex = BpEntry - 1;
394
395 /* Check if this is a valid, unsuspended breakpoint */
398 {
399 /* Suspend it */
401 KdpLowWriteContent(BpIndex);
402 }
403}

Referenced by KdpSuspendAllBreakPoints().

◆ KdpSwitchProcessor()

BOOLEAN NTAPI KdpSwitchProcessor ( IN PEXCEPTION_RECORD  ExceptionRecord,
IN OUT PCONTEXT  ContextRecord,
IN BOOLEAN  SecondChanceException 
)

Definition at line 1838 of file kdapi.c.

1841{
1843
1844 /* Save the port data */
1845 KdSave(FALSE);
1846
1847 /* Report a state change */
1848 Status = KdpReportExceptionStateChange(ExceptionRecord,
1850 SecondChanceException);
1851
1852 /* Restore the port data and return */
1854 return Status;
1855}
BOOLEAN NTAPI KdpReportExceptionStateChange(IN PEXCEPTION_RECORD ExceptionRecord, IN OUT PCONTEXT Context, IN BOOLEAN SecondChanceException)
Definition: kdapi.c:1735

Referenced by KdInitSystem().

◆ KdpSymbol()

VOID NTAPI KdpSymbol ( IN PSTRING  DllPath,
IN PKD_SYMBOLS_INFO  SymbolInfo,
IN BOOLEAN  Unload,
IN KPROCESSOR_MODE  PreviousMode,
IN PCONTEXT  ContextRecord,
IN PKTRAP_FRAME  TrapFrame,
IN PKEXCEPTION_FRAME  ExceptionFrame 
)

Definition at line 263 of file kdprint.c.

270{
272 PKPRCB Prcb = KeGetCurrentPrcb();
273
274 /* Check if we need to do anything */
275 if ((PreviousMode != KernelMode) || (KdDebuggerNotPresent)) return;
276
277 /* Enter the debugger */
278 Enable = KdEnterDebugger(TrapFrame, ExceptionFrame);
279
280 /* Save the CPU Control State and save the context */
284 sizeof(CONTEXT));
285
286 /* Report the new state */
288 SymbolInfo,
289 Unload,
291
292 /* Restore the processor state */
295 sizeof(CONTEXT));
297
298 /* Exit the debugger and return */
300}
VOID NTAPI KdpReportLoadSymbolsStateChange(IN PSTRING PathName, IN PKD_SYMBOLS_INFO SymbolInfo, IN BOOLEAN Unload, IN OUT PCONTEXT Context)
Definition: kdapi.c:1586
static const char const char * DllPath
Definition: image.c:34

Referenced by KdpTrap().

◆ KdpSysCheckLowMemory()

NTSTATUS NTAPI KdpSysCheckLowMemory ( IN ULONG  Flags)

Definition at line 356 of file kdx64.c.

357{
359 return STATUS_UNSUCCESSFUL;
360}

Referenced by KdpCheckLowMemory().

◆ KdpSysGetVersion()

VOID NTAPI KdpSysGetVersion ( IN PDBGKD_GET_VERSION64  Version)

Definition at line 433 of file kdapi.c.

434{
435 /* Copy the version block */
438 sizeof(DBGKD_GET_VERSION64));
439}
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID _Out_ PINTERFACE _In_ USHORT _In_ USHORT Version
Definition: wdffdo.h:469

Referenced by KdpGetVersion().

◆ KdpSysReadBusData()

NTSTATUS NTAPI KdpSysReadBusData ( IN ULONG  BusDataType,
IN ULONG  BusNumber,
IN ULONG  SlotNumber,
IN ULONG  Offset,
IN PVOID  Buffer,
IN ULONG  Length,
OUT PULONG  ActualLength 
)

Definition at line 134 of file kdx64.c.

141{
143 return STATUS_UNSUCCESSFUL;
144}

Referenced by KdpGetBusData().

◆ KdpSysReadControlSpace()

NTSTATUS NTAPI KdpSysReadControlSpace ( IN ULONG  Processor,
IN ULONG64  BaseAddress,
IN PVOID  Buffer,
IN ULONG  Length,
OUT PULONG  ActualLength 
)

Definition at line 162 of file kdx64.c.

167{
168 PVOID ControlStart;
170 PKIPCR Pcr = CONTAINING_RECORD(Prcb, KIPCR, Prcb);
171
172 switch (BaseAddress)
173 {
175 /* Copy a pointer to the Pcr */
176 ControlStart = &Pcr;
177 *ActualLength = sizeof(PVOID);
178 break;
179
181 /* Copy a pointer to the Prcb */
182 ControlStart = &Prcb;
183 *ActualLength = sizeof(PVOID);
184 break;
185
187 /* Copy SpecialRegisters */
188 ControlStart = &Prcb->ProcessorState.SpecialRegisters;
189 *ActualLength = sizeof(KSPECIAL_REGISTERS);
190 break;
191
193 /* Copy a pointer to the current Thread */
194 ControlStart = &Prcb->CurrentThread;
195 *ActualLength = sizeof(PVOID);
196 break;
197
198 default:
199 *ActualLength = 0;
200 ASSERT(FALSE);
201 return STATUS_UNSUCCESSFUL;
202 }
203
204 /* Copy the memory */
205 RtlCopyMemory(Buffer, ControlStart, min(Length, *ActualLength));
206
207 /* Finish up */
208 return STATUS_SUCCESS;
209}
#define ASSERT(a)
Definition: mode.c:44
struct _KSPECIAL_REGISTERS KSPECIAL_REGISTERS
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
Definition: mmfuncs.h:404
struct _KTHREAD * CurrentThread
Definition: ketypes.h:636
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define AMD64_DEBUG_CONTROL_SPACE_KPRCB
Definition: windbgkd.h:204
#define AMD64_DEBUG_CONTROL_SPACE_KSPECIAL
Definition: windbgkd.h:205
#define AMD64_DEBUG_CONTROL_SPACE_KPCR
Definition: windbgkd.h:203
#define AMD64_DEBUG_CONTROL_SPACE_KTHREAD
Definition: windbgkd.h:206
_In_ UCHAR Processor
Definition: kefuncs.h:670

Referenced by KdpReadControlSpace().

◆ KdpSysReadIoSpace()

NTSTATUS NTAPI KdpSysReadIoSpace ( IN ULONG  InterfaceType,
IN ULONG  BusNumber,
IN ULONG  AddressSpace,
IN ULONG64  IoAddress,
IN PVOID  DataValue,
IN ULONG  DataSize,
OUT PULONG  ActualDataSize 
)

Definition at line 108 of file kdarm.c.

115{
117 return STATUS_UNSUCCESSFUL;
118}

Referenced by KdpReadIoSpace(), and KdpReadIoSpaceExtended().

◆ KdpSysReadMsr()

NTSTATUS NTAPI KdpSysReadMsr ( IN ULONG  Msr,
OUT PLARGE_INTEGER  MsrValue 
)

Definition at line 96 of file kdx64.c.

98{
99 /* Use SEH to protect from invalid MSRs */
101 {
102 MsrValue->QuadPart = __readmsr(Msr);
103 }
105 {
107 }
108 _SEH2_END;
109
110 return STATUS_SUCCESS;
111}
PPC_QUAL unsigned long long __readmsr()
Definition: intrin_ppc.h:741
#define STATUS_NO_SUCH_DEVICE
Definition: udferr_usr.h:136

Referenced by KdpReadMachineSpecificRegister().

◆ KdpSysWriteBusData()

NTSTATUS NTAPI KdpSysWriteBusData ( IN ULONG  BusDataType,
IN ULONG  BusNumber,
IN ULONG  SlotNumber,
IN ULONG  Offset,
IN PVOID  Buffer,
IN ULONG  Length,
OUT PULONG  ActualLength 
)

Definition at line 148 of file kdx64.c.

155{
157 return STATUS_UNSUCCESSFUL;
158}

Referenced by KdpSetBusData().

◆ KdpSysWriteControlSpace()

NTSTATUS NTAPI KdpSysWriteControlSpace ( IN ULONG  Processor,
IN ULONG64  BaseAddress,
IN PVOID  Buffer,
IN ULONG  Length,
OUT PULONG  ActualLength 
)

Definition at line 213 of file kdx64.c.

218{
219 PVOID ControlStart;
221
222 switch (BaseAddress)
223 {
225 /* Copy SpecialRegisters */
226 ControlStart = &Prcb->ProcessorState.SpecialRegisters;
227 *ActualLength = sizeof(KSPECIAL_REGISTERS);
228 break;
229
230 default:
231 *ActualLength = 0;
232 ASSERT(FALSE);
233 return STATUS_UNSUCCESSFUL;
234 }
235
236 /* Copy the memory */
237 RtlCopyMemory(ControlStart, Buffer, min(Length, *ActualLength));
238
239 return STATUS_SUCCESS;
240}

Referenced by KdpWriteControlSpace().

◆ KdpSysWriteIoSpace()

NTSTATUS NTAPI KdpSysWriteIoSpace ( IN ULONG  InterfaceType,
IN ULONG  BusNumber,
IN ULONG  AddressSpace,
IN ULONG64  IoAddress,
IN PVOID  DataValue,
IN ULONG  DataSize,
OUT PULONG  ActualDataSize 
)

Definition at line 300 of file kdx64.c.

307{
308 /* Verify parameters */
309 if (InterfaceType != Isa || BusNumber != 0 || AddressSpace != 1)
310 {
311 /* No data was written */
312 *ActualDataSize = 0;
314 }
315
316 /* Check for correct alignment */
317 if ((IoAddress & (DataSize - 1)))
318 {
319 /* Invalid alignment */
320 *ActualDataSize = 0;
322 }
323
324 switch (DataSize)
325 {
326 case sizeof(UCHAR):
327 /* Write one UCHAR */
328 WRITE_PORT_UCHAR((PUCHAR)IoAddress, *(PUCHAR)DataValue);
329 break;
330
331 case sizeof(USHORT):
332 /* Write one USHORT */
333 WRITE_PORT_USHORT((PUSHORT)IoAddress, *(PUSHORT)DataValue);
334 break;
335
336 case sizeof(ULONG):
337 /* Write one ULONG */
338 WRITE_PORT_ULONG((PULONG)IoAddress, *(PULONG)DataValue);
339 break;
340
341 default:
342 /* Invalid data size */
343 *ActualDataSize = 0;
345 }
346
347 /* Return the size of the data */
348 *ActualDataSize = DataSize;
349
350 /* Success! */
351 return STATUS_SUCCESS;
352}
VOID NTAPI WRITE_PORT_USHORT(IN PUSHORT Port, IN USHORT Value)
Definition: portio.c:115
VOID NTAPI WRITE_PORT_ULONG(IN PULONG Port, IN ULONG Value)
Definition: portio.c:123
@ Isa
Definition: hwresource.cpp:138
_In_ NDIS_STATUS _In_ ULONG _In_ USHORT _In_opt_ PVOID _In_ ULONG DataSize
Definition: ndis.h:4755
#define STATUS_DATATYPE_MISALIGNMENT
Definition: ntstatus.h:183
#define WRITE_PORT_UCHAR(p, d)
Definition: pc98vid.h:21
uint32_t * PULONG
Definition: typedefs.h:59
uint16_t * PUSHORT
Definition: typedefs.h:56
unsigned char * PUCHAR
Definition: typedefs.h:53
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID InterfaceType
Definition: wdffdo.h:463
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT _In_ PDEVICE_OBJECT _In_ INTERFACE_TYPE _In_ ULONG BusNumber
Definition: halfuncs.h:160
_In_ ULONG _In_ PHYSICAL_ADDRESS _Inout_ PULONG AddressSpace
Definition: iofuncs.h:2274
unsigned char UCHAR
Definition: xmlstorage.h:181

Referenced by KdpWriteIoSpace(), and KdpWriteIoSpaceExtended().

◆ KdpSysWriteMsr()

NTSTATUS NTAPI KdpSysWriteMsr ( IN ULONG  Msr,
IN PLARGE_INTEGER  MsrValue 
)

Definition at line 115 of file kdx64.c.

117{
118 /* Use SEH to protect from invalid MSRs */
120 {
121 __writemsr(Msr, MsrValue->QuadPart);
122 }
124 {
126 }
127 _SEH2_END;
128
129 return STATUS_SUCCESS;
130}
PPC_QUAL void __writemsr(const unsigned long Value)
Definition: intrin_ppc.h:748

Referenced by KdpWriteMachineSpecificRegister().

◆ KdpTimeSlipDpcRoutine()

VOID NTAPI KdpTimeSlipDpcRoutine ( IN PKDPC  Dpc,
IN PVOID  DeferredContext,
IN PVOID  SystemArgument1,
IN PVOID  SystemArgument2 
)

Definition at line 1790 of file kdapi.c.

1794{
1795 LONG OldSlip, NewSlip, PendingSlip;
1796
1797 /* Get the current pending slip */
1798 PendingSlip = KdpTimeSlipPending;
1799 do
1800 {
1801 /* Save the old value and either disable or enable it now. */
1802 OldSlip = PendingSlip;
1803 NewSlip = OldSlip > 1 ? 1 : 0;
1804
1805 /* Try to change the value */
1807 NewSlip,
1808 OldSlip) != OldSlip);
1809
1810 /* If the New Slip value is 1, then do the Time Slipping */
1812}
#define InterlockedCompareExchange
Definition: interlocked.h:104
long LONG
Definition: pedump.c:60
VOID NTAPI ExQueueWorkItem(IN PWORK_QUEUE_ITEM WorkItem, IN WORK_QUEUE_TYPE QueueType)
Definition: work.c:723
@ DelayedWorkQueue
Definition: extypes.h:190

Referenced by KdInitSystem().

◆ KdpTimeSlipWork()

VOID NTAPI KdpTimeSlipWork ( IN PVOID  Context)

Definition at line 1816 of file kdapi.c.

1817{
1818 KIRQL OldIrql;
1820
1821 /* Update the System time from the CMOS */
1825
1826 /* Check if we have a registered Time Slip Event and signal it */
1830
1831 /* Delay the DPC until it runs next time */
1832 DueTime.QuadPart = -1800000000;
1834}
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
#define KeSetEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:476
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
PKEVENT KdpTimeSlipEvent
Definition: kddata.c:120
KSPIN_LOCK KdpTimeSlipEventLock
Definition: kddata.c:121
VOID NTAPI ExUpdateSystemTimeFromCmos(IN BOOLEAN UpdateInterruptTime, IN ULONG MaxSepInSeconds)
Definition: time.c:217
VOID NTAPI ExReleaseTimeRefreshLock(VOID)
Definition: time.c:83
BOOLEAN NTAPI ExAcquireTimeRefreshLock(IN BOOLEAN Wait)
Definition: time.c:51
BOOLEAN NTAPI KeSetTimer(IN OUT PKTIMER Timer, IN LARGE_INTEGER DueTime, IN PKDPC Dpc OPTIONAL)
Definition: timerobj.c:281
_In_ WDFTIMER _In_ LONGLONG DueTime
Definition: wdftimer.h:190

Referenced by KdInitSystem().

◆ KdpTrap()

BOOLEAN NTAPI KdpTrap ( IN PKTRAP_FRAME  TrapFrame,
IN PKEXCEPTION_FRAME  ExceptionFrame,
IN PEXCEPTION_RECORD  ExceptionRecord,
IN PCONTEXT  ContextRecord,
IN KPROCESSOR_MODE  PreviousMode,
IN BOOLEAN  SecondChanceException 
)

Definition at line 135 of file kdtrap.c.

141{
143 ULONG_PTR ProgramCounter;
145 NTSTATUS ReturnStatus;
147
148 /*
149 * Check if we got a STATUS_BREAKPOINT with a SubID for Print, Prompt or
150 * Load/Unload symbols. Make sure it isn't a software breakpoints as those
151 * are handled by KdpReport.
152 */
153 if ((ExceptionRecord->ExceptionCode == STATUS_BREAKPOINT) &&
154 (ExceptionRecord->ExceptionInformation[0] != BREAKPOINT_BREAK))
155 {
156 /* Save Program Counter */
157 ProgramCounter = KeGetContextPc(ContextRecord);
158
159 /* Check what kind of operation was requested from us */
160 Unload = FALSE;
161 switch (ExceptionRecord->ExceptionInformation[0])
162 {
163 /* DbgPrint */
164 case BREAKPOINT_PRINT:
165
166 /* Call the worker routine */
167 ReturnStatus = KdpPrint((ULONG)KdpGetParameterThree(ContextRecord),
168 (ULONG)KdpGetParameterFour(ContextRecord),
169 (PCHAR)ExceptionRecord->ExceptionInformation[1],
170 (USHORT)ExceptionRecord->ExceptionInformation[2],
172 TrapFrame,
173 ExceptionFrame,
174 &Handled);
175
176 /* Update the return value for the caller */
178 break;
179
180 /* DbgPrompt */
182
183 /* Call the worker routine */
184 ReturnLength = KdpPrompt((PCHAR)ExceptionRecord->ExceptionInformation[1],
185 (USHORT)ExceptionRecord->ExceptionInformation[2],
186 (PCHAR)KdpGetParameterThree(ContextRecord),
187 (USHORT)KdpGetParameterFour(ContextRecord),
189 TrapFrame,
190 ExceptionFrame);
191 Handled = TRUE;
192
193 /* Update the return value for the caller */
195 break;
196
197 /* DbgUnLoadImageSymbols */
199
200 /* Drop into the load case below, with the unload parameter */
201 Unload = TRUE;
202
203 /* DbgLoadImageSymbols */
205
206 /* Call the worker routine */
207 KdpSymbol((PSTRING)ExceptionRecord->ExceptionInformation[1],
208 (PKD_SYMBOLS_INFO)ExceptionRecord->ExceptionInformation[2],
209 Unload,
212 TrapFrame,
213 ExceptionFrame);
214 Handled = TRUE;
215 break;
216
217 /* DbgCommandString */
219
220 /* Call the worker routine */
221 KdpCommandString((PSTRING)ExceptionRecord->ExceptionInformation[1],
222 (PSTRING)ExceptionRecord->ExceptionInformation[2],
225 TrapFrame,
226 ExceptionFrame);
227 Handled = TRUE;
228 break;
229
230 /* Anything else, do nothing */
231 default:
232
233 /* Invalid debug service! Don't handle this! */
234 Handled = FALSE;
235 break;
236 }
237
238 /*
239 * If the PC was not updated, we'll increment it ourselves so execution
240 * continues past the breakpoint.
241 */
242 if (ProgramCounter == KeGetContextPc(ContextRecord))
243 {
244 /* Update it */
246 ProgramCounter + KD_BREAKPOINT_SIZE);
247 }
248 }
249 else
250 {
251 /* Call the worker routine */
252 Handled = KdpReport(TrapFrame,
253 ExceptionFrame,
254 ExceptionRecord,
257 SecondChanceException);
258 }
259
260 /* Return TRUE or FALSE to caller */
261 return Handled;
262}
IN CINT OUT PVOID IN ULONG OUT PULONG ReturnLength
Definition: dumpinfo.c:43
VOID NTAPI KdpCommandString(IN PSTRING NameString, IN PSTRING CommandString, IN KPROCESSOR_MODE PreviousMode, IN PCONTEXT ContextRecord, IN PKTRAP_FRAME TrapFrame, IN PKEXCEPTION_FRAME ExceptionFrame)
Definition: kdprint.c:224
NTSTATUS NTAPI KdpPrint(_In_ ULONG ComponentId, _In_ ULONG Level, _In_reads_bytes_(Length) PCHAR String, _In_ USHORT Length, _In_ KPROCESSOR_MODE PreviousMode, _In_ PKTRAP_FRAME TrapFrame, _In_ PKEXCEPTION_FRAME ExceptionFrame, _Out_ PBOOLEAN Handled)
Definition: kdprint.c:445
VOID NTAPI KdpSymbol(IN PSTRING DllPath, IN PKD_SYMBOLS_INFO SymbolInfo, IN BOOLEAN Unload, IN KPROCESSOR_MODE PreviousMode, IN PCONTEXT ContextRecord, IN PKTRAP_FRAME TrapFrame, IN PKEXCEPTION_FRAME ExceptionFrame)
Definition: kdprint.c:263
USHORT NTAPI KdpPrompt(_In_reads_bytes_(PromptLength) PCHAR PromptString, _In_ USHORT PromptLength, _Out_writes_bytes_(MaximumResponseLength) PCHAR ResponseString, _In_ USHORT MaximumResponseLength, _In_ KPROCESSOR_MODE PreviousMode, _In_ PKTRAP_FRAME TrapFrame, _In_ PKEXCEPTION_FRAME ExceptionFrame)
Definition: kdprint.c:304
BOOLEAN NTAPI KdpReport(IN PKTRAP_FRAME TrapFrame, IN PKEXCEPTION_FRAME ExceptionFrame, IN PEXCEPTION_RECORD ExceptionRecord, IN PCONTEXT ContextRecord, IN KPROCESSOR_MODE PreviousMode, IN BOOLEAN SecondChanceException)
Definition: kdtrap.c:52
#define BREAKPOINT_PROMPT
Definition: kdtypes.h:52
#define KeSetContextReturnRegister(Context, ReturnValue)
Definition: ke.h:43

Referenced by KdInitSystem(), and KdpStub().

◆ KdpZeroMemory()

VOID NTAPI KdpZeroMemory ( _In_ PVOID  Destination,
_In_ SIZE_T  Length 
)

Definition at line 42 of file kdapi.c.

45{
46 PCHAR DestinationBytes;
47
48 /* Zero the buffer 1 byte at a time */
49 DestinationBytes = Destination;
50 while (Length--) *DestinationBytes++ = 0;
51}

Referenced by KdpReportCommandStringStateChange(), and KdpSetCommonState().

◆ KdSetOwedBreakpoints()

VOID NTAPI KdSetOwedBreakpoints ( VOID  )

Definition at line 105 of file kdbreak.c.

106{
108 KD_BREAKPOINT_TYPE Content;
109 ULONG i;
111
112 /* If we don't owe any breakpoints, just return */
113 if (!KdpOweBreakpoint) return;
114
115 /* Enter the debugger */
117
118 /*
119 * Suppose we succeed in setting all the breakpoints.
120 * If we fail to do so, the flag will be set again.
121 */
123
124 /* Loop through current breakpoints and try to set or delete the pending ones */
125 for (i = 0; i < KD_BREAKPOINT_MAX; i++)
126 {
128 {
129 /*
130 * Set the breakpoint only if it is in kernel space, or if it is
131 * in user space and the active process context matches.
132 */
134 KdpBreakpointTable[i].DirectoryTableBase != KeGetCurrentThread()->ApcState.Process->DirectoryTableBase[0])
135 {
137 continue;
138 }
139
140 /* Try to save the old instruction */
142 &Content,
144 0,
146 NULL);
147 if (!NT_SUCCESS(Status))
148 {
149 /* Memory is still inaccessible, breakpoint setting will be deferred again */
150 // KdpDprintf("Failed to set deferred breakpoint at address 0x%p\n",
151 // KdpBreakpointTable[i].Address);
153 continue;
154 }
155
156 /* Check if we need to write the breakpoint */
158 {
159 /* Memory accessible, set the breakpoint */
160 KdpBreakpointTable[i].Content = Content;
161
162 /* Write the breakpoint */
166 0,
168 NULL);
169 if (!NT_SUCCESS(Status))
170 {
171 /* This should never happen */
172 KdpDprintf("Unable to write deferred breakpoint to address 0x%p\n",
175 }
176 else
177 {
179 }
180
181 continue;
182 }
183
184 /* Check if we need to restore the original instruction */
186 {
187 /* Write it back */
189 &KdpBreakpointTable[i].Content,
191 0,
193 NULL);
194 if (!NT_SUCCESS(Status))
195 {
196 /* This should never happen */
197 KdpDprintf("Unable to delete deferred breakpoint at address 0x%p\n",
200 }
201 else
202 {
203 /* Check if the breakpoint is suspended */
205 {
207 }
208 else
209 {
210 /* Invalidate it */
212 }
213 }
214
215 continue;
216 }
217 }
218 }
219
220 /* Exit the debugger */
222}
_Out_ PKAPC_STATE ApcState
Definition: mm.h:1765

Referenced by KiTrap0EHandler().

◆ KdUpdateDataBlock()

VOID NTAPI KdUpdateDataBlock ( VOID  )

Definition at line 89 of file kdinit.c.

90{
91 /* Update the KeUserCallbackDispatcher pointer */
94}
PVOID KeUserCallbackDispatcher
Definition: ke.h:142
ULONG64 KeUserCallbackDispatcher
Definition: wdbgexts.h:201

Referenced by PspInitializeSystemDll().

Variable Documentation

◆ BreakpointsSuspended

BOOLEAN BreakpointsSuspended
extern

Definition at line 99 of file kddata.c.

Referenced by KdpRestoreAllBreakpoints(), and KdpSuspendAllBreakPoints().

◆ Kd_ACPI_Mask

ULONG Kd_ACPI_Mask
extern

Definition at line 169 of file kddata.c.

◆ Kd_ALPC_Mask

ULONG Kd_ALPC_Mask
extern

Definition at line 253 of file kddata.c.

◆ Kd_AMLI_Mask

ULONG Kd_AMLI_Mask
extern

Definition at line 170 of file kddata.c.

◆ Kd_APPCOMPAT_Mask

ULONG Kd_APPCOMPAT_Mask
extern

Definition at line 271 of file kddata.c.

◆ Kd_AUTOCHK_Mask

ULONG Kd_AUTOCHK_Mask
extern

Definition at line 188 of file kddata.c.

◆ Kd_BURNENG_Mask

ULONG Kd_BURNENG_Mask
extern

Definition at line 194 of file kddata.c.

◆ Kd_CACHEMGR_Mask

ULONG Kd_CACHEMGR_Mask
extern

Definition at line 275 of file kddata.c.

◆ Kd_CAPIMG_Mask

ULONG Kd_CAPIMG_Mask
extern

Definition at line 305 of file kddata.c.

◆ Kd_CDAUDIO_Mask

ULONG Kd_CDAUDIO_Mask
extern

Definition at line 151 of file kddata.c.

◆ Kd_CDROM_Mask

ULONG Kd_CDROM_Mask
extern

Definition at line 152 of file kddata.c.

◆ Kd_CFR_Mask

ULONG Kd_CFR_Mask
extern

Definition at line 277 of file kddata.c.

◆ Kd_CLASSPNP_Mask

ULONG Kd_CLASSPNP_Mask
extern

Definition at line 153 of file kddata.c.

◆ Kd_CNG_Mask

ULONG Kd_CNG_Mask
extern

Definition at line 288 of file kddata.c.

◆ Kd_CONFIG_Mask

ULONG Kd_CONFIG_Mask
extern

Definition at line 159 of file kddata.c.

◆ Kd_COVERAGE_Mask

ULONG Kd_COVERAGE_Mask
extern

Definition at line 274 of file kddata.c.

◆ Kd_CRASHDUMP_Mask

ULONG Kd_CRASHDUMP_Mask
extern

Definition at line 150 of file kddata.c.

◆ Kd_CRASHDUMPXHCI_Mask

ULONG Kd_CRASHDUMPXHCI_Mask
extern

Definition at line 298 of file kddata.c.

◆ Kd_DCOMSS_Mask

ULONG Kd_DCOMSS_Mask
extern

Definition at line 189 of file kddata.c.

◆ Kd_DEFAULT_Mask

ULONG Kd_DEFAULT_Mask
extern

Definition at line 246 of file kddata.c.

Referenced by NtQueryDebugFilterState(), and NtSetDebugFilterState().

◆ Kd_DFRGIFC_Mask

ULONG Kd_DFRGIFC_Mask
extern

Definition at line 245 of file kddata.c.

◆ Kd_DFSC_Mask

ULONG Kd_DFSC_Mask
extern

Definition at line 248 of file kddata.c.

◆ Kd_DISK_Mask

ULONG Kd_DISK_Mask
extern

Definition at line 154 of file kddata.c.

◆ Kd_DMADMIN_Mask

ULONG Kd_DMADMIN_Mask
extern

Definition at line 214 of file kddata.c.

◆ Kd_DMCONFIG_Mask

ULONG Kd_DMCONFIG_Mask
extern

Definition at line 213 of file kddata.c.

◆ Kd_DMIO_Mask

ULONG Kd_DMIO_Mask
extern

Definition at line 212 of file kddata.c.

◆ Kd_DMSERVER_Mask

ULONG Kd_DMSERVER_Mask
extern

Definition at line 219 of file kddata.c.

◆ Kd_DMSYNTH_Mask

ULONG Kd_DMSYNTH_Mask
extern

Definition at line 176 of file kddata.c.

◆ Kd_DRIVEEXTENDER_Mask

ULONG Kd_DRIVEEXTENDER_Mask
extern

Definition at line 293 of file kddata.c.

◆ Kd_EMS_Mask

ULONG Kd_EMS_Mask
extern

Definition at line 265 of file kddata.c.

◆ Kd_ENVIRON_Mask

ULONG Kd_ENVIRON_Mask
extern

Definition at line 264 of file kddata.c.

◆ Kd_EXFAT_Mask

ULONG Kd_EXFAT_Mask
extern

Definition at line 289 of file kddata.c.

◆ Kd_FASTFAT_Mask

ULONG Kd_FASTFAT_Mask
extern

Definition at line 178 of file kddata.c.

◆ Kd_FCPORT_Mask

ULONG Kd_FCPORT_Mask
extern

Definition at line 210 of file kddata.c.

◆ Kd_FDC_Mask

ULONG Kd_FDC_Mask
extern

Definition at line 205 of file kddata.c.

◆ Kd_FILETRACE_Mask

ULONG Kd_FILETRACE_Mask
extern

Definition at line 290 of file kddata.c.

◆ Kd_FLOPPY_Mask

ULONG Kd_FLOPPY_Mask
extern

Definition at line 204 of file kddata.c.

◆ Kd_FLTMGR_Mask

ULONG Kd_FLTMGR_Mask
extern

Definition at line 192 of file kddata.c.

◆ Kd_FLTREGRESS_Mask

ULONG Kd_FLTREGRESS_Mask
extern

Definition at line 280 of file kddata.c.

◆ Kd_FSLIB_Mask

ULONG Kd_FSLIB_Mask
extern

Definition at line 308 of file kddata.c.

◆ Kd_FSTUB_Mask

ULONG Kd_FSTUB_Mask
extern

Definition at line 149 of file kddata.c.

◆ Kd_FUSION_Mask

ULONG Kd_FUSION_Mask
extern

Definition at line 197 of file kddata.c.

◆ Kd_FVEVOL_Mask

ULONG Kd_FVEVOL_Mask
extern

Definition at line 267 of file kddata.c.

◆ Kd_GPIO_Mask

ULONG Kd_GPIO_Mask
extern

Definition at line 299 of file kddata.c.

◆ Kd_HALIA64_Mask

ULONG Kd_HALIA64_Mask
extern

Definition at line 171 of file kddata.c.

◆ Kd_HEAP_Mask

ULONG Kd_HEAP_Mask
extern

Definition at line 258 of file kddata.c.

◆ Kd_HPS_Mask

ULONG Kd_HPS_Mask
extern

Definition at line 228 of file kddata.c.

◆ Kd_I8042PRT_Mask

ULONG Kd_I8042PRT_Mask
extern

Definition at line 160 of file kddata.c.

◆ Kd_IDEP_Mask

ULONG Kd_IDEP_Mask
extern

Definition at line 202 of file kddata.c.

◆ Kd_IDLETASK_Mask

ULONG Kd_IDLETASK_Mask
extern

Definition at line 198 of file kddata.c.

◆ Kd_IHVAUDIO_Mask

ULONG Kd_IHVAUDIO_Mask
extern

Definition at line 224 of file kddata.c.

◆ Kd_IHVBUS_Mask

ULONG Kd_IHVBUS_Mask
extern

Definition at line 227 of file kddata.c.

◆ Kd_IHVDRIVER_Mask

ULONG Kd_IHVDRIVER_Mask
extern

Definition at line 222 of file kddata.c.

◆ Kd_IHVNETWORK_Mask

ULONG Kd_IHVNETWORK_Mask
extern

Definition at line 225 of file kddata.c.

◆ Kd_IHVSTREAMING_Mask

ULONG Kd_IHVSTREAMING_Mask
extern

Definition at line 226 of file kddata.c.

◆ Kd_IHVVIDEO_Mask

ULONG Kd_IHVVIDEO_Mask
extern

Definition at line 223 of file kddata.c.

◆ Kd_IMAPI_Mask

ULONG Kd_IMAPI_Mask
extern

Definition at line 195 of file kddata.c.

◆ Kd_INFINIBAND_Mask

ULONG Kd_INFINIBAND_Mask
extern

Definition at line 221 of file kddata.c.

◆ Kd_IOSTRESS_Mask

ULONG Kd_IOSTRESS_Mask
extern

Definition at line 257 of file kddata.c.

◆ Kd_ISAPNP_Mask

ULONG Kd_ISAPNP_Mask
extern

Definition at line 232 of file kddata.c.

◆ Kd_KBDCLASS_Mask

ULONG Kd_KBDCLASS_Mask
extern

Definition at line 165 of file kddata.c.

◆ Kd_KBDHID_Mask

ULONG Kd_KBDHID_Mask
extern

Definition at line 163 of file kddata.c.

◆ Kd_KSECDD_Mask

ULONG Kd_KSECDD_Mask
extern

Definition at line 279 of file kddata.c.

◆ Kd_KTM_Mask

ULONG Kd_KTM_Mask
extern

Definition at line 256 of file kddata.c.

◆ Kd_LDR_Mask

ULONG Kd_LDR_Mask
extern

Definition at line 230 of file kddata.c.

◆ Kd_LSASS_Mask

ULONG Kd_LSASS_Mask
extern

Definition at line 286 of file kddata.c.

◆ Kd_LSERMOUS_Mask

ULONG Kd_LSERMOUS_Mask
extern

Definition at line 162 of file kddata.c.

◆ Kd_LUAFV_Mask

ULONG Kd_LUAFV_Mask
extern

Definition at line 270 of file kddata.c.

◆ Kd_MCHGR_Mask

ULONG Kd_MCHGR_Mask
extern

Definition at line 201 of file kddata.c.

◆ Kd_MM_Mask

ULONG Kd_MM_Mask
extern

Definition at line 247 of file kddata.c.

◆ Kd_MMCSS_Mask

ULONG Kd_MMCSS_Mask
extern

Definition at line 261 of file kddata.c.

◆ Kd_MOUCLASS_Mask

ULONG Kd_MOUCLASS_Mask
extern

Definition at line 166 of file kddata.c.

◆ Kd_MOUHID_Mask

ULONG Kd_MOUHID_Mask
extern

Definition at line 164 of file kddata.c.

◆ Kd_MOUNTMGR_Mask

ULONG Kd_MOUNTMGR_Mask
extern

Definition at line 276 of file kddata.c.

◆ Kd_MPIO_Mask

ULONG Kd_MPIO_Mask
extern

Definition at line 281 of file kddata.c.

◆ Kd_MSDSM_Mask

ULONG Kd_MSDSM_Mask
extern

Definition at line 282 of file kddata.c.

◆ Kd_NDIS_Mask

ULONG Kd_NDIS_Mask
extern

Definition at line 268 of file kddata.c.

◆ Kd_NETAPI_Mask

ULONG Kd_NETAPI_Mask
extern

Definition at line 181 of file kddata.c.

◆ Kd_NTFS_Mask

ULONG Kd_NTFS_Mask
extern

Definition at line 148 of file kddata.c.

◆ Kd_NTOSPNP_Mask

ULONG Kd_NTOSPNP_Mask
extern

Definition at line 177 of file kddata.c.

◆ Kd_NVCTRACE_Mask

ULONG Kd_NVCTRACE_Mask
extern

Definition at line 269 of file kddata.c.

◆ Kd_PCI_Mask

ULONG Kd_PCI_Mask
extern

Definition at line 211 of file kddata.c.

◆ Kd_PCIIDE_Mask

ULONG Kd_PCIIDE_Mask
extern

Definition at line 203 of file kddata.c.

◆ Kd_PERFLIB_Mask

ULONG Kd_PERFLIB_Mask
extern

Definition at line 255 of file kddata.c.

◆ Kd_PNPMEM_Mask

ULONG Kd_PNPMEM_Mask
extern

Definition at line 217 of file kddata.c.

◆ Kd_PNPMGR_Mask

ULONG Kd_PNPMGR_Mask
extern

Definition at line 180 of file kddata.c.

◆ Kd_POWER_Mask

ULONG Kd_POWER_Mask
extern

Definition at line 297 of file kddata.c.

◆ Kd_PREFETCHER_Mask

ULONG Kd_PREFETCHER_Mask
extern

Definition at line 208 of file kddata.c.

◆ Kd_PRINTSPOOLER_Mask

ULONG Kd_PRINTSPOOLER_Mask
extern

Definition at line 236 of file kddata.c.

◆ Kd_PROCESSOR_Mask

ULONG Kd_PROCESSOR_Mask
extern

Definition at line 218 of file kddata.c.

◆ Kd_PSHED_Mask

ULONG Kd_PSHED_Mask
extern

Definition at line 284 of file kddata.c.

◆ Kd_REDBOOK_Mask

ULONG Kd_REDBOOK_Mask
extern

Definition at line 155 of file kddata.c.

◆ Kd_REFS_Mask

ULONG Kd_REFS_Mask
extern

Definition at line 300 of file kddata.c.

◆ Kd_RPCPROXY_Mask

ULONG Kd_RPCPROXY_Mask
extern

Definition at line 187 of file kddata.c.

◆ Kd_RSFILTER_Mask

ULONG Kd_RSFILTER_Mask
extern

Definition at line 209 of file kddata.c.

◆ Kd_RTLTHREADPOOL_Mask

ULONG Kd_RTLTHREADPOOL_Mask
extern

Definition at line 229 of file kddata.c.

◆ Kd_SAMSS_Mask

ULONG Kd_SAMSS_Mask
extern

Definition at line 179 of file kddata.c.

◆ Kd_SBP2PORT_Mask

ULONG Kd_SBP2PORT_Mask
extern

Definition at line 273 of file kddata.c.

◆ Kd_SCCLIENT_Mask

ULONG Kd_SCCLIENT_Mask
extern

Definition at line 183 of file kddata.c.

◆ Kd_SCSERVER_Mask

ULONG Kd_SCSERVER_Mask
extern

Definition at line 182 of file kddata.c.

◆ Kd_SCSIMINIPORT_Mask

ULONG Kd_SCSIMINIPORT_Mask
extern

Definition at line 158 of file kddata.c.

◆ Kd_SCSIPORT_Mask

ULONG Kd_SCSIPORT_Mask
extern

Definition at line 157 of file kddata.c.

◆ Kd_SE_Mask

ULONG Kd_SE_Mask
extern

Definition at line 292 of file kddata.c.

◆ Kd_SERENUM_Mask

ULONG Kd_SERENUM_Mask
extern

Definition at line 185 of file kddata.c.

◆ Kd_SERIAL_Mask

ULONG Kd_SERIAL_Mask
extern

Definition at line 184 of file kddata.c.

◆ Kd_SERMOUSE_Mask

ULONG Kd_SERMOUSE_Mask
extern

Definition at line 161 of file kddata.c.

◆ Kd_SETUP_Mask

ULONG Kd_SETUP_Mask
extern

Definition at line 147 of file kddata.c.

◆ Kd_SHPC_Mask

ULONG Kd_SHPC_Mask
extern

Definition at line 233 of file kddata.c.

◆ Kd_SIS_Mask

ULONG Kd_SIS_Mask
extern

Definition at line 191 of file kddata.c.

◆ Kd_SMSS_Mask

ULONG Kd_SMSS_Mask
extern

Definition at line 146 of file kddata.c.

◆ Kd_SOFTPCI_Mask

ULONG Kd_SOFTPCI_Mask
extern

Definition at line 199 of file kddata.c.

◆ Kd_SR_Mask

ULONG Kd_SR_Mask
extern

Definition at line 220 of file kddata.c.

◆ Kd_SSPICLI_Mask

ULONG Kd_SSPICLI_Mask
extern

Definition at line 287 of file kddata.c.

◆ Kd_STORAGECLASSMEMORY_Mask

ULONG Kd_STORAGECLASSMEMORY_Mask
extern

Definition at line 307 of file kddata.c.

◆ Kd_STORMINIPORT_Mask

ULONG Kd_STORMINIPORT_Mask
extern

Definition at line 235 of file kddata.c.

◆ Kd_STORPORT_Mask

ULONG Kd_STORPORT_Mask
extern

Definition at line 234 of file kddata.c.

◆ Kd_STORPROP_Mask

ULONG Kd_STORPROP_Mask
extern

Definition at line 156 of file kddata.c.

◆ Kd_STORVSP_Mask

ULONG Kd_STORVSP_Mask
extern

Definition at line 285 of file kddata.c.

◆ Kd_SVCHOST_Mask

ULONG Kd_SVCHOST_Mask
extern

Definition at line 173 of file kddata.c.

◆ Kd_SXS_Mask

ULONG Kd_SXS_Mask
extern

Definition at line 196 of file kddata.c.

◆ Kd_SYSTEM_Mask

ULONG Kd_SYSTEM_Mask
extern

Definition at line 145 of file kddata.c.

◆ Kd_TAPE_Mask

ULONG Kd_TAPE_Mask
extern

Definition at line 200 of file kddata.c.

◆ Kd_TCPIP6_Mask

ULONG Kd_TCPIP6_Mask
extern

Definition at line 231 of file kddata.c.

◆ Kd_TCPIP_Mask

ULONG Kd_TCPIP_Mask
extern

Definition at line 175 of file kddata.c.

◆ Kd_TERMSRV_Mask

ULONG Kd_TERMSRV_Mask
extern

Definition at line 206 of file kddata.c.

◆ Kd_THREADORDER_Mask

ULONG Kd_THREADORDER_Mask
extern

Definition at line 263 of file kddata.c.

◆ Kd_TPM_Mask

ULONG Kd_TPM_Mask
extern

Definition at line 262 of file kddata.c.

◆ Kd_TWOTRACK_Mask

ULONG Kd_TWOTRACK_Mask
extern

Definition at line 167 of file kddata.c.

◆ Kd_TXF_Mask

ULONG Kd_TXF_Mask
extern

Definition at line 278 of file kddata.c.

◆ Kd_UDFS_Mask

ULONG Kd_UDFS_Mask
extern

Definition at line 283 of file kddata.c.

◆ Kd_UHCD_Mask

ULONG Kd_UHCD_Mask
extern

Definition at line 186 of file kddata.c.

◆ Kd_UNIMODEM_Mask

ULONG Kd_UNIMODEM_Mask
extern

Definition at line 190 of file kddata.c.

◆ Kd_USBSTOR_Mask

ULONG Kd_USBSTOR_Mask
extern

Definition at line 272 of file kddata.c.

◆ Kd_USERGDI_Mask

ULONG Kd_USERGDI_Mask
extern

Definition at line 260 of file kddata.c.

◆ Kd_VDS_Mask

ULONG Kd_VDS_Mask
extern

Definition at line 239 of file kddata.c.

◆ Kd_VDSBAS_Mask

ULONG Kd_VDSBAS_Mask
extern

Definition at line 240 of file kddata.c.

◆ Kd_VDSDYN_Mask

ULONG Kd_VDSDYN_Mask
extern

Definition at line 241 of file kddata.c.

◆ Kd_VDSDYNDR_Mask

ULONG Kd_VDSDYNDR_Mask
extern

Definition at line 242 of file kddata.c.

◆ Kd_VDSLDR_Mask

ULONG Kd_VDSLDR_Mask
extern

Definition at line 243 of file kddata.c.

◆ Kd_VDSUTIL_Mask

ULONG Kd_VDSUTIL_Mask
extern

Definition at line 244 of file kddata.c.

◆ Kd_VERIFIER_Mask

ULONG Kd_VERIFIER_Mask
extern

Definition at line 238 of file kddata.c.

◆ Kd_VIDEO_Mask

ULONG Kd_VIDEO_Mask
extern

Definition at line 172 of file kddata.c.

◆ Kd_VIDEOPRT_Mask

ULONG Kd_VIDEOPRT_Mask
extern

Definition at line 174 of file kddata.c.

◆ Kd_VPCI_Mask

ULONG Kd_VPCI_Mask
extern

Definition at line 306 of file kddata.c.

◆ Kd_VSS_Mask

ULONG Kd_VSS_Mask
extern

Definition at line 216 of file kddata.c.

◆ Kd_VSSDYNDISK_Mask

ULONG Kd_VSSDYNDISK_Mask
extern

Definition at line 237 of file kddata.c.

◆ Kd_W32TIME_Mask

ULONG Kd_W32TIME_Mask
extern

Definition at line 207 of file kddata.c.

◆ Kd_WDI_Mask

ULONG Kd_WDI_Mask
extern

Definition at line 254 of file kddata.c.

◆ Kd_WDT_Mask

ULONG Kd_WDT_Mask
extern

Definition at line 266 of file kddata.c.

◆ Kd_WER_Mask

ULONG Kd_WER_Mask
extern

Definition at line 301 of file kddata.c.

◆ Kd_WHEA_Mask

ULONG Kd_WHEA_Mask
extern

Definition at line 259 of file kddata.c.

◆ Kd_WIN2000_Mask

ULONG Kd_WIN2000_Mask
extern

Definition at line 144 of file kddata.c.

Referenced by NtQueryDebugFilterState(), and NtSetDebugFilterState().

◆ Kd_WMICORE_Mask

ULONG Kd_WMICORE_Mask
extern

Definition at line 193 of file kddata.c.

◆ Kd_WMILIB_Mask

ULONG Kd_WMILIB_Mask
extern

Definition at line 168 of file kddata.c.

◆ Kd_WOW64_Mask

ULONG Kd_WOW64_Mask
extern

Definition at line 249 of file kddata.c.

◆ Kd_WSOCKTRANSPORT_Mask

ULONG Kd_WSOCKTRANSPORT_Mask
extern

Definition at line 215 of file kddata.c.

◆ Kd_XSAVE_Mask

ULONG Kd_XSAVE_Mask
extern

Definition at line 291 of file kddata.c.

◆ KdAutoEnableOnEvent

BOOLEAN KdAutoEnableOnEvent
extern

Definition at line 84 of file kddata.c.

Referenced by KdInitSystem(), and KdpStub().

◆ KdBlockEnable

BOOLEAN KdBlockEnable
extern

◆ KdBreakAfterSymbolLoad

BOOLEAN KdBreakAfterSymbolLoad
extern

Definition at line 80 of file kddata.c.

Referenced by ExpInitializeExecutive(), and KdInitSystem().

◆ KdComponentTable

PULONG KdComponentTable[MAX_KD_COMPONENT_TABLE_ENTRIES]
extern

Definition at line 315 of file kddata.c.

Referenced by NtQueryDebugFilterState(), and NtSetDebugFilterState().

◆ KdComponentTableSize

ULONG KdComponentTableSize
extern

Definition at line 485 of file kddata.c.

Referenced by NtQueryDebugFilterState(), and NtSetDebugFilterState().

◆ KdDebuggerDataBlock

KDDEBUGGER_DATA64 KdDebuggerDataBlock
extern

Definition at line 21 of file kdpacket.c.

Referenced by GetVersionSendHandler().

◆ KdDisableCount

ULONG KdDisableCount
extern

Definition at line 90 of file kddata.c.

Referenced by KdDisableDebuggerWithLock(), and KdEnableDebuggerWithLock().

◆ KdEnteredDebugger

BOOLEAN KdEnteredDebugger
extern

Definition at line 89 of file kddata.c.

Referenced by KdEnterDebugger().

◆ KdIgnoreUmExceptions

BOOLEAN KdIgnoreUmExceptions
extern

Definition at line 86 of file kddata.c.

Referenced by KdInitSystem(), and KiDispatchException().

◆ KdpBreakpointInstruction

KD_BREAKPOINT_TYPE KdpBreakpointInstruction
extern

◆ KdpBreakpointTable

◆ KdpContext

◆ KdpContextSent

BOOLEAN KdpContextSent
extern

◆ KdpControlCPressed

BOOLEAN KdpControlCPressed
extern

Definition at line 68 of file kddata.c.

Referenced by KdPollBreakIn(), and KdpReport().

◆ KdpCurrentSymbolEnd

ULONG_PTR KdpCurrentSymbolEnd

Definition at line 580 of file kd64.h.

Referenced by KdpGetStateChange().

◆ KdpCurrentSymbolStart

ULONG_PTR KdpCurrentSymbolStart
extern

Definition at line 105 of file kddata.c.

Referenced by KdpGetStateChange().

◆ KdpDataSpinLock

KSPIN_LOCK KdpDataSpinLock
extern

Definition at line 491 of file kddata.c.

Referenced by KdRegisterDebuggerDataBlock().

◆ KdpDebuggerDataListHead

LIST_ENTRY KdpDebuggerDataListHead
extern

Definition at line 490 of file kddata.c.

Referenced by KdInitSystem(), and KdRegisterDebuggerDataBlock().

◆ KdpDebuggerLock

KSPIN_LOCK KdpDebuggerLock
extern

Definition at line 67 of file kddata.c.

Referenced by KdEnterDebugger(), KdPollBreakIn(), KdpPortLock(), and KdpPortUnlock().

◆ KdpDebuggerStructuresInitialized

BOOLEAN KdpDebuggerStructuresInitialized
extern

Definition at line 88 of file kddata.c.

Referenced by KdInitSystem().

◆ KdPerformanceCounterRate

LARGE_INTEGER KdPerformanceCounterRate
extern

Definition at line 91 of file kddata.c.

Referenced by KdInitSystem().

◆ KdPitchDebugger

◆ KdpMessageBuffer

CHAR KdpMessageBuffer[KDP_MSG_BUFFER_SIZE]
extern

◆ KdpNumInternalBreakpoints

ULONG KdpNumInternalBreakpoints
extern

Definition at line 100 of file kddata.c.

Referenced by KdpSendWaitContinue().

◆ KdpOweBreakpoint

BOOLEAN KdpOweBreakpoint
extern

◆ KdpPathBuffer

CHAR KdpPathBuffer[KDP_MSG_BUFFER_SIZE]
extern

Definition at line 128 of file kddata.c.

Referenced by KdpReportLoadSymbolsStateChange().

◆ KdpPortLocked

BOOLEAN KdpPortLocked
extern

Definition at line 66 of file kddata.c.

Referenced by KdEnterDebugger(), and KdExitDebugger().

◆ KdpPrintSpinLock

KSPIN_LOCK KdpPrintSpinLock
extern

Definition at line 139 of file kddata.c.

Referenced by KdLogDbgPrint().

◆ KdPreviouslyEnabled

BOOLEAN KdPreviouslyEnabled
extern

Definition at line 87 of file kddata.c.

Referenced by KdDisableDebuggerWithLock(), KdEnableDebuggerWithLock(), and KdpStub().

◆ KdPrintBufferChanges

ULONG KdPrintBufferChanges
extern

Definition at line 138 of file kddata.c.

◆ KdPrintBufferSize

ULONG KdPrintBufferSize
extern

Definition at line 137 of file kddata.c.

Referenced by KdLogDbgPrint().

◆ KdPrintCircularBuffer

PCHAR KdPrintCircularBuffer
extern

Definition at line 136 of file kddata.c.

Referenced by KdLogDbgPrint().

◆ KdPrintDefaultCircularBuffer

CHAR KdPrintDefaultCircularBuffer[KD_DEFAULT_LOG_BUFFER_SIZE]
extern

Definition at line 133 of file kddata.c.

◆ KdPrintRolloverCount

ULONG KdPrintRolloverCount
extern

Definition at line 135 of file kddata.c.

Referenced by KdLogDbgPrint().

◆ KdPrintWritePointer

PCHAR KdPrintWritePointer
extern

Definition at line 134 of file kddata.c.

Referenced by KdLogDbgPrint().

◆ KdpTimeSlipDpc

KDPC KdpTimeSlipDpc
extern

Definition at line 116 of file kddata.c.

Referenced by KdExitDebugger(), KdInitSystem(), and KdpTimeSlipWork().

◆ KdpTimeSlipEvent

PKEVENT KdpTimeSlipEvent
extern

Definition at line 120 of file kddata.c.

Referenced by KdpTimeSlipWork().

◆ KdpTimeSlipEventLock

KSPIN_LOCK KdpTimeSlipEventLock
extern

Definition at line 121 of file kddata.c.

Referenced by KdpTimeSlipWork().

◆ KdpTimeSlipPending

LONG KdpTimeSlipPending
extern

Definition at line 119 of file kddata.c.

Referenced by KdExitDebugger(), KdpTimeSlipDpcRoutine(), and Phase1InitializationDiscard().

◆ KdpTimeSlipTimer

KTIMER KdpTimeSlipTimer
extern

Definition at line 117 of file kddata.c.

Referenced by KdInitSystem(), and KdpTimeSlipWork().

◆ KdpTimeSlipWorkItem

WORK_QUEUE_ITEM KdpTimeSlipWorkItem
extern

Definition at line 118 of file kddata.c.

Referenced by KdInitSystem(), and KdpTimeSlipDpcRoutine().

◆ KdTimerDifference

LARGE_INTEGER KdTimerDifference

Definition at line 562 of file kd64.h.

Referenced by KdEnterDebugger().

◆ KdTimerStart

LARGE_INTEGER KdTimerStart

Definition at line 562 of file kd64.h.

Referenced by KdEnterDebugger(), KdExitDebugger(), and KdInitSystem().

◆ KdTimerStop

LARGE_INTEGER KdTimerStop
extern

Definition at line 122 of file kddata.c.

Referenced by KdEnterDebugger(), and KdExitDebugger().

◆ KdVersionBlock

DBGKD_GET_VERSION64 KdVersionBlock
extern

Definition at line 496 of file kddata.c.

Referenced by KdInitSystem(), KdpSysGetVersion(), and KiDispatchException().

◆ KiDebugRoutine

PKDEBUG_ROUTINE KiDebugRoutine
extern

Definition at line 74 of file kddata.c.

Referenced by KdDisableDebuggerWithLock(), KdInitSystem(), and KiDispatchException().

◆ KiDebugSwitchRoutine

PKDEBUG_SWITCH_ROUTINE KiDebugSwitchRoutine
extern

Definition at line 75 of file kddata.c.

Referenced by KdInitSystem().

◆ TraceDataBuffer

ULONG TraceDataBuffer[40]
extern

Definition at line 110 of file kddata.c.

Referenced by DumpTraceData().

◆ TraceDataBufferPosition

ULONG TraceDataBufferPosition
extern

Definition at line 111 of file kddata.c.

Referenced by DumpTraceData().