Serial Debugging with WinDbg and VMWare

When debugging a Windows GINA, driver, or service it is sometimes necessary to debug a target computer from a second computer via the serial port. Using the same concept, you can debug a target VMWare computer from the host computer using a named pipe.

For this example, I am using VMWare Workstation 5.5.3 build-34685 with a Windows XP Professional SP 2 virtual machine. On the host computer (also Windows XP Professional SP2) I am using WinDbg 6.7.0005.0.

Part 1: Create a named pipe on the VMWare target machine.

  1. In VMWare Workstation select VM \ Settings from the menu.
  2. In the Virtual Machine Settings window select the Hardware tab (if not already selected).
    VMWare Virtual Machine Settings
  3. Click the Add button to launch the Add Hardware Wizard.
  4. In the Add Hardware Wizard Welcome screen click the Next button.
    VMWare Add Hardware Wizard
  5. In the Add Hardware Wizard Hardware Type screen select Serial Port and click the Next button.
    VMWare Hardware Type
  6. In the Add Hardware Wizard Serial Port Type screen select Output to named pipe and click the Next button.
    VMWare Serial Port Type
  7. In the Add Hardware Wizard Specify Named Pipe screen do the following:
    1. Use the default pipe name of:
      \\.\pipe\com_1
    2. Select This end is the server.
    3. Select The other end is an application.
    4. Tick the Connect at power on check box.
    5. Click the Advanced button.

    VMWare Specify Named Pipe

  8. In the Add hardware Wizard Specify Advanced Options screen tick the Yield CPU on poll check box and click the Finish button.
    VMWare Specify Advanced Options
  9. In the Virtual Machine Settings window click the OK button.

Part 2: Modify the VMWare target machine boot.ini file.

  1. Boot the VMWare target machine.
  2. Remove the read-only permissions from c:\boot.ini if they exist.
  3. Copy an existing Windows line and append the following to the end of it:
    /debugport=com1 /baudrate=115200 /break
  4. Your boot.ini file should look something like this when you are done:
    [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="Microsoft Windows XP Professional" /fastdetect
    multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional - Debug COM1" /fastdetect /debugport=com1 /baudrate=115200 /break

    See “Boot INI Options Reference” for more info.

  5. Restart the virtual machine and select the new Debug boot option.
    Windows XP Debug Boot Menu

Part 3: Run WinDbg

  1. Launch WinDbg.
  2. Select File \ Kernel Debug from the menu.
  3. In the Kernel Debugging window do the following:
    1. Enter 115200 for the Baud Rate.
    2. Enter the following for the Port.
      \\.\pipe\com_1
    3. Tick the Pipe check box.
    4. Remove tick from the Reconnect check box.
    5. Enter 0 for Resets.
    6. Click the OK button.

    WinDbg Kernal Debugging Settings

  4. WinDbg should connect and break.
    WinDbg Kernal Debugging

You are ready to debug.

You can leave a response, or trackback from your own site.

Leave a Reply