...
- Boot the HVM you want to debug and create a boot entry for debugging. On XP it would involves adding a boot.ini entry. First the file needs to be unhidden and made writable:
C:\>attrib -r -h -s boot.ini
The copy an existing line from the boot.ini file and paste a new one in - make it look like this:multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /debug /debugport=COM1 /baudrate=115200
- On Vista and Win7 you need to use the bcdedit tool to setup a new boot entry. First lauch a command windows as Administrator and do this:
bcdedit /copy {current} /d win7debug
Then run msconfig from the same command windows. Select the Boot tab and locate your new win7debug boot entry. Select it and Advanced options. Check the Debug checkbox and in the Global debug settings section set the Debug port to COM1 and the Baud reate to 115200. Note that the Debugging Tools For Windows help has information on setting up both the host and target machines. - Shut the VM down and first disable SELinux - it will interfere with debugging. From a terminal in dom0:
# disable for until reboot nr setenforce 0 # or disable forever, first you need to make the fs writeable rw # edit /etc/selinux/config and set to permissive ro
- Next edit the xenvm config file for the VM. Add a virtual serial port to it that connect to the host machine as follows. The values can be set in a VM's config file using the folloiwing command in dom0 (note the nodelay option turns of naggling which can disrupt debugger operation):
db-write /vm/<uuid>/config/extra-xenvm/0 "serial=tcp:<ip>:<port>,nodelay"
This also works:xec-vm -n <vmname> set extra-xenvm "serial=tcp:<ip>:<port>,nodelay"
The examples above have qemu connecting out to a listening sockpipe. You can also have qemu listen for incoming sockpipe connections (as a server) with the following (note the nowait will prevent qemu from waiting for a client connection):xec-vm -n <vmname> set extra-xenvm "serial=tcp::<port>,server,nodelay,nowait"
- Important: If XL is in use (as with later versions of OpenXT), be sure to format the xec-vm properly. For example:
xec-vm -n Win7-XSPV set extra-xenvm "serial=[\"tcp:192.168.1.60:7204,nodelay\"]"
- Before restarting the VM, make sure that the sockpipe listening app is running - QEMU will try to make a TCP connection to it. Also make sure there are not firewalls or other network issues that could prevent the connection. If QEMU cannot connect, it will spit out a message that looks like this:
Unknown internal error. Error code: 199. Message: Dm.Ioemu_failed("Device model 0 on dm-agent 8 died (status = unknown)")
- Restart the HVM and select the debug boot entry. Early in the VM boot process the debugging session will connect.
...