[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[MirageOS-devel] (Fwd) Workaround for debugging 64-bit unikernels under KVM/QEMU



Hi folks,

forwarding this, useful for anyone debugging either Mirage/Rumprun or
Mirage/Solo5 under KVM/QEMU. For Solo5, you'll want to replace 'x86_boot'
symbol with the equivalent 64-bit startup function.

Cheers

Martin

----- Forwarded message from Martin Lucina <martin@xxxxxxxxxx> -----

Date: Tue, 15 Mar 2016 17:30:37 +0100
From: Martin Lucina <martin@xxxxxxxxxx>
To: rumpkernel-users@xxxxxxxxxxxxx
Subject: Workaround for debugging 64-bit unikernels under KVM/QEMU

Hi all,

I've managed to find a workaround for the well-known problem of GDB not
being able to debug hw/x86-64 unikernels under QEMU or KVM (see GDB issue
https://sourceware.org/bugzilla/show_bug.cgi?id=13984):

1. Start the unikernel, leaving it paused and waiting for GDB to connect:

    rumprun [kvm|qemu] -p -D 1234 [...]

2. Run the following GDB command:

    gdb -q -ex "target remote:1234" -ex "hbreak x86_boot" -ex "continue" -ex 
"disconnect" -ex "quit" unikernel.bin

   This will cause the unikernel to proceed past the transition from 32-bit
   mode to long mode and remain in a paused state.

3. Re-launch GDB a second time as you would normally.

I've updated the "Howto: Debugging Rumprun with GDB" page on the wiki with
these instructions.

The workaround works for both QEMU and KVM. The trick seems to be to a;ways
use a hardware-assisted breakpoint on x86_boot. 'disconnect' ensures
QEMU/KVM remains paused and 'quit' followed by a restart is needed to
de-confuse GDB.

Martin


----- End forwarded message -----

_______________________________________________
MirageOS-devel mailing list
MirageOS-devel@xxxxxxxxxxxxxxxxxxxx
http://lists.xenproject.org/cgi-bin/mailman/listinfo/mirageos-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.