feat(libc): implement guest backtrace capture #7084
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/7084"
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 portalmaster137 on 2026-10-17T10:50:45Z.
What
Implement sceLibcBacktraceGetBufferSize and sceLibcBacktraceSelf by capturing the guest call stack, formatting frame names and addresses, and writing linked frame records to the caller’s buffer. Add a guest backtrace test.
Tested
Linux; not tested. Added guest_backtrace_tests, but it has not been run.
Checklist
Imported from boykopovar/AnyPS5. Originally posted by copilot-pull-request-reviewer[bot] on 2026-10-17T10:50:50Z.
Review: COMMENTED
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-17T11:21:50Z.
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
core/libs/prx/libc/CMakeLists.txtcore/libs/prx/libc/CMakeLists.txtcore/libs/prx/libc/CMakeLists.txtcore/libs/prx/libc/CMakeLists.txtcore/libs/prx/libc/CMakeLists.txtcore/libs/prx/libc/CMakeLists.txtcore/libs/prx/libc/CMakeLists.txtcore/libs/prx/libc/CMakeLists.txtcore/libs/prx/libc/CMakeLists.txtcore/libs/prx/libc/CMakeLists.txtcore/libs/prx/libc/CMakeLists.txtcore/libs/prx/libc/CMakeLists.txtcore/libs/prx/libc/CMakeLists.txtcore/libs/prx/libc/CMakeLists.txtcore/libs/prx/libc/src/Backtrace.cppcore/libs/prx/libc/CMakeLists.txtcore/libs/prx/libc/CMakeLists.txtcore/libs/prx/libc/CMakeLists.txtcore/libs/prx/libc/CMakeLists.txtcore/libs/prx/libc/CMakeLists.txtcore/libs/prx/libc/CMakeLists.txtcore/libs/prx/libc/CMakeLists.txtcore/libs/prx/libc/CMakeLists.txtcore/libs/prx/libc/CMakeLists.txtcore/libs/prx/libc/CMakeLists.txtImported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-17T15:16:32Z.
Review: COMMENTED
First run of the new test (the description says
guest_backtrace_testshas not been run).Machine: Linux x86_64, i7-8700, Ubuntu 26.04, GCC 15.2, Release,
BUILD_TESTING=ON, full build.Head
5e5844b54merged ontomain40315fcf8(clean merge).guest_backtracepasses with the PR. The other exception tests (ctest -R "backtrace|exception", 6 tests) also pass.main: the test aborts withsceLibcBacktraceGetBufferSize_nid_postfix not implemented, so it covers the change.ctest -E "^agc|gpu|vulkan|video_out"): 683/683, the 682 tests ofmainplusguest_backtrace.Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-17T18:54:45Z.
Heads-up before rebase effort goes in:
mainjust landed overlapping backtrace work. #7060 ("fix(libc): limit sceLibcBacktraceSelf to Linux and test its record layout", merged today) implementssceLibcBacktraceSelfon Linux with test coverage, andmain'sBacktrace.cppalready carriessceLibcBacktraceGetBufferSize/CaptureFrames— the same functions this PR adds. Beyond whatmainhas, I can see theUnwind.hppintegration and platform branches (__APPLE__/Windows) in your diff, which may or may not still apply on top of #7060's shape. So the practical options are reducing this PR onto #7060's implementation (keeping whatever it genuinely adds — the macOS/Windows paths, the_Unwind_Backtraceexports) or closing it as superseded — your call with the maintainers. I can carry the reduction as a rebase handoff if that's the wanted direction.Imported from boykopovar/AnyPS5. Originally posted by T3cm0 on 2026-10-17T23:17:12Z.
Hi @portalmaster137, since this PR was opened, #7060 landed a Linux implementation of
sceLibcBacktraceGetBufferSizeandsceLibcBacktraceSelfonmain, so the two now overlap.I have a follow-up ready that builds on
main's version rather than replacing it: it walks the frames with libc's_Unwind_Backtraceso the functions also run on Windows (mainthrows there), keeps #7060's record layout and.guest.prxhandling, and aligns the edge cases with the console's code in thelibc.prxthat ASTRO BOT bundles (the walk starts at the caller, and a null argument or a frame outside any module returns 1). It passesguest_backtraceon Windows and Linux.Are you still working on this one? If not, would you be OK with mine going first? I'm happy to fold in anything from yours that it misses.
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-19T13:00:57Z.
Progress report (
864729d→5e5844b)📈 System libraries: 89.68% (+0.05%, +2 implemented functions)
✅ 2 implemented
sceLibcBacktraceGetBufferSize_nid_postfixsceLibcBacktraceSelf_nid_postfixImported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-19T13:01:18Z.
Closing as a duplicate: #7060 already landed
sceLibcBacktraceGetBufferSizeandsceLibcBacktraceSelfonmain(Linux, with a record-layout test), and this PR rewrites the same functions and now conflicts with it.libc.prx.main's version for Windows is already in preparation by @T3cm0.If you want to contribute the Windows part, please open a new PR rebased on current
mainthat extends #7060's implementation instead of replacing it, with a test that fails without the change. You're welcome to reopen with that addressed.Pull request closed