[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to backtrace an separate stack?
From: |
Florian Weimer |
Subject: |
Re: How to backtrace an separate stack? |
Date: |
Mon, 07 Mar 2022 15:49:37 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) |
* 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