Skip to content

feat(libkernel): answer sceCoredumpGetThreadContextInfo outside the coredump handler - #5901

Merged
adriadam10 merged 1 commit into
boykopovar:mainfrom
KernelPanicNT:feat/libkernel-coredump-thread-context-info
Oct 16, 2026
Merged

adriadam10 merged 1 commit into
boykopovar:mainfrom
KernelPanicNT:feat/libkernel-coredump-thread-context-info

Conversation

@KernelPanicNT

@KernelPanicNT KernelPanicNT commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

What

sceCoredumpGetThreadContextInfo is still the throwing export added by #3373. This gives it the behaviour #4882 gave its sibling sceCoredumpGetStopInfoCpu: AnyPS5 records coredump handlers but never invokes them, so every call happens outside a handler.

  • An aligned, non-wrapping 144-byte request returns SCE_COREDUMP_ERROR_NOT_IN_COREDUMP_HANDLER (0x81180003) and leaves the caller's block untouched.
  • Null, unaligned or wrapping buffers and any size other than 144 throw, because the console's argument-validation order is unverified. Reading the context from an active handler remains unsupported.
  • The libkernel debt entry for the function moves from "declared as a throwing stub" to the behaviour above, next to sceCoredumpGetStopInfoCpu.

Source of the behaviour.

These are public references, not a PS5 measurement; the remaining uncertainty is recorded in the libkernel debt file.

Progress on the base below: 3274/3692 (88.68%) → 3275/3692 (88.71%), one implemented function.

Tested

Head 352a300dd8b39950ba9cb57130cad21df3570d7a, base 979ad7b6aaa0a3e0df120586230193e6f9a055b5.

  • Windows, full Build workflow on my fork (run 38583509976), this head merged into the base above, WinLibs MinGW-w64 GCC 15.2.0, Release, BUILD_TESTING=ON: 1192/1192 tests pass, including guest_coredump_attach.
  • Linux, Ubuntu 22.04, GCC 12.3.0, Ninja, Release, BUILD_TESTING=ON (run under QEMU 8.2 user mode with -cpu EPYC-Rome, as the build host lacks AVX2): guest_coredump_attach passes 5/5 runs.
  • Negative control: keep the extended test and replace only core/libs/prx/libkernel/System/src/Coredump.cpp with the base version. It builds and fails with sceCoredumpGetThreadContextInfo not implemented. Restoring the PR source and rebuilding passes 5/5 runs again.
  • The test covers calls before handler registration, from the registering thread, from another thread and after unregistering, with the 160-byte guard buffer compared byte for byte, the handler never running, and the throwing cases (null, +1 misalignment, UINTPTR_MAX - 7, sizes 0, 1, 143, 145 and SIZE_MAX).
  • Conventions checker and git diff --check pass. The Linux job of the Build workflow now targets the project's self-hosted runner, so it was not run on the fork; no title was run.

Duplicate and overlap check

No open pull request implements or names sceCoredumpGetThreadContextInfo (NID ShChva57wIM), and none touches core/libs/prx/libkernel/System/src/Coredump.cpp or core/libs/tests/GuestCoredumpAttach.cpp. 28 open pull requests also edit docs/dev/debt/libkernel.md (re-checked on 2026-10-15); this change only rewrites the function's own entry, and a three-way merge of this branch with each of them, rebased on main, gives no conflict. Earlier work on the function: #3373 (merged) declared the export; the closed #2383 and issue #4144 covered broader coredump sets.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes (Claude)

…oredump handler

sceCoredumpGetThreadContextInfo takes (void* threadContextInfo,
size_t threadContextInfoSize) as in Orbital's IDA type database, and the
144-byte block of 18 64-bit registers follows SharpProspero. It answers
as sceCoredumpGetStopInfoCpu: the handler is never invoked here, so an
aligned 144-byte request returns NOT_IN_COREDUMP_HANDLER without reading
or writing the block, and null, unaligned or wrapping buffers and other
sizes throw, as the console validation order is unverified.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

Progress report (84b01f9 → 352a300)

📈 System libraries: 88.71% (+0.03%, +1 implemented functions)

✅ 1 implemented
Library Name
libkernel sceCoredumpGetThreadContextInfo

This was referenced Oct 15, 2026
@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

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.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 6710 core/libs/prx/libkernel/System/src/Coredump.cpp L96-99
core/libs/tests/GuestCoredumpAttach.cpp L15, L46-47, L57-58, L71, L76-77
docs/dev/debt/libkernel.md L16

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.

Pull request Shared files not compared
PR 5021 docs/dev/debt/libkernel.md
PR 5280 docs/dev/debt/libkernel.md
PR 5993 docs/dev/debt/libkernel.md
PR 6044 core/libs/tests/GuestCoredumpAttach.cpp
PR 6222 docs/dev/debt/libkernel.md
PR 6228 docs/dev/debt/libkernel.md
PR 6447 core/libs/prx/libkernel/System/src/Coredump.cpp
PR 6510 docs/dev/debt/libkernel.md
PR 6519 docs/dev/debt/libkernel.md
PR 6658 docs/dev/debt/libkernel.md

@adriadam10

Copy link
Copy Markdown
Collaborator

Checked build and ctest on current main (175 tests green), guest_coredump_attach passes and fails without the Coredump.cpp change. Argument handling matches sceCoredumpGetStopInfoCpu and throws on everything unverified; the debt entry records the sources and the unverified error value. Merging.

@adriadam10
adriadam10 merged commit bafd322 into boykopovar:main Oct 16, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants