On a Windows machine we can enable kernel debugging over a serial connection by doing the following steps. Run these commands on the test computer being debugged, not on the computer running the debugger.
- Open an elevated command prompt.
- From the command prompt run the below commands.
bcdedit /debug ON
bcdedit /dbgsettings SERIAL DEBUGPORT:1 BAUDRATE:115200
Here DEBUGPORT:1 selects COM1 on the test computer. Change it if you are using a different COM port. For a physical serial connection, connect the two computers with a null-modem cable and configure the debugger to use the same baud rate, 115200. Restart the test computer for the change to take effect.
These commands configure the target; they do not start a debugger session by themselves. See Microsoft’s serial-debugging instructions for the debugger-side setup.
Use this on a test computer. Changing boot settings can affect startup, and BitLocker or Secure Boot may require special handling. Check Microsoft’s BCDEdit precautions before changing those protections.
If the above commands are run from a non-elevated command prompt then you will get the following error.
The boot configuration data store could not be opened. Access is denied.
To disable kernel debugging after testing, run the below command from an elevated command prompt and restart the computer.
bcdedit /debug OFF