[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [MirageOS-devel] (Fwd) Workaround for debugging 64-bit unikernels under KVM/QEMU
That's useful information, and I thought I'd also share a slightly different workaround for this issue that I use in Solo5 (which I expect can be done similarly with Rumprun).
For Solo5, the way I get around this issue is to set a volatile variable at the start of main and loop on it infinitely, then change the value of the variable via gdb once gdb is attached. It's not able to connect gdb without editing any source like your way does, but it only requires running gdb once. Here are my steps:
1. Edit kernel.c to set the volatile "gdb" variable to 0 (https://github.com/djwillia/solo5/blob/mirage/kernel/kernel.c#L28)
2. Start the unikernel with the QEMU gdb stub enabled (-s). It will get stuck in an infinite loop and print "looping for gdb" (https://github.com/djwillia/solo5/blob/mirage/kernel/kernel.c#L36)
3. Start gdb using the 64-bit kernel ELF binary:
gdb kernel/kernel
4. Connect gdb to the QEMU stub
target remote localhost:1234
5. Cause the infinite loop to break by changing the value of the "gdb" variable to 1
set gdb=1
6. Continue execution via gdb
c
Steps 3,4, and 5 can be done with one line thanks to https://github.com/djwillia/solo5/blob/mirage/gdb.txt
gdb kernel/kernel --command gdb.txt
Thanks,
Dan ----- Original message ----- _______________________________________________ MirageOS-devel mailing list MirageOS-devel@xxxxxxxxxxxxxxxxxxxx http://lists.xenproject.org/cgi-bin/mailman/listinfo/mirageos-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |