KD_DEBUGGER_NOT_PRESENT

The KD_DEBUGGER_NOT_PRESENT global kernel variable indicates whether a kernel debugger is currently attached.

Remarks

The value of KD_DEBUGGER_NOT_PRESENT is determined as follows:

  • If debugging was not enabled on the computer at boot time, the value is 1.

  • If debugging was enabled on the computer at boot time, but no kernel debugger is currently attached, the value is 1.

  • If debugging was enabled on the computer at boot time, and a kernel debugger is currently attached, the value is 0.

If a kernel debugger was recently attached or removed, the value of KD_DEBUGGER_NOT_PRESENT may not reflect the new state. If you suspect this has happened, you should call KdRefreshDebuggerNotPresent to refresh the value of this variable. Since the return value of KdRefreshDebuggerNotPresent is the same as the value of KD_DEBUGGER_NOT_PRESENT, you can use this return value instead of the variable itself. The KdRefreshDebuggerNotPresent is only available on Microsoft Windows Server 2003 and later.

The following sample shows how to use KD_DEBUGGER_NOT_PRESENT:

if (KD_DEBUGGER_NOT_PRESENT == FALSE)
{
    //  A kernel debugger is active.
    DbgPrint("A problem occurred\n");
 DbgBreakPoint();
}
else
{
 //  No kernel debugger attached, or kernel debugging not enabled.
 KeBugCheckEx(...);
}

Requirements

Version

Available in in Microsoft Windows XP and later.

Header

Ntddk.h (include Wdm.h or Ntddk.h)

See also

Determining if a Debugger is Attached

KD_DEBUGGER_ENABLED

KdRefreshDebuggerNotPresent

 

 

Send comments about this topic to Microsoft