Remote Kernel Debugging over QEMU?

Kostik Belousov kostikbel at
Sat Mar 8 20:18:50 UTC 2008

On Sat, Mar 08, 2008 at 02:45:05PM -0500, Yoshihiro Ota wrote:
> Hello, folks,
> Has anyone tried to remote-debugging of a system running on Qemu?
> I thought if I could attach kgdb from Qemu host to a guest FreeBSD
> running on Qemu, it would be very helpful for many reasons, i.e.
> no hardware requirements, avoid fscking all disks, and so on.
> Has anyone ever attempted?  I spent a half day but due to lack of
> remote debugging experience and some other knowledge, it wasn't
> successful.

I do it often, with the stock gdb built from FSF sources.

Simply run the qemu with the "-s" switch, then start gdb with kernel.debug
argument, and, in the gdb, do "target remote localhost:1234".

I use latest gdb since it much better handles debugging information
generated by the 4.2 gcc.

Also, this setup allows me to use both convenience of ddb specific
commands (inside QEMU) and gdb data inspection facilities (almost)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
Url :

More information about the freebsd-hackers mailing list