Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows Kernel Debbuging: Debug over virtual serial port with WDK 8.1

I'm currently having some issues doing kernel debugging of a Windows 7 x64 target from my Windows 8.1 x64 host machine. I'm running Visual Studio 2013 with WDK 8.1 on my host and have provisioned my target machine running in VMWare.

Here are my configurations for the target machine. It was configured by reading mostly from here - http://www.codeproject.com/Tips/545835/Kernel-Mode-Debugging-in-a-VM-using-Visual-Studio :

  • Windows 7 x64
  • Serial port COM2 with VMWare with name \\.\pipe\com2. All proper options in VMWare are checked
  • Debug flag for OS enabled through msconfig. Debug port is COM2 running at 115200 baud.
  • I ran the test target client "WDK Test Target Setup x64-x64_en-us.exe" on the machine before provisioning the computer

I was able to provision the computer properly -- it created the WDK Remove User account. However, I'm running into some issues actually debugging. Below are the steps

  1. Launch the Windows 7 x64 target image in VMWare and wait on the boot menu
  2. In Visual Studio (host machine), go to Debug -> Attach to process -> Select my computer -> Select process "Kernel" -> Attach
  3. In VMWare, press enter to boot Windows
  4. It takes a while, but on my host machine, Visual Studio eventually connects. I can choose to "Break All" and actually use the debugger.

However, I can't seem to connect to the debugger if I don't do it before booting the kernel. And I can only attach once. For example, I can't let Windows initialize to the desktop and then build my driver and begin debugging. The debugger will always hang on "Waiting to reconnect...". The same goes for if I begin debugging on kernel initialization, decide to stop debugging, then try to reconnect or reattach; it will hang on "Waiting to reconnect..." indefinitely as well.

like image 279
xtef_ Avatar asked Nov 01 '22 05:11

xtef_


1 Answers

Please use WinDbg for kernel debugging. WinDbg comes with the WDK, and it will save you so much trouble vs using VS2013. Check out Setting Up Kernel-Mode Debugging of a Virtual Machine Manually for detail instructions. If you have trouble getting WinDbg to work, I can help you, but I have already gave up on kernel debugging using VS2013.

like image 195
tchau.dev Avatar answered Nov 08 '22 02:11

tchau.dev