ReactOS 0.4.15-dev-7994-gb388cb6
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)
 

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)
 
KCONTINUE_STATUS NTAPI KdReportProcessorChange (VOID)
 
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
 
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 575 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.

Function Documentation

◆ KdDisableDebuggerWithLock()

NTSTATUS NTAPI KdDisableDebuggerWithLock ( IN BOOLEAN  NeedLock)

Definition at line 2066 of file kdapi.c.

2067{
2068 KIRQL OldIrql;
2070
2071#if defined(__GNUC__)
2072 /* Make gcc happy */
2074#endif
2075
2076 /*
2077 * If enabling the debugger is blocked
2078 * then there is nothing to disable (duh)
2079 */
2080 if (KdBlockEnable)
2081 {
2082 /* Fail */
2083 return STATUS_ACCESS_DENIED;
2084 }
2085
2086 /* Check if we need to acquire the lock */
2087 if (NeedLock)
2088 {
2089 /* Lock the port */
2091 KdpPortLock();
2092 }
2093
2094 /* Check if we're not disabled */
2095 if (!KdDisableCount)
2096 {
2097 /* Check if the debugger was never actually initialized */
2099 {
2100 /* It wasn't, so don't re-enable it later */
2102 }
2103 else
2104 {
2105 /* It was, so we will re-enable it later */
2107 }
2108
2109 /* Check if we were called from the exported API and are enabled */
2110 if ((NeedLock) && (KdPreviouslyEnabled))
2111 {
2112 /* Check if it is safe to disable the debugger */
2114 if (!NT_SUCCESS(Status))
2115 {
2116 /* Release the lock and fail */
2117 KdpPortUnlock();
2119 return Status;
2120 }
2121 }
2122
2123 /* Only disable the debugger if it is enabled */
2125 {
2126 /*
2127 * Disable the debugger; suspend breakpoints
2128 * and reset the debug stub
2129 */
2132
2133 /* We are disabled now */
2135 SharedUserData->KdDebuggerEnabled = FALSE;
2136 }
2137 }
2138
2139 /* Increment the disable count */
2141
2142 /* Check if we had locked the port before */
2143 if (NeedLock)
2144 {
2145 /* Yes, now unlock it */
2146 KdpPortUnlock();
2148 }
2149
2150 /* We're done */
2151 return STATUS_SUCCESS;
2152}
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:86
BOOLEAN KdPitchDebugger
Definition: kddata.c:80
BOOLEAN KdBlockEnable
Definition: kddata.c:84
VOID NTAPI KdpPortLock(VOID)
Definition: kdlock.c:19
ULONG KdDisableCount
Definition: kddata.c:89
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:82
#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 1990 of file kdapi.c.

1991{
1992 KIRQL OldIrql;
1993
1994#if defined(__GNUC__)
1995 /* Make gcc happy */
1997#endif
1998
1999 /* Check if enabling the debugger is blocked */
2000 if (KdBlockEnable)
2001 {
2002 /* It is, fail the enable */
2003 return STATUS_ACCESS_DENIED;
2004 }
2005
2006 /* Check if we need to acquire the lock */
2007 if (NeedLock)
2008 {
2009 /* Lock the port */
2011 KdpPortLock();
2012 }
2013
2014 /* Check if we're not disabled */
2015 if (!KdDisableCount)
2016 {
2017 /* Check if we had locked the port before */
2018 if (NeedLock)
2019 {
2020 /* Do the unlock */
2021 KdpPortUnlock();
2023
2024 /* Fail: We're already enabled */
2026 }
2027 else
2028 {
2029 /*
2030 * This can only happen if we are called from a bugcheck
2031 * and were never initialized, so initialize the debugger now.
2032 */
2033 KdInitSystem(0, NULL);
2034
2035 /* Return success since we initialized */
2036 return STATUS_SUCCESS;
2037 }
2038 }
2039
2040 /* Decrease the disable count */
2041 if (!(--KdDisableCount))
2042 {
2043 /* We're now enabled again! Were we enabled before, too? */
2045 {
2046 /* Reinitialize the Debugger */
2047 KdInitSystem(0, NULL);
2049 }
2050 }
2051
2052 /* Check if we had locked the port before */
2053 if (NeedLock)
2054 {
2055 /* Yes, now unlock it */
2056 KdpPortUnlock();
2058 }
2059
2060 /* We're done */
2061 return STATUS_SUCCESS;
2062}
#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 1902 of file kdapi.c.

1904{
1906
1907 /* Check if we have a trap frame */
1908 if (TrapFrame)
1909 {
1910 /* Calculate the time difference for the enter */
1914 }
1915 else
1916 {
1917 /* No trap frame, so can't calculate */
1919 }
1920
1921 /* Save the current IRQL */
1922 KeGetCurrentPrcb()->DebuggerSavedIRQL = KeGetCurrentIrql();
1923
1924 /* Freeze all CPUs, raising also the IRQL to HIGH_LEVEL */
1925 Enable = KeFreezeExecution(TrapFrame, ExceptionFrame);
1926
1927 /* Lock the port, save the state and set debugger entered */
1929 KdSave(FALSE);
1931
1932 /* Check freeze flag */
1933 if (KiFreezeFlag & 1)
1934 {
1935 /* Print out errror */
1936 KdpDprintf("FreezeLock was jammed! Backup SpinLock was used!\n");
1937 }
1938
1939 /* Check processor state */
1940 if (KiFreezeFlag & 2)
1941 {
1942 /* Print out errror */
1943 KdpDprintf("Some processors not frozen in debugger!\n");
1944 }
1945
1946 /* Make sure we acquired the port */
1947 if (!KdpPortLocked) KdpDprintf("Port lock was not acquired!\n");
1948
1949 /* Return if interrupts needs to be re-enabled */
1950 return Enable;
1951}
unsigned char BOOLEAN
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
LARGE_INTEGER KdTimerStop
Definition: kddata.c:121
BOOLEAN KdEnteredDebugger
Definition: kddata.c:88
LARGE_INTEGER KdTimerStart
Definition: kd64.h:550
KSPIN_LOCK KdpDebuggerLock
Definition: kddata.c:67
BOOLEAN KdpPortLocked
Definition: kddata.c:66
LARGE_INTEGER KdTimerDifference
Definition: kd64.h:550
LARGE_INTEGER NTAPI KdpQueryPerformanceCounter(IN PKTRAP_FRAME TrapFrame)
Definition: kdapi.c:1885
NTSTATUS NTAPI KdSave(IN BOOLEAN SleepTransition)
Definition: kdcom.c:113
#define KdpDprintf(...)
Definition: mmdbg.c:19
FORCEINLINE struct _KPRCB * KeGetCurrentPrcb(VOID)
Definition: ketypes.h:1161
_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 1955 of file kdapi.c.

1956{
1957 ULONG TimeSlip;
1958
1959 /* Restore the state and unlock the port */
1962
1963 /* Unfreeze the CPUs, restoring also the IRQL */
1965
1966 /* Compare time with the one from KdEnterDebugger */
1967 if (!KdTimerStop.QuadPart)
1968 {
1969 /* We didn't get a trap frame earlier in so never got the time */
1971 }
1972 else
1973 {
1974 /* Query the timer */
1976 }
1977
1978 /* Check if a Time Slip was on queue */
1980 if (TimeSlip == 1)
1981 {
1982 /* Queue a DPC for the time slip */
1984 KeInsertQueueDpc(&KdpTimeSlipDpc, NULL, NULL); // FIXME: this can trigger context switches!
1985 }
1986}
#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:118
KDPC KdpTimeSlipDpc
Definition: kddata.c:115
NTSTATUS NTAPI KdRestore(IN BOOLEAN SleepTransition)
Definition: kdcom.c:121
VOID NTAPI KeThawExecution(IN BOOLEAN Enable)
Definition: freeze.c:65
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 Retries */
365
366 /* Initialize breakpoints owed flag and table */
368 for (i = 0; i < KD_BREAKPOINT_MAX; i++)
369 {
373 }
374
375 /* Initialize the Time Slip DPC */
379
380 /* First-time initialization done! */
382 }
383
384 /* Initialize the timer */
386
387 /* Officially enable KD */
390
391 /* Let user-mode know that it's enabled as well */
392 SharedUserData->KdDebuggerEnabled = TRUE;
393
394 /* Display separator + ReactOS version at start of the debug log */
395 MemSizeMBs = KdpGetMemorySizeInMBs(KeLoaderBlock);
396 KdpPrintBanner(MemSizeMBs);
397
398 /* Check if the debugger should be disabled initially */
399 if (DisableKdAfterInit)
400 {
401 /* Disable it */
403
404 /*
405 * Save the enable block state and return initialized
406 * (the debugger is active but disabled).
407 */
408 KdBlockEnable = BlockEnable;
409 return TRUE;
410 }
411
412 /* Check if we have a loader block */
413 if (LoaderBlock)
414 {
415 /* Loop boot images */
416 NextEntry = LoaderBlock->LoadOrderListHead.Flink;
417 i = 0;
418 while ((NextEntry != &LoaderBlock->LoadOrderListHead) && (i < 2))
419 {
420 /* Get the image entry */
421 LdrEntry = CONTAINING_RECORD(NextEntry,
423 InLoadOrderLinks);
424
425 /* Generate the image name */
426 Name = LdrEntry->FullDllName.Buffer;
427 Length = LdrEntry->FullDllName.Length / sizeof(WCHAR);
428 j = 0;
429 do
430 {
431 /* Do cheap Unicode to ANSI conversion */
432 NameBuffer[j++] = (CHAR)*Name++;
433 } while (j < Length);
434
435 /* Null-terminate */
436 NameBuffer[j] = ANSI_NULL;
437
438 /* Load symbols for image */
439 RtlInitString(&ImageName, NameBuffer);
441 LdrEntry->DllBase,
443
444 /* Go to the next entry */
445 NextEntry = NextEntry->Flink;
446 i++;
447 }
448 }
449
450 /* Check for incoming breakin and break on symbol load if we have it */
452 }
453 else
454 {
455 /* Disable debugger */
457 }
458
459 /* Return initialized */
460 return TRUE;
461}
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:95
NTSTATUS NTAPI KdDisableDebuggerWithLock(IN BOOLEAN NeedLock)
Definition: kdapi.c:2066
LARGE_INTEGER KdPerformanceCounterRate
Definition: kddata.c:90
BOOLEAN KdBreakAfterSymbolLoad
Definition: kddata.c:79
DBGKD_GET_VERSION64 KdVersionBlock
Definition: kddata.c:495
VOID NTAPI KdpTimeSlipWork(IN PVOID Context)
Definition: kdapi.c:1863
BOOLEAN KdIgnoreUmExceptions
Definition: kddata.c:85
WORK_QUEUE_ITEM KdpTimeSlipWorkItem
Definition: kddata.c:117
KD_CONTEXT KdpContext
Definition: kddata.c:65
LIST_ENTRY KdpDebuggerDataListHead
Definition: kddata.c:489
BOOLEAN KdpDebuggerStructuresInitialized
Definition: kddata.c:87
VOID NTAPI KdpTimeSlipDpcRoutine(IN PKDPC Dpc, IN PVOID DeferredContext, IN PVOID SystemArgument1, IN PVOID SystemArgument2)
Definition: kdapi.c:1837
BOOLEAN KdpOweBreakpoint
Definition: kddata.c:97
KTIMER KdpTimeSlipTimer
Definition: kddata.c:116
BOOLEAN KdAutoEnableOnEvent
Definition: kddata.c:83
NTSTATUS NTAPI KdDebuggerInitialize0(IN PLOADER_PARAMETER_BLOCK LoaderBlock OPTIONAL)
Definition: kdcom.c:158
BOOLEAN KdDebuggerNotPresent
Definition: kddata.c:81
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:136
ULONG KdPrintRolloverCount
Definition: kddata.c:134
KSPIN_LOCK KdpPrintSpinLock
Definition: kddata.c:138
PCHAR KdPrintWritePointer
Definition: kddata.c:133
VOID NTAPI KdpMoveMemory(_In_ PVOID Destination, _In_ PVOID Source, _In_ SIZE_T Length)
Definition: kdapi.c:27
PCHAR KdPrintCircularBuffer
Definition: kddata.c:135
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:96
#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:1678
BOOLEAN NTAPI KdEnterDebugger(IN PKTRAP_FRAME TrapFrame, IN PKEXCEPTION_FRAME ExceptionFrame)
Definition: kdapi.c:1902
VOID NTAPI KdExitDebugger(IN BOOLEAN Enable)
Definition: kdapi.c:1955
#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:663
CONTEXT ContextFrame
Definition: ketypes.h:616
_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}
#define EFLAGS_TF
Definition: SystemCall.c:10
ULONG_PTR KdpCurrentSymbolEnd
Definition: kd64.h:568
ULONG_PTR KdpCurrentSymbolStart
Definition: kddata.c:104
CCHAR KeNumberProcessors
Definition: krnlinit.c:35
PKPRCB KiProcessorBlock[]
Definition: krnlinit.c:32
KSPECIAL_REGISTERS SpecialRegisters
Definition: ketypes.h:615
ULONG64 KernelDr7
Definition: ketypes.h:590
ULONG64 KernelDr6
Definition: ketypes.h:589

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:2383
#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:126
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::@3547 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 1678 of file kdapi.c.

1681{
1683 DBGKD_ANY_WAIT_STATE_CHANGE WaitStateChange;
1684 ULONG Length, ActualLength, TotalLength;
1686
1687 /* Start wait loop */
1688 do
1689 {
1690 /* Build the architecture common parts of the message */
1692 Context,
1693 &WaitStateChange);
1694
1695 /* Set the context */
1696 KdpSetContextState(&WaitStateChange, Context);
1697
1698 /* Clear the command string structure */
1699 KdpZeroMemory(&WaitStateChange.u.CommandString,
1700 sizeof(DBGKD_COMMAND_STRING));
1701
1702 /* Normalize name string to max */
1703 Length = min(128 - 1, NameString->Length);
1704
1705 /* Copy it to the message buffer */
1706 KdpCopyMemoryChunks((ULONG_PTR)NameString->Buffer,
1708 Length,
1709 0,
1711 &ActualLength);
1712
1713 /* Null terminate and calculate the total length */
1714 TotalLength = ActualLength;
1716
1717 /* Check if the command string is too long */
1718 Length = CommandString->Length;
1719 if (Length > (PACKET_MAX_SIZE -
1721 {
1722 /* Use maximum possible size */
1725 }
1726
1727 /* Copy it to the message buffer */
1728 KdpCopyMemoryChunks((ULONG_PTR)CommandString->Buffer,
1730 Length,
1731 0,
1733 &ActualLength);
1734
1735 /* Null terminate and calculate the total length */
1736 TotalLength += ActualLength;
1738
1739 /* Now set up the header and the data */
1740 Header.Length = sizeof(DBGKD_ANY_WAIT_STATE_CHANGE);
1741 Header.Buffer = (PCHAR)&WaitStateChange;
1742 Data.Length = (USHORT)TotalLength;
1743 Data.Buffer = KdpMessageBuffer;
1744
1745 /* Send State Change packet and wait for a reply */
1747 &Header,
1748 &Data,
1749 Context);
1751}
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:1287
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
DBGKD_COMMAND_STRING CommandString
Definition: windbgkd.h:510
union _DBGKD_ANY_WAIT_STATE_CHANGE::@3550 u
_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 1755 of file kdapi.c.

1758{
1760 DBGKD_ANY_WAIT_STATE_CHANGE WaitStateChange;
1762
1763 /* Start report loop */
1764 do
1765 {
1766 /* Build the architecture common parts of the message */
1768
1769#if !defined(_WIN64)
1770
1771 /* Convert it and copy it over */
1773 &WaitStateChange.u.Exception.ExceptionRecord);
1774
1775#else
1776
1777 /* Just copy it directly, no need to convert */
1778 KdpMoveMemory(&WaitStateChange.u.Exception.ExceptionRecord,
1779 ExceptionRecord,
1780 sizeof(EXCEPTION_RECORD));
1781
1782#endif
1783
1784 /* Set the First Chance flag */
1785 WaitStateChange.u.Exception.FirstChance = !SecondChanceException;
1786
1787 /* Now finish creating the structure */
1788 KdpSetContextState(&WaitStateChange, Context);
1789
1790 /* Setup the actual header to send to KD */
1791 Header.Length = sizeof(DBGKD_ANY_WAIT_STATE_CHANGE);
1792 Header.Buffer = (PCHAR)&WaitStateChange;
1793
1794 /* Setup the trace data */
1796
1797 /* Send State Change packet and wait for a reply */
1799 &Header,
1800 &Data,
1801 Context);
1803
1804 /* Return */
1805 return Status;
1806}
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 KdReportProcessorChange().

◆ KdpReportLoadSymbolsStateChange()

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

Definition at line 1606 of file kdapi.c.

1610{
1611 PSTRING ExtraData;
1613 DBGKD_ANY_WAIT_STATE_CHANGE WaitStateChange;
1614 ULONG PathNameLength;
1616
1617 /* Start wait loop */
1618 do
1619 {
1620 /* Build the architecture common parts of the message */
1622 Context,
1623 &WaitStateChange);
1624
1625 /* Now finish creating the structure */
1626 KdpSetContextState(&WaitStateChange, Context);
1627
1628 /* Fill out load data */
1629 WaitStateChange.u.LoadSymbols.UnloadSymbols = Unload;
1630 WaitStateChange.u.LoadSymbols.BaseOfDll = (ULONG64)(LONG_PTR)SymbolInfo->BaseOfDll;
1631 WaitStateChange.u.LoadSymbols.ProcessId = SymbolInfo->ProcessId;
1632 WaitStateChange.u.LoadSymbols.CheckSum = SymbolInfo->CheckSum;
1633 WaitStateChange.u.LoadSymbols.SizeOfImage = SymbolInfo->SizeOfImage;
1634
1635 /* Check if we have a path name */
1636 if (PathName)
1637 {
1638 /* Copy it to the path buffer */
1639 KdpCopyMemoryChunks((ULONG_PTR)PathName->Buffer,
1641 PathName->Length,
1642 0,
1644 &PathNameLength);
1645
1646 /* Null terminate */
1647 KdpPathBuffer[PathNameLength++] = ANSI_NULL;
1648
1649 /* Set the path length */
1650 WaitStateChange.u.LoadSymbols.PathNameLength = PathNameLength;
1651
1652 /* Set up the data */
1653 Data.Buffer = KdpPathBuffer;
1654 Data.Length = (USHORT)PathNameLength;
1655 ExtraData = &Data;
1656 }
1657 else
1658 {
1659 /* No name */
1660 WaitStateChange.u.LoadSymbols.PathNameLength = 0;
1661 ExtraData = NULL;
1662 }
1663
1664 /* Setup the header */
1665 Header.Length = sizeof(DBGKD_ANY_WAIT_STATE_CHANGE);
1666 Header.Buffer = (PCHAR)&WaitStateChange;
1667
1668 /* Send the packet */
1670 &Header,
1671 ExtraData,
1672 Context);
1674}
static VOID NTAPI Unload(PDRIVER_OBJECT DriverObject)
Definition: floppy.c:377
CHAR KdpPathBuffer[KDP_MSG_BUFFER_SIZE]
Definition: kddata.c:127
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:98
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:2161
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().

◆ 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:1606
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:650
#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 1837 of file kdapi.c.

1841{
1842 LONG OldSlip, NewSlip, PendingSlip;
1843
1844 /* Get the current pending slip */
1845 PendingSlip = KdpTimeSlipPending;
1846 do
1847 {
1848 /* Save the old value and either disable or enable it now. */
1849 OldSlip = PendingSlip;
1850 NewSlip = OldSlip > 1 ? 1 : 0;
1851
1852 /* Try to change the value */
1854 NewSlip,
1855 OldSlip) != OldSlip);
1856
1857 /* If the New Slip value is 1, then do the Time Slipping */
1859}
#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 1863 of file kdapi.c.

1864{
1865 KIRQL OldIrql;
1867
1868 /* Update the System time from the CMOS */
1872
1873 /* Check if we have a registered Time Slip Event and signal it */
1877
1878 /* Delay the DPC until it runs next time */
1879 DueTime.QuadPart = -1800000000;
1881}
#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:119
KSPIN_LOCK KdpTimeSlipEventLock
Definition: kddata.c:120
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().

◆ KdReportProcessorChange()

KCONTINUE_STATUS NTAPI KdReportProcessorChange ( VOID  )

Definition at line 1810 of file kdapi.c.

1812{
1813 PKPRCB CurrentPrcb = KeGetCurrentPrcb();
1815 EXCEPTION_RECORD ExceptionRecord = {0};
1817
1818 /* Save the port data */
1819 KdSave(FALSE);
1820
1823
1824 /* Report the new state */
1825 Status = KdpReportExceptionStateChange(&ExceptionRecord,
1827 FALSE);
1828
1829 /* Restore the port data */
1831
1832 return Status;
1833}
BOOLEAN NTAPI KdpReportExceptionStateChange(IN PEXCEPTION_RECORD ExceptionRecord, IN OUT PCONTEXT Context, IN BOOLEAN SecondChanceException)
Definition: kdapi.c:1755
#define STATUS_WAKE_SYSTEM_DEBUGGER
Definition: ntstatus.h:188
DWORD ExceptionCode
Definition: compat.h:208
PVOID ExceptionAddress
Definition: compat.h:211

Referenced by KiProcessorFreezeHandler().

◆ 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 98 of file kddata.c.

Referenced by KdpRestoreAllBreakpoints(), and KdpSuspendAllBreakPoints().

◆ Kd_ACPI_Mask

ULONG Kd_ACPI_Mask
extern

Definition at line 168 of file kddata.c.

◆ Kd_ALPC_Mask

ULONG Kd_ALPC_Mask
extern

Definition at line 252 of file kddata.c.

◆ Kd_AMLI_Mask

ULONG Kd_AMLI_Mask
extern

Definition at line 169 of file kddata.c.

◆ Kd_APPCOMPAT_Mask

ULONG Kd_APPCOMPAT_Mask
extern

Definition at line 270 of file kddata.c.

◆ Kd_AUTOCHK_Mask

ULONG Kd_AUTOCHK_Mask
extern

Definition at line 187 of file kddata.c.

◆ Kd_BURNENG_Mask

ULONG Kd_BURNENG_Mask
extern

Definition at line 193 of file kddata.c.

◆ Kd_CACHEMGR_Mask

ULONG Kd_CACHEMGR_Mask
extern

Definition at line 274 of file kddata.c.

◆ Kd_CAPIMG_Mask

ULONG Kd_CAPIMG_Mask
extern

Definition at line 304 of file kddata.c.

◆ Kd_CDAUDIO_Mask

ULONG Kd_CDAUDIO_Mask
extern

Definition at line 150 of file kddata.c.

◆ Kd_CDROM_Mask

ULONG Kd_CDROM_Mask
extern

Definition at line 151 of file kddata.c.

◆ Kd_CFR_Mask

ULONG Kd_CFR_Mask
extern

Definition at line 276 of file kddata.c.

◆ Kd_CLASSPNP_Mask

ULONG Kd_CLASSPNP_Mask
extern

Definition at line 152 of file kddata.c.

◆ Kd_CNG_Mask

ULONG Kd_CNG_Mask
extern

Definition at line 287 of file kddata.c.

◆ Kd_CONFIG_Mask

ULONG Kd_CONFIG_Mask
extern

Definition at line 158 of file kddata.c.

◆ Kd_COVERAGE_Mask

ULONG Kd_COVERAGE_Mask
extern

Definition at line 273 of file kddata.c.

◆ Kd_CRASHDUMP_Mask

ULONG Kd_CRASHDUMP_Mask
extern

Definition at line 149 of file kddata.c.

◆ Kd_CRASHDUMPXHCI_Mask

ULONG Kd_CRASHDUMPXHCI_Mask
extern

Definition at line 297 of file kddata.c.

◆ Kd_DCOMSS_Mask

ULONG Kd_DCOMSS_Mask
extern

Definition at line 188 of file kddata.c.

◆ Kd_DEFAULT_Mask

ULONG Kd_DEFAULT_Mask
extern

Definition at line 245 of file kddata.c.

Referenced by NtQueryDebugFilterState(), and NtSetDebugFilterState().

◆ Kd_DFRGIFC_Mask

ULONG Kd_DFRGIFC_Mask
extern

Definition at line 244 of file kddata.c.

◆ Kd_DFSC_Mask

ULONG Kd_DFSC_Mask
extern

Definition at line 247 of file kddata.c.

◆ Kd_DISK_Mask

ULONG Kd_DISK_Mask
extern

Definition at line 153 of file kddata.c.

◆ Kd_DMADMIN_Mask

ULONG Kd_DMADMIN_Mask
extern

Definition at line 213 of file kddata.c.

◆ Kd_DMCONFIG_Mask

ULONG Kd_DMCONFIG_Mask
extern

Definition at line 212 of file kddata.c.

◆ Kd_DMIO_Mask

ULONG Kd_DMIO_Mask
extern

Definition at line 211 of file kddata.c.

◆ Kd_DMSERVER_Mask

ULONG Kd_DMSERVER_Mask
extern

Definition at line 218 of file kddata.c.

◆ Kd_DMSYNTH_Mask

ULONG Kd_DMSYNTH_Mask
extern

Definition at line 175 of file kddata.c.

◆ Kd_DRIVEEXTENDER_Mask

ULONG Kd_DRIVEEXTENDER_Mask
extern

Definition at line 292 of file kddata.c.

◆ Kd_EMS_Mask

ULONG Kd_EMS_Mask
extern

Definition at line 264 of file kddata.c.

◆ Kd_ENVIRON_Mask

ULONG Kd_ENVIRON_Mask
extern

Definition at line 263 of file kddata.c.

◆ Kd_EXFAT_Mask

ULONG Kd_EXFAT_Mask
extern

Definition at line 288 of file kddata.c.

◆ Kd_FASTFAT_Mask

ULONG Kd_FASTFAT_Mask
extern

Definition at line 177 of file kddata.c.

◆ Kd_FCPORT_Mask

ULONG Kd_FCPORT_Mask
extern

Definition at line 209 of file kddata.c.

◆ Kd_FDC_Mask

ULONG Kd_FDC_Mask
extern

Definition at line 204 of file kddata.c.

◆ Kd_FILETRACE_Mask

ULONG Kd_FILETRACE_Mask
extern

Definition at line 289 of file kddata.c.

◆ Kd_FLOPPY_Mask

ULONG Kd_FLOPPY_Mask
extern

Definition at line 203 of file kddata.c.

◆ Kd_FLTMGR_Mask

ULONG Kd_FLTMGR_Mask
extern

Definition at line 191 of file kddata.c.

◆ Kd_FLTREGRESS_Mask

ULONG Kd_FLTREGRESS_Mask
extern

Definition at line 279 of file kddata.c.

◆ Kd_FSLIB_Mask

ULONG Kd_FSLIB_Mask
extern

Definition at line 307 of file kddata.c.

◆ Kd_FSTUB_Mask

ULONG Kd_FSTUB_Mask
extern

Definition at line 148 of file kddata.c.

◆ Kd_FUSION_Mask

ULONG Kd_FUSION_Mask
extern

Definition at line 196 of file kddata.c.

◆ Kd_FVEVOL_Mask

ULONG Kd_FVEVOL_Mask
extern

Definition at line 266 of file kddata.c.

◆ Kd_GPIO_Mask

ULONG Kd_GPIO_Mask
extern

Definition at line 298 of file kddata.c.

◆ Kd_HALIA64_Mask

ULONG Kd_HALIA64_Mask
extern

Definition at line 170 of file kddata.c.

◆ Kd_HEAP_Mask

ULONG Kd_HEAP_Mask
extern

Definition at line 257 of file kddata.c.

◆ Kd_HPS_Mask

ULONG Kd_HPS_Mask
extern

Definition at line 227 of file kddata.c.

◆ Kd_I8042PRT_Mask

ULONG Kd_I8042PRT_Mask
extern

Definition at line 159 of file kddata.c.

◆ Kd_IDEP_Mask

ULONG Kd_IDEP_Mask
extern

Definition at line 201 of file kddata.c.

◆ Kd_IDLETASK_Mask

ULONG Kd_IDLETASK_Mask
extern

Definition at line 197 of file kddata.c.

◆ Kd_IHVAUDIO_Mask

ULONG Kd_IHVAUDIO_Mask
extern

Definition at line 223 of file kddata.c.

◆ Kd_IHVBUS_Mask

ULONG Kd_IHVBUS_Mask
extern

Definition at line 226 of file kddata.c.

◆ Kd_IHVDRIVER_Mask

ULONG Kd_IHVDRIVER_Mask
extern

Definition at line 221 of file kddata.c.

◆ Kd_IHVNETWORK_Mask

ULONG Kd_IHVNETWORK_Mask
extern

Definition at line 224 of file kddata.c.

◆ Kd_IHVSTREAMING_Mask

ULONG Kd_IHVSTREAMING_Mask
extern

Definition at line 225 of file kddata.c.

◆ Kd_IHVVIDEO_Mask

ULONG Kd_IHVVIDEO_Mask
extern

Definition at line 222 of file kddata.c.

◆ Kd_IMAPI_Mask

ULONG Kd_IMAPI_Mask
extern

Definition at line 194 of file kddata.c.

◆ Kd_INFINIBAND_Mask

ULONG Kd_INFINIBAND_Mask
extern

Definition at line 220 of file kddata.c.

◆ Kd_IOSTRESS_Mask

ULONG Kd_IOSTRESS_Mask
extern

Definition at line 256 of file kddata.c.

◆ Kd_ISAPNP_Mask

ULONG Kd_ISAPNP_Mask
extern

Definition at line 231 of file kddata.c.

◆ Kd_KBDCLASS_Mask

ULONG Kd_KBDCLASS_Mask
extern

Definition at line 164 of file kddata.c.

◆ Kd_KBDHID_Mask

ULONG Kd_KBDHID_Mask
extern

Definition at line 162 of file kddata.c.

◆ Kd_KSECDD_Mask

ULONG Kd_KSECDD_Mask
extern

Definition at line 278 of file kddata.c.

◆ Kd_KTM_Mask

ULONG Kd_KTM_Mask
extern

Definition at line 255 of file kddata.c.

◆ Kd_LDR_Mask

ULONG Kd_LDR_Mask
extern

Definition at line 229 of file kddata.c.

◆ Kd_LSASS_Mask

ULONG Kd_LSASS_Mask
extern

Definition at line 285 of file kddata.c.

◆ Kd_LSERMOUS_Mask

ULONG Kd_LSERMOUS_Mask
extern

Definition at line 161 of file kddata.c.

◆ Kd_LUAFV_Mask

ULONG Kd_LUAFV_Mask
extern

Definition at line 269 of file kddata.c.

◆ Kd_MCHGR_Mask

ULONG Kd_MCHGR_Mask
extern

Definition at line 200 of file kddata.c.

◆ Kd_MM_Mask

ULONG Kd_MM_Mask
extern

Definition at line 246 of file kddata.c.

◆ Kd_MMCSS_Mask

ULONG Kd_MMCSS_Mask
extern

Definition at line 260 of file kddata.c.

◆ Kd_MOUCLASS_Mask

ULONG Kd_MOUCLASS_Mask
extern

Definition at line 165 of file kddata.c.

◆ Kd_MOUHID_Mask

ULONG Kd_MOUHID_Mask
extern

Definition at line 163 of file kddata.c.

◆ Kd_MOUNTMGR_Mask

ULONG Kd_MOUNTMGR_Mask
extern

Definition at line 275 of file kddata.c.

◆ Kd_MPIO_Mask

ULONG Kd_MPIO_Mask
extern

Definition at line 280 of file kddata.c.

◆ Kd_MSDSM_Mask

ULONG Kd_MSDSM_Mask
extern

Definition at line 281 of file kddata.c.

◆ Kd_NDIS_Mask

ULONG Kd_NDIS_Mask
extern

Definition at line 267 of file kddata.c.

◆ Kd_NETAPI_Mask

ULONG Kd_NETAPI_Mask
extern

Definition at line 180 of file kddata.c.

◆ Kd_NTFS_Mask

ULONG Kd_NTFS_Mask
extern

Definition at line 147 of file kddata.c.

◆ Kd_NTOSPNP_Mask

ULONG Kd_NTOSPNP_Mask
extern

Definition at line 176 of file kddata.c.

◆ Kd_NVCTRACE_Mask

ULONG Kd_NVCTRACE_Mask
extern

Definition at line 268 of file kddata.c.

◆ Kd_PCI_Mask

ULONG Kd_PCI_Mask
extern

Definition at line 210 of file kddata.c.

◆ Kd_PCIIDE_Mask

ULONG Kd_PCIIDE_Mask
extern

Definition at line 202 of file kddata.c.

◆ Kd_PERFLIB_Mask

ULONG Kd_PERFLIB_Mask
extern

Definition at line 254 of file kddata.c.

◆ Kd_PNPMEM_Mask

ULONG Kd_PNPMEM_Mask
extern

Definition at line 216 of file kddata.c.

◆ Kd_PNPMGR_Mask

ULONG Kd_PNPMGR_Mask
extern

Definition at line 179 of file kddata.c.

◆ Kd_POWER_Mask

ULONG Kd_POWER_Mask
extern

Definition at line 296 of file kddata.c.

◆ Kd_PREFETCHER_Mask

ULONG Kd_PREFETCHER_Mask
extern

Definition at line 207 of file kddata.c.

◆ Kd_PRINTSPOOLER_Mask

ULONG Kd_PRINTSPOOLER_Mask
extern

Definition at line 235 of file kddata.c.

◆ Kd_PROCESSOR_Mask

ULONG Kd_PROCESSOR_Mask
extern

Definition at line 217 of file kddata.c.

◆ Kd_PSHED_Mask

ULONG Kd_PSHED_Mask
extern

Definition at line 283 of file kddata.c.

◆ Kd_REDBOOK_Mask

ULONG Kd_REDBOOK_Mask
extern

Definition at line 154 of file kddata.c.

◆ Kd_REFS_Mask

ULONG Kd_REFS_Mask
extern

Definition at line 299 of file kddata.c.

◆ Kd_RPCPROXY_Mask

ULONG Kd_RPCPROXY_Mask
extern

Definition at line 186 of file kddata.c.

◆ Kd_RSFILTER_Mask

ULONG Kd_RSFILTER_Mask
extern

Definition at line 208 of file kddata.c.

◆ Kd_RTLTHREADPOOL_Mask

ULONG Kd_RTLTHREADPOOL_Mask
extern

Definition at line 228 of file kddata.c.

◆ Kd_SAMSS_Mask

ULONG Kd_SAMSS_Mask
extern

Definition at line 178 of file kddata.c.

◆ Kd_SBP2PORT_Mask

ULONG Kd_SBP2PORT_Mask
extern

Definition at line 272 of file kddata.c.

◆ Kd_SCCLIENT_Mask

ULONG Kd_SCCLIENT_Mask
extern

Definition at line 182 of file kddata.c.

◆ Kd_SCSERVER_Mask

ULONG Kd_SCSERVER_Mask
extern

Definition at line 181 of file kddata.c.

◆ Kd_SCSIMINIPORT_Mask

ULONG Kd_SCSIMINIPORT_Mask
extern

Definition at line 157 of file kddata.c.

◆ Kd_SCSIPORT_Mask

ULONG Kd_SCSIPORT_Mask
extern

Definition at line 156 of file kddata.c.

◆ Kd_SE_Mask

ULONG Kd_SE_Mask
extern

Definition at line 291 of file kddata.c.

◆ Kd_SERENUM_Mask

ULONG Kd_SERENUM_Mask
extern

Definition at line 184 of file kddata.c.

◆ Kd_SERIAL_Mask

ULONG Kd_SERIAL_Mask
extern

Definition at line 183 of file kddata.c.

◆ Kd_SERMOUSE_Mask

ULONG Kd_SERMOUSE_Mask
extern

Definition at line 160 of file kddata.c.

◆ Kd_SETUP_Mask

ULONG Kd_SETUP_Mask
extern

Definition at line 146 of file kddata.c.

◆ Kd_SHPC_Mask

ULONG Kd_SHPC_Mask
extern

Definition at line 232 of file kddata.c.

◆ Kd_SIS_Mask

ULONG Kd_SIS_Mask
extern

Definition at line 190 of file kddata.c.

◆ Kd_SMSS_Mask

ULONG Kd_SMSS_Mask
extern

Definition at line 145 of file kddata.c.

◆ Kd_SOFTPCI_Mask

ULONG Kd_SOFTPCI_Mask
extern

Definition at line 198 of file kddata.c.

◆ Kd_SR_Mask

ULONG Kd_SR_Mask
extern

Definition at line 219 of file kddata.c.

◆ Kd_SSPICLI_Mask

ULONG Kd_SSPICLI_Mask
extern

Definition at line 286 of file kddata.c.

◆ Kd_STORAGECLASSMEMORY_Mask

ULONG Kd_STORAGECLASSMEMORY_Mask
extern

Definition at line 306 of file kddata.c.

◆ Kd_STORMINIPORT_Mask

ULONG Kd_STORMINIPORT_Mask
extern

Definition at line 234 of file kddata.c.

◆ Kd_STORPORT_Mask

ULONG Kd_STORPORT_Mask
extern

Definition at line 233 of file kddata.c.

◆ Kd_STORPROP_Mask

ULONG Kd_STORPROP_Mask
extern

Definition at line 155 of file kddata.c.

◆ Kd_STORVSP_Mask

ULONG Kd_STORVSP_Mask
extern

Definition at line 284 of file kddata.c.

◆ Kd_SVCHOST_Mask

ULONG Kd_SVCHOST_Mask
extern

Definition at line 172 of file kddata.c.

◆ Kd_SXS_Mask

ULONG Kd_SXS_Mask
extern

Definition at line 195 of file kddata.c.

◆ Kd_SYSTEM_Mask

ULONG Kd_SYSTEM_Mask
extern

Definition at line 144 of file kddata.c.

◆ Kd_TAPE_Mask

ULONG Kd_TAPE_Mask
extern

Definition at line 199 of file kddata.c.

◆ Kd_TCPIP6_Mask

ULONG Kd_TCPIP6_Mask
extern

Definition at line 230 of file kddata.c.

◆ Kd_TCPIP_Mask

ULONG Kd_TCPIP_Mask
extern

Definition at line 174 of file kddata.c.

◆ Kd_TERMSRV_Mask

ULONG Kd_TERMSRV_Mask
extern

Definition at line 205 of file kddata.c.

◆ Kd_THREADORDER_Mask

ULONG Kd_THREADORDER_Mask
extern

Definition at line 262 of file kddata.c.

◆ Kd_TPM_Mask

ULONG Kd_TPM_Mask
extern

Definition at line 261 of file kddata.c.

◆ Kd_TWOTRACK_Mask

ULONG Kd_TWOTRACK_Mask
extern

Definition at line 166 of file kddata.c.

◆ Kd_TXF_Mask

ULONG Kd_TXF_Mask
extern

Definition at line 277 of file kddata.c.

◆ Kd_UDFS_Mask

ULONG Kd_UDFS_Mask
extern

Definition at line 282 of file kddata.c.

◆ Kd_UHCD_Mask

ULONG Kd_UHCD_Mask
extern

Definition at line 185 of file kddata.c.

◆ Kd_UNIMODEM_Mask

ULONG Kd_UNIMODEM_Mask
extern

Definition at line 189 of file kddata.c.

◆ Kd_USBSTOR_Mask

ULONG Kd_USBSTOR_Mask
extern

Definition at line 271 of file kddata.c.

◆ Kd_USERGDI_Mask

ULONG Kd_USERGDI_Mask
extern

Definition at line 259 of file kddata.c.

◆ Kd_VDS_Mask

ULONG Kd_VDS_Mask
extern

Definition at line 238 of file kddata.c.

◆ Kd_VDSBAS_Mask

ULONG Kd_VDSBAS_Mask
extern

Definition at line 239 of file kddata.c.

◆ Kd_VDSDYN_Mask

ULONG Kd_VDSDYN_Mask
extern

Definition at line 240 of file kddata.c.

◆ Kd_VDSDYNDR_Mask

ULONG Kd_VDSDYNDR_Mask
extern

Definition at line 241 of file kddata.c.

◆ Kd_VDSLDR_Mask

ULONG Kd_VDSLDR_Mask
extern

Definition at line 242 of file kddata.c.

◆ Kd_VDSUTIL_Mask

ULONG Kd_VDSUTIL_Mask
extern

Definition at line 243 of file kddata.c.

◆ Kd_VERIFIER_Mask

ULONG Kd_VERIFIER_Mask
extern

Definition at line 237 of file kddata.c.

◆ Kd_VIDEO_Mask

ULONG Kd_VIDEO_Mask
extern

Definition at line 171 of file kddata.c.

◆ Kd_VIDEOPRT_Mask

ULONG Kd_VIDEOPRT_Mask
extern

Definition at line 173 of file kddata.c.

◆ Kd_VPCI_Mask

ULONG Kd_VPCI_Mask
extern

Definition at line 305 of file kddata.c.

◆ Kd_VSS_Mask

ULONG Kd_VSS_Mask
extern

Definition at line 215 of file kddata.c.

◆ Kd_VSSDYNDISK_Mask

ULONG Kd_VSSDYNDISK_Mask
extern

Definition at line 236 of file kddata.c.

◆ Kd_W32TIME_Mask

ULONG Kd_W32TIME_Mask
extern

Definition at line 206 of file kddata.c.

◆ Kd_WDI_Mask

ULONG Kd_WDI_Mask
extern

Definition at line 253 of file kddata.c.

◆ Kd_WDT_Mask

ULONG Kd_WDT_Mask
extern

Definition at line 265 of file kddata.c.

◆ Kd_WER_Mask

ULONG Kd_WER_Mask
extern

Definition at line 300 of file kddata.c.

◆ Kd_WHEA_Mask

ULONG Kd_WHEA_Mask
extern

Definition at line 258 of file kddata.c.

◆ Kd_WIN2000_Mask

ULONG Kd_WIN2000_Mask
extern

Definition at line 143 of file kddata.c.

Referenced by NtQueryDebugFilterState(), and NtSetDebugFilterState().

◆ Kd_WMICORE_Mask

ULONG Kd_WMICORE_Mask
extern

Definition at line 192 of file kddata.c.

◆ Kd_WMILIB_Mask

ULONG Kd_WMILIB_Mask
extern

Definition at line 167 of file kddata.c.

◆ Kd_WOW64_Mask

ULONG Kd_WOW64_Mask
extern

Definition at line 248 of file kddata.c.

◆ Kd_WSOCKTRANSPORT_Mask

ULONG Kd_WSOCKTRANSPORT_Mask
extern

Definition at line 214 of file kddata.c.

◆ Kd_XSAVE_Mask

ULONG Kd_XSAVE_Mask
extern

Definition at line 290 of file kddata.c.

◆ KdAutoEnableOnEvent

BOOLEAN KdAutoEnableOnEvent
extern

Definition at line 83 of file kddata.c.

Referenced by KdInitSystem(), and KdpStub().

◆ KdBlockEnable

BOOLEAN KdBlockEnable
extern

◆ KdBreakAfterSymbolLoad

BOOLEAN KdBreakAfterSymbolLoad
extern

Definition at line 79 of file kddata.c.

Referenced by ExpInitializeExecutive(), and KdInitSystem().

◆ KdComponentTable

PULONG KdComponentTable[MAX_KD_COMPONENT_TABLE_ENTRIES]
extern

Definition at line 314 of file kddata.c.

Referenced by NtQueryDebugFilterState(), and NtSetDebugFilterState().

◆ KdComponentTableSize

ULONG KdComponentTableSize
extern

Definition at line 484 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 89 of file kddata.c.

Referenced by KdDisableDebuggerWithLock(), and KdEnableDebuggerWithLock().

◆ KdEnteredDebugger

BOOLEAN KdEnteredDebugger
extern

Definition at line 88 of file kddata.c.

Referenced by KdEnterDebugger().

◆ KdIgnoreUmExceptions

BOOLEAN KdIgnoreUmExceptions
extern

Definition at line 85 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 568 of file kd64.h.

Referenced by KdpGetStateChange().

◆ KdpCurrentSymbolStart

ULONG_PTR KdpCurrentSymbolStart
extern

Definition at line 104 of file kddata.c.

Referenced by KdpGetStateChange().

◆ KdpDataSpinLock

KSPIN_LOCK KdpDataSpinLock
extern

Definition at line 490 of file kddata.c.

Referenced by KdRegisterDebuggerDataBlock().

◆ KdpDebuggerDataListHead

LIST_ENTRY KdpDebuggerDataListHead
extern

Definition at line 489 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 87 of file kddata.c.

Referenced by KdInitSystem().

◆ KdPerformanceCounterRate

LARGE_INTEGER KdPerformanceCounterRate
extern

Definition at line 90 of file kddata.c.

Referenced by KdInitSystem().

◆ KdPitchDebugger

◆ KdpMessageBuffer

CHAR KdpMessageBuffer[KDP_MSG_BUFFER_SIZE]
extern

◆ KdpNumInternalBreakpoints

ULONG KdpNumInternalBreakpoints
extern

Definition at line 99 of file kddata.c.

Referenced by KdpSendWaitContinue().

◆ KdpOweBreakpoint

BOOLEAN KdpOweBreakpoint
extern

◆ KdpPathBuffer

CHAR KdpPathBuffer[KDP_MSG_BUFFER_SIZE]
extern

Definition at line 127 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 138 of file kddata.c.

Referenced by KdLogDbgPrint().

◆ KdPreviouslyEnabled

BOOLEAN KdPreviouslyEnabled
extern

Definition at line 86 of file kddata.c.

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

◆ KdPrintBufferChanges

ULONG KdPrintBufferChanges
extern

Definition at line 137 of file kddata.c.

◆ KdPrintBufferSize

ULONG KdPrintBufferSize
extern

Definition at line 136 of file kddata.c.

Referenced by KdLogDbgPrint().

◆ KdPrintCircularBuffer

PCHAR KdPrintCircularBuffer
extern

Definition at line 135 of file kddata.c.

Referenced by KdLogDbgPrint().

◆ KdPrintDefaultCircularBuffer

CHAR KdPrintDefaultCircularBuffer[KD_DEFAULT_LOG_BUFFER_SIZE]
extern

Definition at line 132 of file kddata.c.

◆ KdPrintRolloverCount

ULONG KdPrintRolloverCount
extern

Definition at line 134 of file kddata.c.

Referenced by KdLogDbgPrint().

◆ KdPrintWritePointer

PCHAR KdPrintWritePointer
extern

Definition at line 133 of file kddata.c.

Referenced by KdLogDbgPrint().

◆ KdpTimeSlipDpc

KDPC KdpTimeSlipDpc
extern

Definition at line 115 of file kddata.c.

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

◆ KdpTimeSlipEvent

PKEVENT KdpTimeSlipEvent
extern

Definition at line 119 of file kddata.c.

Referenced by KdpTimeSlipWork().

◆ KdpTimeSlipEventLock

KSPIN_LOCK KdpTimeSlipEventLock
extern

Definition at line 120 of file kddata.c.

Referenced by KdpTimeSlipWork().

◆ KdpTimeSlipPending

LONG KdpTimeSlipPending
extern

Definition at line 118 of file kddata.c.

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

◆ KdpTimeSlipTimer

KTIMER KdpTimeSlipTimer
extern

Definition at line 116 of file kddata.c.

Referenced by KdInitSystem(), and KdpTimeSlipWork().

◆ KdpTimeSlipWorkItem

WORK_QUEUE_ITEM KdpTimeSlipWorkItem
extern

Definition at line 117 of file kddata.c.

Referenced by KdInitSystem(), and KdpTimeSlipDpcRoutine().

◆ KdTimerDifference

LARGE_INTEGER KdTimerDifference

Definition at line 550 of file kd64.h.

Referenced by KdEnterDebugger().

◆ KdTimerStart

LARGE_INTEGER KdTimerStart

Definition at line 550 of file kd64.h.

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

◆ KdTimerStop

LARGE_INTEGER KdTimerStop
extern

Definition at line 121 of file kddata.c.

Referenced by KdEnterDebugger(), and KdExitDebugger().

◆ KdVersionBlock

DBGKD_GET_VERSION64 KdVersionBlock
extern

Definition at line 495 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().

◆ TraceDataBuffer

ULONG TraceDataBuffer[40]
extern

Definition at line 109 of file kddata.c.

Referenced by DumpTraceData().

◆ TraceDataBufferPosition

ULONG TraceDataBufferPosition
extern

Definition at line 110 of file kddata.c.

Referenced by DumpTraceData().