Stack walk: Report a function's symbol start as its entry, not its prologue

The scan for the prologue took the addiu sp as the entry, which is past the
start when the function does something first (a lui, a move).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Henrik RydgårdandClaude Opus 5.5 committed 2026-10-19 11:04:57 +02:00
1 parent 2cfbbc001d
commit 024bed6065
2 files changed
+27 -1

No files matched your search

+4 -1
View File
@@ -145,7 +145,10 @@ namespace MIPSStackWalk {
continue;
}
frame.entry = pc;
// The prologue often isn't the first instruction (a lui or move can come first), so
// the function's symbol, if it has one, gives the real entry.
const u32 symbolEntry = GuessEntry(pc);
frame.entry = symbolEntry != INVALIDTARGET ? symbolEntry : pc;
frame.stackSize = -_IMM16;
if (ra_offset != -1 && Memory::IsValid4AlignedAddress(frame.sp + ra_offset)) {
ra = Memory::ReadUnchecked_U32(frame.sp + ra_offset);