Windows Driver Kit: Driver Development Tools
Boot Parameters to Enable Debugging
When a kernel debugging connection is established, the system gives a kernel debugger control over its execution. Also, when a bug check occurs or a kernel-mode program communicates with a debugger, the computer waits for a response from a kernel debugger before it continues.
There are four basic debugging methods that you can configure by using boot parameters:
- Single-computer (local) debugging
- Debugging with a null-modem cable
- Debugging with an IEEE 1394 cable (only if the target computer and the host computer are both running Microsoft Windows XP or a later version of Windows)
- Debugging with a USB 2.0 debug cable (only if the target computer is running Windows Vista or a later version of Windows and the host computer is running Windows 2000 or a later version of Windows)
Boot Parameters for Local Debugging in Operating Systems Prior to Windows Vista
To enable kernel debugging on a single computer, add the /debug parameter to a boot entry. Do not add any other debugging-related parameters to a boot entry.
The first boot entry in the following sample Boot.ini file includes the /debug parameter.
[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Local Debugging" /fastdetect /debug
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /fastdetect
The following Bootcfg command enables local debugging. The Bootcfg /debug switch, with a value of ON, adds the /debug parameter to a boot entry. The /ID switch identifies the boot entry.
bootcfg /debug ON /ID 1
The following sample Bootcfg display of a system with a Boot.ini file shows the result. The first boot entry is configured for local debugging.
Boot Entries
------------
Boot entry ID: 1
OS Friendly Name: Windows XP Local Debugging
Path: multi(0)disk(0)rdisk(0)partition(2)\WINDOWS
OS Load Options: /fastdetect /debug
Boot entry ID: 2
OS Friendly Name: Microsoft Windows XP
Path: multi(0)disk(0)rdisk(0)partition(2)\WINDOWS
OS Load Options: /fastdetect
Boot Option for Local Debugging in Windows Vista and Later
To enable kernel debugging on a single computer, use the BCDEdit /debug boot option.
To use BCDEdit, open a Command Prompt window with elevated privileges (right click Command Prompt and click Run as administrator from the shortcut menu).
The /debug option has the following syntax:
bcdedit /debug [{ID}] { on | off }
The {ID} is the GUID associated with a boot entry. If an {ID} is not specified, the settings apply to the current boot entry. The following command enables kernel debugging for the current Windows operating system boot entry:
bcdedit /debug on
The following command enables kernel debugging for the specified Windows operating system boot entry:
bcdedit /debug {18b123cd-2bf6-11db-bfae-00e018e2b8db} on
You can use the bcdedit /enum command to view the current boot entries, their settings, and to identify the GUID associated with each entry.
For more details, see BCDEdit /debug.
Boot Parameters to Debug with a Null-modem Cable in Operating Systems prior to Windows Vista
To enable debugging with a null-modem cable, add the /debug parameter with the /debugport and /baudrate subparameters to a boot entry.
The first boot entry in the following sample Boot.ini file is configured for debugging with a null modem cable.
[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Debugging with Cable" /fastdetect /debug /debugport=COM1 /baudrate=57600
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /fastdetect
Set the value of the /debugport subparameter to a COM port on the computer. Set the value of the /baudrate subparameter to the connection speed of the cable. (19200 bits per second is the default.)
The following Bootcfg command enables debugging on the first boot entry. It sets the debugging port to COM1, and it sets the baud rate to 57,600 BPS.
The Bootcfg /debug switch with a value of ON adds the /debug parameter to the boot entry. The Bootcfg /port switch adds the /debugport subparameter with a value of COM1. The Bootcfg /baud switch adds the /baudrate subparameter with a value of 57600. The /ID switch identifies the boot entry.
bootcfg /debug ON /port COM1 /baud 57600 /ID 1
The following Bootcfg sample shows the resulting boot entry on an Itanium-based system. The newly added parameters are displayed in bold type.
Boot Entries
------------
Boot entry ID: 1
OS Friendly Name: Windows Server 2003, Enterprise
OsLoadOptions: /debug /debugport=COM1 /baudrate=57600
BootFilePath: \Device\HarddiskVolume1\EFI\Microsoft\WINNT50\ia64ldr.efi
OsFilePath: \Device\HarddiskVolume3\WINDOWS
Boot Options to Debug with a Null-modem Cable in Windows Vista and Later
To enable debugging with a null-modem cable in Windows Vista and later, use BCDEdit and set the debugging connection type to "SERIAL". You can set this globally by using the BCDEdit /dbgsettings command followed by serial, or set it for a specific boot entry by using the BCDEdit /set command followed by debugtype serial. You must also use the BCDEdit /debug command to enable kernel debugging globally or for the desired operating system.
If BCDEdit has not been used, the default global debug settings are for serial communications, using COM1 and a baud rate of 115,200.
To display the current settings, use the following command:
bcdedit /dbgsettings
debugtype Serial
debugport 1
baudrate 115200
To use BCDEdit, open a Command Prompt window with elevated privileges (right click Command Prompt and click Run as administrator from the shortcut menu).
To set the global debug settings to serial communications, use the following syntax:
bcdedit /dbgsettings serial [DEBUGPORT:port] [BAUDRATE:baud]
The following example shows how to specify serial communications as the global debug setting.
bcdedit /dbgsettings serial debugport:1 baudrate:115200
To set the debug settings to serial for a specific boot entry, or for the current entry, use the following syntax:
bcdedit /set [{ID}] [ debugtype serial | [DEBUGPORT port] | [BAUDRATE baud] ]
If no {ID} is specified, the settings apply to the currently active boot entry.
The following example shows how to specify the serial debug settings for a specific boot entry.
bcdedit /set {18b123cd-2bf6-11db-bfae-00e018e2b8db} debugtype serial
bcdedit /set {18b123cd-2bf6-11db-bfae-00e018e2b8db} debugport 1
bcdedit /set {18b123cd-2bf6-11db-bfae-00e018e2b8db} baudrate 115200
You can use the bcdedit /enum command to view the current boot entries and their settings.
For more details, see BCDEdit /debug and BCDEdit /dbgsettings.
Boot Parameters to Debug with a 1394 Cable in Operating Systems prior to Windows Vista
If your host computer and target computer are both running Windows XP or later, you can perform kernel debugging with an IEEE 1394 (FireWire) cable.
To enable debugging with an IEEE 1394 cable, add the /debug parameter with the /debugport and /channel subparameters to a boot entry. Set the value of the /debugport subparameter to 1394. Set the value of the /channel subparameter to the cable channel.
The first boot entry in the following sample Boot.ini file is configured for debugging with a 1394 cable.
[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Debugging with 1394" /fastdetect /debug /debugport=1394 /channel=44
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /fastdetect
The following Bootcfg command enables debugging with a 1394 cable and sets the debugging channel to 44. The /dbg1394 switch with a value of ON adds the /debug parameter and /debugport=1394 subparameter to the boot entry, and the /ch switch adds the /channel subparameter to the boot entry. The /id switch identifies the second boot entry.
bootcfg /dbg1394 ON /ch 44 /id 2
The following Bootcfg displays shows the result of the command on a system with a Boot.ini file. The newly added parameters are displayed in bold type. The computer now has boot options for both a nondebug startup of Windows XP and a startup that enables debugging with a 1394 cable. The nondebugging startup is the default.
Boot Entries
------------
Boot entry ID: 1
Friendly Name: "Microsoft Windows XP Professional"
Path: multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
OS Load Options: /fastdetect
Boot entry ID: 2
Friendly Name: "1394 Debug Windows XP"
Path: multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
OS Load Options: /fastdetect /debug /debugport=1394 /channel=44
Note To perform kernel debugging with a 1394 cable when the target computer is running Windows Server 2003 (with no service packs installed) or Windows XP with Service Pack 1 (SP1), you must disable the 1394 host controller on the target computer and install the 1394 virtual driver that is included in the Debugging Tools for Windows package on the host computer. For instructions about these required steps, see the "Disabling the 1394 Host Controller" and "Installing the 1394 Virtual Driver" topics in the
Debugging Tools for Windows documentation.
Boot Parameters to Debug with a 1394 Cable in Windows Vista and Later
To enable debugging with an IEEE 1394 cable in Windows Vista and later, use BCDEdit and set the debugging connection type to "1394". You can set this globally by using the BCDEdit /dbgsettings command followed by 1394, or set it for a specific boot entry by using the BCDEdit /set command followed by debugtype 1394. You must also use the BCDEdit /debug command to enable kernel debugging globally or for the desired operating system.
To use BCDEdit, open a Command Prompt window with elevated privileges (right click Command Prompt and click Run as administrator from the shortcut menu).
To set the debug settings for 1394 globally, use the following syntax:
bcdedit /dbgsettings 1394 [channel:channel]
The following example shows how to specify 1394 as the global debug setting.
bcdedit /dbgsettings 1394 channel:32
To set the debug settings to serial for a specific boot entry, or for the current entry, use the following syntax:
bcdedit /set [{ID}] [ debugtype 1394 | channel channel ]
If an {ID} is not specified, the settings apply to the current boot entry.
The following example shows how to specify the 1394 debug settings for a specific boot entry, and how to use the /debug option to enable kernel debugging for that boot entry.
bcdedit /set {18b123cd-2bf6-11db-bfae-00e018e2b8db} debugtype 1394
bcdedit /set {18b123cd-2bf6-11db-bfae-00e018e2b8db} channel 32
bcdedit /debug {18b123cd-2bf6-11db-bfae-00e018e2b8db} on
You can use the bcdedit /enum command to view the current boot entries and their settings.
For more details, see BCDEdit /debug and BCDEdit /dbgsettings.
Boot Parameters to Debug with a USB 2.0 Debugging Cable in Operating Systems prior to Windows Vista
Debugging with a USB 2.0 debugging cable is not supported on a target computer running a version of Windows prior to Windows Vista.
Boot Parameters to Debug with a USB 2.0 Debugging Cable in Windows Vista and Later
If your target computer is running Windows Vista or later, and your host computer is running Windows 2000 or later, you can perform kernel debugging with a USB 2.0 debugging cable.
To enable debugging with a USB cable in these versions of Windows, use BCDEdit and set the debugging connection type to "USB". You can set this globally by using the BCDEdit /dbgsettings command followed by usb, or set it for a specific boot entry by using the BCDEdit /set command followed by debugtype usb. You must also use the BCDEdit /debug command to enable kernel debugging globally or for the desired operating system.
To use BCDEdit, open a Command Prompt window with elevated privileges (right click Command Prompt and click Run as administrator from the shortcut menu).
To set the debug settings for USB globally, use the following syntax:
bcdedit /dbgsettings usb [targetname:targetname]
The following example shows how to specify USB as the global debug setting.
bcdedit /dbgsettings usb targetname:U1
To set the debug settings to serial for a specific boot entry, or for the current entry, use the following syntax:
bcdedit /set [{ID}] [ debugtype usb | targetname targetname ]
If no {ID} is specified, the settings apply to the current boot entry.
The following example shows how to specify the USB debug settings for a specific boot entry, and how to use the /debug command to enable kernel debugging for that boot entry.
bcdedit /set {18b123cd-2bf6-11db-bfae-00e018e2b8db} debugtype usb
bcdedit /set {18b123cd-2bf6-11db-bfae-00e018e2b8db} targetname u2
bcdedit /debug {18b123cd-2bf6-11db-bfae-00e018e2b8db} on
You can use the bcdedit /enum command to view the current boot entries and their settings.
For more details, see BCDEdit /debug and BCDEdit /dbgsettings.
Boot Parameters to Debug the Boot Process in Windows Vista and Later
If your target computer is running Windows Vista or later, and your host computer is running Windows 2000 or later, you can perform boot debugging of one of the boot components.
To enable boot debugging, use the BCDEdit /bootdebug command and specify the appropriate boot component. If you wish to perform kernel debugging after Windows starts, use the BCDEdit /debug command as well.
You must also select a debugging connection (serial, 1394, or USB 2.0). This can be done with either the BCDEdit /dbgsettings or BCDEdit /set command, just as in normal kernel debugging. command to enable debugging.
For more details, see BCDEdit /bootdebug.