Debugger setup for VM’s (works for Vista+; minor changes needed for downlevel – ask if needed)
1) On the host, install the debuggers via //dbg/privates/latest/dbginstall.cmd.
2) In the Hyper-V management UI, open your VM’s settings.
3) Click on COM 1 in the Hardware hierarchy. Note this can be modified regardless of whether the VM is running or not.
4) Select Named pipe.
5) Enter in the Pipe name field, enter a name for your pipe. I like to use the convention of VmName_COM1, so for my VM RCHINN-DE1, I enter RCHINN-DE1_COM1.
6) Click OK to apply the changes.
7) Open an elevated command prompt.
8) Navigate to the folder where your debuggers were installed (typically c:/debuggers).
9) Run the following command to open a KD remote server connected to your VM’s virtual COM port.
//quattrofs/public/iostress/StartKdRemote.cmd MYCOLOVM npipe mycolovm_com1
10) At this point, you should have a command prompt that looks something like the following. Take note of the “To Connect” string that’s printed out. You will need to send this to whomever you want to connect to the remote and debug.
11) Get your VM booted and into Windows if it isn’t already.
12) From an elevated command prompt, run the following.
bcdedit /debug on
13) From an elevated command prompt, run the following and ensure you see the highlighted fields.
bcdedit /dbgsettings
debugtype Serial
debugport 1
baudrate 115200
14) Reboot your VM.
15) You should see some debug spew in the KD remote you saw in step 10. If not, you can try hitting CTRL+C to see if it will break in. If it doesn’t break in, you need to debug the setup. Double check your named pipe naming, the BCD options, kill and restart the KD session, and reboot the VM.
References: http://dbg, especially http://dbg/kernel_debugging.html.
Reference:
StartKdRemote.cmd:
@echo off
if {%1}=={} (
call :Usage
exit /b 1
)
if {%2}=={} (
call :Usage
exit /b 1
)
if {%3}=={} (
call :Usage
exit /b 1
)
setlocal
set DEBUGEE_NAME=%1
set TRANSPORT_TYPE=%2
set TRANSPORT_PARAM=%3
if not defined _NT_SYMBOL_PATH (
set _NT_SYMBOL_PATH=SRV*c:/symbols*//ntdev.corp.microsoft.com/MainLabRelease/win7_rtm/7600.16385.090713-1255/amd64fre/symbols.pri/indexes;SRV*c:/symbols*//ntdev.corp.microsoft.com/MainLabRelease/win7_rtm/7600.16385.090713-1255/x86fre/symbols.pri/indexes;SRV*c:/symbols*//434217n08-09/symbols;SRV*c:/symbols*//symbols/symbols
)
set PATH=%PATH%;c:/debuggers
if /i {%TRANSPORT_TYPE%}=={NPIPE} (
echo remote /s "kd -k com:port=//./pipe/%TRANSPORT_PARAM%,pipe,resets=0,reconnect" %DEBUGEE_NAME%
remote /s "kd -k com:port=//./pipe/%TRANSPORT_PARAM%,pipe,resets=0,reconnect" %DEBUGEE_NAME%
) else if /i {%TRANSPORT_TYPE%}=={1394} (
echo remote /s "kd -k 1394:channel=%TRANSPORT_PARAM%" %DEBUGEE_NAME%
remote /s "kd -k 1394:channel=%TRANSPORT_PARAM%" %DEBUGEE_NAME%
) else if /i {%TRANSPORT_TYPE%}=={COM} (
echo remote /s "kd -k com:port=%TRANSPORT_PARAM%,baud=115200" %DEBUGEE_NAME%
remote /s "kd -k com:port=%TRANSPORT_PARAM%,baud=115200" %DEBUGEE_NAME%
) else (
echo Invalid TRANSPORT_TYPE %TRANSPORT_TYPE%.
call :Usage
pause
exit /b 1
)
echo.
echo.
echo.
echo ----- NOTE -----
echo.
echo If you got an error starting up the remote, please make sure you are running
echo from an elevated CMD prompt and verify you don't already have a remote open.
echo.
endlocal
exit /b 0
:Usage
echo.
echo Usage:
echo.
echo StartKdRemote.cmd {Debugee, i.e. Colorado Computer Name} npipe {local pipe name -- what was typed in Hyper-V}
echo.
echo StartKdRemote.cmd {Debugee, i.e. Colorado Computer Name} 1394 {channel number}
echo.
echo StartKdRemote.cmd {Debugee, i.e. Colorado Computer Name} com {port number}
echo.
echo Examples:
echo.
echo StartKdRemote.cmd MYCOLOVM npipe mycolovm_com1
echo.
echo StartKdRemote.cmd MYAURORA 1394 10
echo.
echo StartKdRemote.cmd MYVAIL com 3
echo.
echo.
goto :EOF