Exception debugging with qemu_x86/gdb


Paul Sokolovsky
 

Hello,

I have a crash ("CPU exception 13") somewhere in networking code. My
next step would be to run the app (BOARD=qemu_x86) under GDB, wait for
crash, type "backtrace". I follow
https://www.zephyrproject.org/doc/reference/kbuild/kbuild_project.html#application-debugging
, but when exception occurs, I don't end up in GDB, Zephyr's own
exception handler keeps running, e.g.:

***** CPU exception 13
***** Exception code: 0x00004074
Current thread ID = 0x00177f60
Faulting segment:address = 0x00000008:0x001782da
eax: 0x0000ff0e, ebx: 0x00178350, ecx: 0x00177f60, edx: 0x00177f60
esi: 0x00000000, edi: 0x00178400, ebp: 000169398, esp: 0x0017830c
eflags: 0x00004046
Fatal essential fiber error! Spinning...

I tried to look for Kconfig options, but the only relevant I found was
CONFIG_EXCEPTION_DEBUG, setting it to "n" from default "y" doesn't
help. Well, another option is CONFIG_GDB_SERVER, but that embeds
actual GDB debug stub into the *application*. But we use QEMU's debug
stub on the meta-level, so CONFIG_GDB_SERVER shouldn't be needed (and
enabling it just garbles console, as it tries to communicate via
serial).

So, I would naively think that QEMU's GDB stub would override any
relevant guest exception handling, but that apparently not happen. What
am I missing? I tried to look for other related options to QEMU
(besides -s -S), but don't see nothing relevant. The only doc I found
is http://wiki.qemu.org/Documentation/Debugging which is pretty short
at best.


Thanks,
Paul

Linaro.org | Open source software for ARM SoCs
Follow Linaro: http://www.facebook.com/pages/Linaro
http://twitter.com/#!/linaroorg - http://www.linaro.org/linaro-blog

Join {devel@lists.zephyrproject.org to automatically receive all group messages.