feat(libc): implement sceLibcBacktraceSelf and GetBufferSize on Linux #7060
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/7060"
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-17T09:32:22Z.
What
Implements
sceLibcBacktraceSelfandsceLibcBacktraceGetBufferSizeon Linux. The frame record layout is inferred from a title and is recorded in the libc technical debt. AddsGuestBacktracetest covering the record layout and the buffer-size query.Tested
Linux (x86-64, gcc, Release):
ctest -R guest_backtracepasses. Hardware: AMD Ryzen 7 260 host, NVIDIA GeForce RTX 5060 Laptop GPU (Wayland). Game check: God of War Sons of Sparta (PPSA28997) on Linux, Il2Cpp imports these at startup and no longer stops on them.Overlaps open PRs #6447 (@mashingaan) and #7084 on the same two functions. Coordinating which goes first before merge.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-17T09:33:05Z.
Progress report (
6d6e33d→2e0d310)📈 System libraries: 89.5% (+0.06%, +2 implemented functions)
✅ 2 implemented
sceLibcBacktraceGetBufferSize_nid_postfixsceLibcBacktraceSelf_nid_postfixImported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-17T09:46:16Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)core/libs/prx/libc/CMakeLists.txtL33sceLibcBacktraceGetBufferSize_nid_postfixsceLibcBacktraceSelf_nid_postfixdocs/dev/debt/libc.mdL4core/libs/prx/libc/src/Backtrace.cppL1-4, L6-7, L11-12core/libs/tests/GuestBacktrace.cppsceLibcBacktraceGetBufferSize_nid_postfixsceLibcBacktraceSelf_nid_postfixcore/libs/tests/GuestBacktrace.cppSome 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.txtdocs/dev/debt/libc.mddocs/dev/debt/libc.mdcore/libs/prx/libc/CMakeLists.txtcore/libs/prx/libc/CMakeLists.txtcore/libs/prx/libc/CMakeLists.txtdocs/dev/debt/libc.mdcore/libs/prx/libc/CMakeLists.txtdocs/dev/debt/libc.mdcore/libs/prx/libc/src/Backtrace.cppdocs/dev/debt/libc.mdImported from boykopovar/AnyPS5. Originally posted by simonbbby on 2026-10-17T12:24:03Z.
Independent Linux execution on exact head
2e0d310c91c7b8285b9b8df0b556921dc37fb046(Ubuntu 24.04 x86-64, GCC 13.3).The unchanged
GuestBacktrace.cpppasses when compiled directly with the complete unchanged productionBacktrace.cpp. I also linked a separate harness against that same production source and called it from actualdlopenshared libraries. There are no replacement unwind,dladdr, record-writing or export implementations. Test builds use-O2 -fno-omit-frame-pointer -rdynamicand-ldl.11,600 additional cases pass: ten module filenames × four frame limits (0, 1, 2, -1) × 290 capacity/boundary cases.
.guest.prxexercise every record-padding residue; the reported module is the filename with that suffix removed.name.GUEST.PRXandname.guest.prx.extraremain unchanged.dladdr(trace_self).PROT_NONEpage; none fault.Self's count and used bytes equalGetBufferSize's result.Two targeted negative controls fail: disabling only
.guest.prxstripping fails the caller-name/record-admission checks; admitting a record when capacity is one byte short failsrecord alignment exceeds capacity. The unmodified implementation passes both corresponding checks.This covers real Linux host unwinding and serialization into synthetic buffers. It does not validate the inferred console signatures/layout/reserved field, relinked guest unwinding, the title run, other platforms, the full libc build, or the overlap with #6447.
Imported from boykopovar/AnyPS5. Originally posted by Aryansh1520 on 2026-10-17T15:20:53Z.
This PR and two others implement the same two exports,
sceLibcBacktraceSelf_nid_postfixandsceLibcBacktraceGetBufferSize_nid_postfix: #6447 and #7084. Only one implementation can merge, so the order needs deciding.#7084 is the only one of the three that is currently mergeable. #6447 has merge conflicts and, per blawesom's comment, does not build yet.
@mashingaan @portalmaster137 which one should go first? Once that is decided I will either rebase this PR onto it and drop the duplicate exports, or close this PR in favour of it, whichever you prefer. This PR keeps the Linux port and the
GuestBacktracetest either way.