How to backtrace an separate stack?
Florian Weimer
fweimer@redhat.com
Mon Mar 7 14:49:37 GMT 2022
* Stefan Hajnoczi via Gdb:
> The QEMU emulator uses coroutines with separate stacks. It can be
> challenging to debug coroutines that have yielded because GDB is not
> aware of them (no thread is currently executing them).
>
> QEMU has a GDB Python script that helps. It "creates" a stack frame for
> a given coroutine by temporarily setting register values and then using
> the "bt" command. This works on a live process under ptrace control but
> not for coredumps where registers can't be set.
>
> Here is the script (or see the bottom of this email for an inline copy
> of the relevant code):
> https://gitlab.com/qemu-project/qemu/-/blob/master/scripts/qemugdb/coroutine.py
>
> I hoped that "select-frame address ADDRESS" could be used instead so
> this would work on coredumps too. Unfortunately "select-frame" only
> searches stack frames that GDB is already aware of, so it cannot be used
> to backtrace coroutine stacks.
>
> Is there a way to backtrace a stack at an arbitrary address in GDB?
I'm a bit surprised by this. Conceptually, why would GDB need to know
about stack boundaries? Is there some heuristic to detect broken
frames?
Thanks,
Florian
More information about the Gdb
mailing list