Skip to content

feat(libkernel): log guest exception context - #7655

Merged
adriadam10 merged 2 commits into
boykopovar:mainfrom
farosch:main
Oct 20, 2026
Merged

adriadam10 merged 2 commits into
boykopovar:mainfrom
farosch:main

Conversation

@farosch

@farosch farosch commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

What

Log the saved guest signal context before invoking a guest exception handler: signal number, RIP/RSP, flags, trap/error/fault fields, and general-purpose registers. Format into a fixed buffer and write directly to stderr, avoiding the normal logger in the POSIX signal-handler path. Debug-raise APIs now print exception codes in hex and include the caller address. These diagnostics do not change handler or termination behavior.

Tested

Linux x86-64: cmake --build build --target libs --parallel passed; no source errors reported. Manual runtime check produced:
[src/Exception.cpp:576 sceKernelDebugRaiseExceptionOnReleaseMode] ... c1=0xa0020004 c2=0x00000000 caller=...
The process still terminates on its existing SIGILL. The guest-register dump path was not exercised by that run because the unhandled host SIGILL bypasses guest exception dispatch. Windows not tested.

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
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

@github-actions

github-actions Bot commented Oct 18, 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 7192 core/libs/prx/libkernel/System/src/Exception.cpp L125-128

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 core/libs/prx/libkernel/System/src/Exception.cpp
PR 6879 core/libs/prx/libkernel/System/src/Exception.cpp
PR 7201 core/libs/prx/libkernel/System/src/Exception.cpp
PR 7332 core/libs/prx/libkernel/System/src/Exception.cpp

@LeandroLP23

LeandroLP23 commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Windows run, since the description covers Linux only. Radeon 860M (RDNA 3.5, driver 32.0.13058.8001), Windows 11 26300, WinLibs GCC 15.2.0 r7, Release, BUILD_TESTING=ON. Build: main e8ad642fe with #7651, #7650, #7647, #7655 and #7648 merged together (each merge clean, built once).

The build is clean. The existing guest exception tests pass 3 runs of 3: guest_raise_exception, guest_mutex_raise_exception, guest_raise_nested_sleep and windows_exceptions. I didn't check whether any of them reaches the new log line, so this covers the build and no regression in those paths.

AI-assisted

@adriadam10 adriadam10 self-assigned this Oct 19, 2026
@adriadam10
adriadam10 merged commit ad80f5f into boykopovar:main Oct 20, 2026
12 of 13 checks passed
@adriadam10

Copy link
Copy Markdown
Collaborator

Checked the context dump: the fixed 768-byte buffer holds the longest line (~520 bytes), it only uses write/WriteFile (no allocation or logger in the signal path), the GuestMcontext fields exist, and handler behaviour is unchanged. Windows build confirmed by @LeandroLP23; merged.

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.

3 participants