feat(libc): implement sceLibcBacktraceSelf on Linux #2040
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2040"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by Aryansh1520 on 2026-10-09T05:37:00Z.
What
PPSA28997 (God of War Sons of Sparta, IL2CPP) calls
sceLibcBacktraceGetBufferSizeandsceLibcBacktraceSelf. On Linux, the host call stack is captured withbacktrace, and each frame is resolved to its module and offset withdladdr. Frames are written as a linked list of records: next pointer, u32 module offset, then the module name at +0x10.GetBufferSizereports the count and the bytesSelfwill need. The signatures and record layout are inferred from the title and listed in TechnicalDebt, including the unknown u32 at +0xC (written as 0). Windows throws.Tested
tools/check_conventions.py --base origin/mainandtools/pr_overlap.py --branchpass.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-09T05:57:54Z.
The inferred record layout is documented as technical debt, but this ABI needs a regression that checks GetBufferSize against records written by Self, including a frame limit and a too-small buffer. Also, the PR describes this implementation as Linux-only, while the current non-Windows guard enables it on macOS too; please either gate the implementation to Linux and throw elsewhere, or provide macOS validation. GitHub reports no checks on this head.
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-09T09:22:56Z.
Same as #2038, for
sceLibcBacktraceSelf. Also,#ifndef _WIN32turns this on for macOS too; please guard it with__linux__and throw elsewhere.Imported from boykopovar/AnyPS5. Originally posted by Aryansh1520 on 2026-10-09T10:36:56Z.
Updated in
75c1fa60:#ifdef __linux__. macOS and Windows throw throughNotImplemented_nid_no_patch, and the TechnicalDebt entry says so.guest_backtrace:GetBufferSizereports the same count and byte size thatSelfthen writes.nextpointing to the following record and null on the last, the u32 at +0xC zero, NUL-terminated names at +0x10.[[gnu::noinline]].Where PPSA28997 stops: after loading its first scene, the title calls
sceLibcBacktraceGetBufferSize(sMko2YZqDNQ), imported byIl2cppUserAssemblies.prx. When it was a not-implemented stub in my local build:Main exports neither function. On main (as of Oct 8) the title stops earlier, at
LTov9gMEqCU(std::ios_base::_Addstd, #545).The build workflows on this head are waiting for approval to run (fork PR).
Imported from boykopovar/AnyPS5. Originally posted by popcoder565 on 2026-10-09T15:46:35Z.
Native Windows run, since no Windows results were posted. Setup: Windows 10 (19045), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release. Head
75c1fa60, merged ontomaind70b8998in one build with 38 other PRs that had no Windows run.guest_backtrace, is registered only on Linux, so on Windows this only checks that the change builds.No title was run.
🤖 Addressed by Claude Code
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-09T21:27:48Z.
Review: CHANGES_REQUESTED
Thanks for the
__linux__gate and the layout/limit/small-buffer test; build and ctest are green here (guest_backtracepasses, 524/524).One blocker left:
nextload, the offset use, the name pointer, and which return values are checked), or a log of the title consuming the result. If it can't be confirmed, say which parts are guesses in TechnicalDebt (return value on a too-small buffer, whethercountincludes truncated frames).Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-09T21:52:07Z.
Progress report (
51f69aa→75c1fa6)📈 System libraries: 84.7% (+0.01%, +2 implemented functions)
✅ 2 implemented
sceLibcBacktraceGetBufferSizesceLibcBacktraceSelfImported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-09T22:30:59Z.
Closing: the record layout is inferred and the frames are host frames, so what the title gets back isn't what the console returns. Please reopen with the exact layout, or a version that throws for what isn't known.
Pull request closed