Re: [PATCH] gdb/mips: unwind past post-prologue SP adjustments in syscall stubs
"Maciej W. Rozycki" <[email protected]>
| Newsgroups | gmane.comp.gdb.patches |
|---|---|
| Message-ID | <[email protected]> |
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