From: "Maciej W. Rozycki" <macro@orcam.me.uk>
To: Orgad Shaneh <orgads@gmail.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] gdb/mips: unwind past post-prologue SP adjustments in syscall stubs
Date: Wed, 12 Aug 2026 14:40:00 +0100 (BST) [thread overview]
Message-ID: <alpine.DEB.2.21.2608121420550.48788@angie.orcam.me.uk> (raw)
In-Reply-To: <20260806180912.7143-1-orgads@gmail.com>
On Thu, 6 Aug 2026, Orgad Shaneh wrote:
> When computing a frame (not when skipping the prologue), continue
> scanning from where the prologue-end heuristic stopped up to the PC,
> accumulating any further SP adjustments. Branches are deliberately
> not followed: compilers do not move SP mid-function outside prologue
> and epilogue (alloca frames use a frame pointer and are excluded), so
> post-prologue adjustments occur in practice only around syscall
> instructions in libc stubs, where paired temporary adjustments that
> were fully crossed cancel out in a linear scan. The scan does stop at
> a "jr $ra", though: past one, the range crosses a complete alternate
> return path - e.g. the single-thread fast path of glibc's cancellable
> syscall wrappers, which returns before the multithreaded path saves RA
> and runs the syscall - and a linear sum of the remainder is no longer
> meaningful, so the frame is left unchanged. If the net result is
> positive, rescan with the entry SP moved accordingly - the same
> restart mechanism already used for alloca - so that both the frame
> base and the register save slots are computed against the true frame.
I'm inconvinced, the heuristic unwinders are specifically for prologues
and not random stuff within function bodies. Have you considered asking
the relevant project maintainers to add the missing CFI records? That
would be the proper way to handle the situation. Indeed there've been
voices asking to drop the heuristic unwinders from GDB altogether.
Thank you for your submission regardless.
Maciej
prev parent reply other threads:[~2026-08-12 13:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-06 18:09 Orgad Shaneh
2026-08-12 13:40 ` Maciej W. Rozycki [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.DEB.2.21.2608121420550.48788@angie.orcam.me.uk \
--to=macro@orcam.me.uk \
--cc=gdb-patches@sourceware.org \
--cc=orgads@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox