(I’m putting this up because I couldn’t find anything that described how to set this up and I had to connect different fragments of information, and file an invalid bug report before I figured it out.)
If you want to be able to debug a Linux kernel that’s running as a KVM guest, you need to specify the ‘-s’ parameter for the command line of qemu-kvm. The problem is, there’s no (easy) way to do this when you’re using libvirt and virt-manager to manager your virtual machines, instead of using KVM directly. What you need to do is change the XML configuration of the virtual machine so that the ‘-s’ parameter is passed on to qemu-kvm
$ virsh edit f14-test
Here, f14-test is the name of the VM that is managed via virt-manager. This will bring up the XML configuration of the VM in your editor. The first line of the XML file should be:
This has to be changed to
<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
and you also need to add:
<domain> level of the XML. After you save and quit the editor, the new configuration will come into effect. When you start the virtual machine, there will be a local TCP port (1234 by default) that can be used as a remote debugging port from gdb. You can connect to this port by using the command
target remote localhost:1234
from gdb running on the host machine.
I am trying something similar. This is my xml file :
I start the VM from this xml file. Now When I do “ps aux | grep rubis” , I get :
root 13496 59.1 3.5 1266168 292112 ? Sl 16:50 0:23 /usr/libexec/qemu-kvm -S -M rhel5.4.0 -m 1024 -smp 2,sockets=2,cores=1,threads=1 -name rubis_ws -uuid 1a474ca9-604f-aceb-2fed-792fe1e9f900 -monitor unix:/var/lib/libvirt/qemu/rubis_ws.monitor,server,nowait -no-kvm-pit-reinjection -boot c -drive file=/root/incremental.img,if=ide,bus=0,unit=0,boot=on,format=qcow2,cache=none -net nic,macaddr=00:16:3e:98:78:04,vlan=0 -net tap,fd=18,vlan=0 -serial pty -parallel none -usb -vnc 127.0.0.1:0 -k en-us -vga cirrus -balloon virtio
root 13531 0.0 0.0 61192 760 pts/5 S+ 16:51 0:00 grep rubis
I cannot find the -s in that command . Can you please let me know whether I am making any mistake. I have been stuck with this for a long time without knowing how to solve it. Thanks for your help.
Sorry, the xml file didnt appear properly in the previous post , I have asked a question similar in FB, please take a look at it – http://stackoverflow.com/questions/6566558/libvirt-command-line-arguments-using-xml-config-file . Thanks for your help.