ReactOS  0.4.13-dev-479-gec9c8fd
kdfuncs.h File Reference

Go to the source code of this file.

Macros

#define KdPrint(_x_)
 
#define KdPrintEx(_x_)
 
#define vKdPrintEx(_x_)
 
#define vKdPrintExWithPrefix(_x_)
 
#define KdBreakPoint()
 
#define KdBreakPointWithStatus(s)
 
#define KD_DEBUGGER_ENABLED   (*KdDebuggerEnabled)
 
#define KD_DEBUGGER_NOT_PRESENT   (*KdDebuggerNotPresent)
 

Typedefs

typedef VOID(* PDEBUG_PRINT_CALLBACK) (_In_ PSTRING Output, _In_ ULONG ComponentId, _In_ ULONG Level)
 

Functions

 $if (_NTDDK_) NTSYSAPI ULONG NTAPI DbgPrompt(_In_z_ PCCH Prompt
 
 _Out_writes_bytes_ (MaximumResponseLength) PCH Response
 
 $endif (_NTDDK_) $if(_WDMDDK_) ULONG __cdecl DbgPrint(_In_z_ _Printf_format_string_ PCSTR Format
 
NTSYSAPI ULONG __cdecl DbgPrintReturnControlC (_In_z_ _Printf_format_string_ PCCH Format,...)
 
NTSYSAPI ULONG __cdecl DbgPrintEx (_In_ ULONG ComponentId, _In_ ULONG Level, _In_z_ _Printf_format_string_ PCSTR Format,...)
 
NTSYSAPI NTSTATUS NTAPI DbgQueryDebugFilterState (_In_ ULONG ComponentId, _In_ ULONG Level)
 
NTSYSAPI NTSTATUS NTAPI DbgSetDebugFilterState (_In_ ULONG ComponentId, _In_ ULONG Level, _In_ BOOLEAN State)
 
NTSYSAPI NTSTATUS NTAPI DbgSetDebugPrintCallback (_In_ PDEBUG_PRINT_CALLBACK DebugPrintCallback, _In_ BOOLEAN Enable)
 
NTKERNELAPI NTSTATUS NTAPI KdDisableDebugger (VOID)
 
NTKERNELAPI NTSTATUS NTAPI KdEnableDebugger (VOID)
 
__analysis_noreturn VOID NTAPI DbgBreakPoint (VOID)
 
__analysis_noreturn NTSYSAPI VOID NTAPI DbgBreakPointWithStatus (_In_ ULONG Status)
 
NTKERNELAPI BOOLEAN NTAPI KdRefreshDebuggerNotPresent (VOID)
 
NTKERNELAPI NTSTATUS NTAPI KdChangeOption (_In_ KD_OPTION Option, _In_opt_ ULONG InBufferBytes, _In_ PVOID InBuffer, _In_opt_ ULONG OutBufferBytes, _Out_ PVOID OutBuffer, _Out_opt_ PULONG OutBufferNeeded)
 

Variables

_In_ ULONG MaximumResponseLength
 
BOOLEANKdDebuggerEnabled
 
BOOLEANKdDebuggerNotPresent
 

Macro Definition Documentation

◆ KD_DEBUGGER_ENABLED

#define KD_DEBUGGER_ENABLED   (*KdDebuggerEnabled)

Definition at line 130 of file kdfuncs.h.

◆ KD_DEBUGGER_NOT_PRESENT

#define KD_DEBUGGER_NOT_PRESENT   (*KdDebuggerNotPresent)

Definition at line 133 of file kdfuncs.h.

◆ KdBreakPoint

#define KdBreakPoint ( )

Definition at line 117 of file kdfuncs.h.

◆ KdBreakPointWithStatus

#define KdBreakPointWithStatus (   s)

Definition at line 118 of file kdfuncs.h.

◆ KdPrint

#define KdPrint (   _x_)

Definition at line 113 of file kdfuncs.h.

◆ KdPrintEx

#define KdPrintEx (   _x_)

Definition at line 114 of file kdfuncs.h.

◆ vKdPrintEx

#define vKdPrintEx (   _x_)

Definition at line 115 of file kdfuncs.h.

◆ vKdPrintExWithPrefix

#define vKdPrintExWithPrefix (   _x_)

Definition at line 116 of file kdfuncs.h.

Typedef Documentation

◆ PDEBUG_PRINT_CALLBACK

typedef VOID(* PDEBUG_PRINT_CALLBACK) (_In_ PSTRING Output, _In_ ULONG ComponentId, _In_ ULONG Level)

Definition at line 86 of file kdfuncs.h.

Function Documentation

◆ $endif()

$endif ( _NTDDK_  )

Definition at line 2487 of file iofuncs.h.

2495 {
2496  PriorityInfo->Size = sizeof(IO_PRIORITY_INFO);
2497  PriorityInfo->ThreadPriority = 0xffff;
2498  PriorityInfo->IoPriority = IoPriorityNormal;
2499  PriorityInfo->PagePriority = 0;
2500 }
struct _IO_PRIORITY_INFO IO_PRIORITY_INFO
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD _Inout_ PIO_PRIORITY_INFO PriorityInfo
Definition: fltkernel.h:2653

◆ $if()

$if ( _NTDDK_  )

Definition at line 167 of file ke.h.

206  {
207  ULONG64 P1Home;
208  ULONG64 P2Home;
209  ULONG64 P3Home;
210  ULONG64 P4Home;
211  ULONG64 P5Home;
212  ULONG64 P6Home;
213  ULONG ContextFlags;
214  ULONG MxCsr;
215  USHORT SegCs;
216  USHORT SegDs;
217  USHORT SegEs;
218  USHORT SegFs;
219  USHORT SegGs;
220  USHORT SegSs;
221  ULONG EFlags;
222  ULONG64 Dr0;
223  ULONG64 Dr1;
224  ULONG64 Dr2;
225  ULONG64 Dr3;
226  ULONG64 Dr6;
227  ULONG64 Dr7;
228  ULONG64 Rax;
229  ULONG64 Rcx;
230  ULONG64 Rdx;
231  ULONG64 Rbx;
232  ULONG64 Rsp;
233  ULONG64 Rbp;
234  ULONG64 Rsi;
235  ULONG64 Rdi;
236  ULONG64 R8;
237  ULONG64 R9;
238  ULONG64 R10;
239  ULONG64 R11;
240  ULONG64 R12;
241  ULONG64 R13;
242  ULONG64 R14;
243  ULONG64 R15;
244  ULONG64 Rip;
245  union {
246  XMM_SAVE_AREA32 FltSave;
247  struct {
248  M128A Header[2];
249  M128A Legacy[8];
250  M128A Xmm0;
251  M128A Xmm1;
252  M128A Xmm2;
253  M128A Xmm3;
254  M128A Xmm4;
255  M128A Xmm5;
256  M128A Xmm6;
257  M128A Xmm7;
258  M128A Xmm8;
259  M128A Xmm9;
260  M128A Xmm10;
261  M128A Xmm11;
262  M128A Xmm12;
263  M128A Xmm13;
264  M128A Xmm14;
265  M128A Xmm15;
266  } DUMMYSTRUCTNAME;
267  } DUMMYUNIONNAME;
268  M128A VectorRegister[26];
269  ULONG64 VectorControl;
270  ULONG64 DebugControl;
271  ULONG64 LastBranchToRip;
272  ULONG64 LastBranchFromRip;
273  ULONG64 LastExceptionToRip;
274  ULONG64 LastExceptionFromRip;
275 } CONTEXT;
M128A
Definition: ketypes.h:918
#define DUMMYUNIONNAME
Definition: ntbasedef.h:32
Definition: Header.h:8
unsigned __int64 ULONG64
Definition: imports.h:198
struct _CONTEXT CONTEXT
unsigned short USHORT
Definition: pedump.c:61
XSAVE_FORMAT XMM_SAVE_AREA32
Definition: ke.h:35
unsigned int ULONG
Definition: retypes.h:1
#define DUMMYSTRUCTNAME
Definition: ntbasedef.h:58

◆ _Out_writes_bytes_()

_Out_writes_bytes_ ( MaximumResponseLength  )

◆ DbgBreakPoint()

__analysis_noreturn VOID NTAPI DbgBreakPoint ( VOID  )

Definition at line 558 of file mach.c.

558  {
559  __asm__("twi 31,0,0");
560 }
__asm__("\t.globl GetPhys\n" "GetPhys:\t\n" "mflr 0\n\t" "stwu 0,-16(1)\n\t" "mfmsr 5\n\t" "andi. 6,5,0xffef\n\t" "mtmsr 6\n\t" "isync\n\t" "sync\n\t" "lwz 3,0(3)\n\t" "mtmsr 5\n\t" "isync\n\t" "sync\n\t" "lwz 0,0(1)\n\t" "addi 1,1,16\n\t" "mtlr 0\n\t" "blr")

Referenced by __cxa_pure_virtual(), __declspec(), ARPTransmit(), BaseInitializeContext(), CsrApiRequestThread(), CsrCaptureArguments(), CsrIdentifyAlertableThread(), CsrSetPriorityClass(), CsrShutdownProcesses(), CsrValidateMessageBuffer(), DbgUiRemoteBreakin(), DeviceInterfaceChangeCallback(), Dispatch_fnDeviceIoControl(), DriverEntry(), EHCI_InterruptTransfer(), EHCI_QueryEndpointRequirements(), EHCI_SetAsyncEndpointState(), EHCI_SetEndpointStatus(), EHCI_SubmitTransfer(), EHCI_SuspendController(), ExAllocatePoolWithTag(), ExpInsertPoolTracker(), ExpRemovePoolTracker(), ExpWaitForResource(), FatalExit(), FatCompleteRequest_Real(), FatExceptionFilter(), FatMultiAsyncCompletionRoutine(), FatMultiSyncCompletionRoutine(), FatSingleAsyncCompletionRoutine(), FatSingleSyncCompletionRoutine(), HalClearSoftwareInterrupt(), HalpAddDevice(), HalpGetParameters(), HalpOpcodeInvalid(), HalRequestSoftwareInterrupt(), HalReturnToFirmware(), IKsPin_PinStatePropertyHandler(), KeFlushIoBuffers(), KeStartThread(), KeUpdateRunTime(), KiCheckTimerTable(), KiIpiServiceRoutine(), KsPinAttemptProcessing(), KsStreamPointerAdvance(), KsStreamPointerAdvanceOffsets(), KsStreamPointerAdvanceOffsetsAndUnlock(), KsStreamPointerDelete(), KsStreamPointerGetNextClone(), LdrpInitializeProcess(), LdrpRunInitializeRoutines(), MiSubsectionConsistent(), NdisInitializeWrapper(), NtProcessStartup(), ObInsertObject(), OHCI_InsertEndpointInSchedule(), OHCI_PollAsyncEndpoint(), OHCI_QueryEndpointRequirements(), OHCI_RemoveEndpointFromSchedule(), PciBeginStateTransition(), PciDispatchIrp(), PcRegisterSubdevice(), PinPropertyHandler(), PspCatchCriticalBreak(), Reboot(), RtlApplicationVerifierStop(), RtlAssert(), RtlInterlockedPushListSList(), RtlpDphAllocateVm(), RtlpDphEnterCriticalSection(), RtlpDphFreeVm(), RtlpDphPointerFromHandle(), RtlpDphProtectVm(), RtlpDphRemoveFromAvailableList(), RtlpPageHeapAllocate(), RtlpPageHeapDestroy(), RtlpPageHeapFree(), RxAssert(), SetLastError(), SmpAllocateSessionId(), SmpUnhandledExceptionFilter(), SpiParseDeviceInfo(), StreamClassDebugAssert(), UhciInterruptService(), UhciQueryEndpointRequirements(), UhciRHPortResetComplete(), UhciStopController(), USBH_ChangeIndicationWorker(), USBH_CompletePortWakeIrpsWorker(), USBH_DeviceControl(), USBH_FdoIdleNotificationCallback(), USBH_FdoPower(), USBH_FdoQueryBusRelations(), USBH_FdoStartDevice(), USBH_FdoStopDevice(), USBH_FdoWWIrpIoCompletion(), USBH_FlushPortPwrList(), USBH_HubCompleteQueuedPortIdleIrps(), USBH_HubCompleteQueuedPortWakeIrps(), USBH_HubDispatch(), USBH_HubQueuePortIdleIrps(), USBH_HubQueuePortWakeIrps(), USBH_PdoDispatch(), USBH_PdoInternalControl(), USBH_PdoPnP(), USBH_PdoStopDevice(), USBH_PdoUrbFilter(), USBH_PowerIrpCompletion(), USBH_ProcessPortStateChange(), USBH_SelectConfigOrInterfaceComplete(), USBHUB_IrpStub(), USBPORT_AllocateBandwidthUSB2(), USBPORT_Dispatch(), USBPORT_DmaEndpointWorker(), USBPORT_PdoDevicePowerState(), USBPORT_RestoreDevice(), USBPORT_RootHubClassCommand(), USBPORT_RootHubCreateDevice(), USBPORT_SplitBulkInterruptTransfer(), USBPORT_StopDevice(), UserLoadKbdDll(), WdmAudControlOpenMixer(), and wmain().

◆ DbgBreakPointWithStatus()

__analysis_noreturn NTSYSAPI VOID NTAPI DbgBreakPointWithStatus ( _In_ ULONG  Status)

◆ DbgPrintEx()

NTSYSAPI ULONG __cdecl DbgPrintEx ( _In_ ULONG  ComponentId,
_In_ ULONG  Level,
_In_z_ _Printf_format_string_ PCSTR  Format,
  ... 
)

◆ DbgPrintReturnControlC()

NTSYSAPI ULONG __cdecl DbgPrintReturnControlC ( _In_z_ _Printf_format_string_ PCCH  Format,
  ... 
)

◆ DbgQueryDebugFilterState()

NTSYSAPI NTSTATUS NTAPI DbgQueryDebugFilterState ( _In_ ULONG  ComponentId,
_In_ ULONG  Level 
)

Referenced by DisplayIPPacket().

◆ DbgSetDebugFilterState()

NTSYSAPI NTSTATUS NTAPI DbgSetDebugFilterState ( _In_ ULONG  ComponentId,
_In_ ULONG  Level,
_In_ BOOLEAN  State 
)

Referenced by DriverEntry().

◆ DbgSetDebugPrintCallback()

NTSYSAPI NTSTATUS NTAPI DbgSetDebugPrintCallback ( _In_ PDEBUG_PRINT_CALLBACK  DebugPrintCallback,
_In_ BOOLEAN  Enable 
)

◆ KdChangeOption()

NTKERNELAPI NTSTATUS NTAPI KdChangeOption ( _In_ KD_OPTION  Option,
_In_opt_ ULONG  InBufferBytes,
_In_ PVOID  InBuffer,
_In_opt_ ULONG  OutBufferBytes,
_Out_ PVOID  OutBuffer,
_Out_opt_ PULONG  OutBufferNeeded 
)

◆ KdDisableDebugger()

NTKERNELAPI NTSTATUS NTAPI KdDisableDebugger ( VOID  )

Definition at line 295 of file kdmain.c.

296 {
297  KIRQL OldIrql;
298 
299  /* Raise IRQL */
301 
302  /* TODO: Disable any breakpoints */
303 
304  /* Disable the Debugger */
306  SharedUserData->KdDebuggerEnabled = FALSE;
307 
308  /* Lower the IRQL */
310 
311  /* Return success */
312  return STATUS_SUCCESS;
313 }
#define KeRaiseIrql(irql, oldIrql)
Definition: env_spec_w32.h:597
#define KeLowerIrql(oldIrql)
Definition: env_spec_w32.h:602
UCHAR KIRQL
Definition: env_spec_w32.h:591
BOOLEAN KdDebuggerEnabled
Definition: kdmain.c:16
#define SharedUserData
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
return STATUS_SUCCESS
Definition: btrfs.c:2777

Referenced by PcipGetFunctionLimits().

◆ KdEnableDebugger()

NTKERNELAPI NTSTATUS NTAPI KdEnableDebugger ( VOID  )

Definition at line 327 of file kdmain.c.

328 {
329  KIRQL OldIrql;
330 
331  /* Raise IRQL */
333 
334  /* TODO: Re-enable any breakpoints */
335 
336  /* Enable the Debugger */
338  SharedUserData->KdDebuggerEnabled = TRUE;
339 
340  /* Lower the IRQL */
342 
343  /* Return success */
344  return STATUS_SUCCESS;
345 }
#define KeRaiseIrql(irql, oldIrql)
Definition: env_spec_w32.h:597
#define TRUE
Definition: types.h:120
#define KeLowerIrql(oldIrql)
Definition: env_spec_w32.h:602
UCHAR KIRQL
Definition: env_spec_w32.h:591
BOOLEAN KdDebuggerEnabled
Definition: kdmain.c:16
#define SharedUserData
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
return STATUS_SUCCESS
Definition: btrfs.c:2777

Referenced by KdpStub(), and PcipGetFunctionLimits().

◆ KdRefreshDebuggerNotPresent()

NTKERNELAPI BOOLEAN NTAPI KdRefreshDebuggerNotPresent ( VOID  )

Definition at line 282 of file kdmain.c.

283 {
285 
286  /* Just return whatever was set previously -- FIXME! */
287  return KdDebuggerNotPresent;
288 }
#define UNIMPLEMENTED
Definition: debug.h:114
BOOLEAN KdDebuggerNotPresent
Definition: kdmain.c:18

Variable Documentation

◆ KdDebuggerEnabled

◆ KdDebuggerNotPresent

◆ MaximumResponseLength

_In_ ULONG MaximumResponseLength

Definition at line 11 of file kdfuncs.h.

Referenced by DbgPrompt(), and KdpPrompt().