feat(debug): command interface on a FIFO or file #17556

Open
MarcZX10 wants to merge 34 commits from upstream-pr/17556 into main
MarcZX10 commented 2026-11-08 22:08:55 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-08T22:08:55Z.


What

Adds the command session that runs at a stop: list, args, add NID, remove NID and continue, read from the file named by ANYPS5_DEBUG_CMD. The file is opened at each stop; a regular file is read from its first line at every stop, a FIFO is read as it comes. End of file, or a file that cannot be opened, resumes the stop. An unset variable resumes the stop too.

Output of a session goes to stderr with no reply channel, so a client reads the log. There is no step: each armed hit already stops, so continue is the only resume.

Nothing starts a stop yet (the call path wiring is a follow-up), so the session is not read by a running title.

Stacked on the PR 2 branch (feat/debug-nid-pause): this branch contains that branch's commits.

Tested

Linux, Debian kernel 6.1.0-54-amd64, Intel Xeon E5-1620 v2. Host archive build, focused tests only, no game and no PS5 hardware.

Command:

flock <build lock> env VERIFY_DIR=<worktree> VERIFY_TAG=dbg3b ANYPS5_REQUIRE_DISPLAY=1 bash <main checkout>/.git/info/tools/run_tests.sh '^(guest_debug_nid_breakpoints|guest_debug_nid_commands|guest_debug_nid_stops)$' guest_debug_nid_breakpoints_tests guest_debug_nid_commands_tests guest_debug_nid_stops_tests

Output:

BUILD-EXIT 0
1/3 Test #812: guest_debug_nid_breakpoints ......   Passed    0.01 sec
2/3 Test #813: guest_debug_nid_commands .........   Passed    0.00 sec
3/3 Test #814: guest_debug_nid_stops ............   Passed    0.01 sec
100% tests passed, 0 tests failed out of 3

Overlap: pr_overlap fails closed on shared files (libc build list, the libc debt file, the environment reference). Across the 109 open PRs it flags for this series, none adds a line using the debugger or hook-table identifiers (DebugNid, NidStop, NidBreakpoint, ANYPS5_DEBUG, command parsing, WriteHookTable, hooks.json, debug_nids, breakpoint). No open PR implements the same functions.

Not verified:

  • A title reading the command file at a real stop (no call path starts a stop yet).
  • Reading a FIFO from a live pipe, and what a blocked FIFO does to a title.
  • step is not built.

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: #17555
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5215586668 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/17556). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-08T22:08:55Z. --- ### What Adds the command session that runs at a stop: `list`, `args`, `add NID`, `remove NID` and `continue`, read from the file named by `ANYPS5_DEBUG_CMD`. The file is opened at each stop; a regular file is read from its first line at every stop, a FIFO is read as it comes. End of file, or a file that cannot be opened, resumes the stop. An unset variable resumes the stop too. Output of a session goes to stderr with no reply channel, so a client reads the log. There is no `step`: each armed hit already stops, so `continue` is the only resume. Nothing starts a stop yet (the call path wiring is a follow-up), so the session is not read by a running title. Stacked on the PR 2 branch (`feat/debug-nid-pause`): this branch contains that branch's commits. ### Tested Linux, Debian kernel 6.1.0-54-amd64, Intel Xeon E5-1620 v2. Host archive build, focused tests only, no game and no PS5 hardware. Command: ``` flock <build lock> env VERIFY_DIR=<worktree> VERIFY_TAG=dbg3b ANYPS5_REQUIRE_DISPLAY=1 bash <main checkout>/.git/info/tools/run_tests.sh '^(guest_debug_nid_breakpoints|guest_debug_nid_commands|guest_debug_nid_stops)$' guest_debug_nid_breakpoints_tests guest_debug_nid_commands_tests guest_debug_nid_stops_tests ``` Output: ``` BUILD-EXIT 0 1/3 Test #812: guest_debug_nid_breakpoints ...... Passed 0.01 sec 2/3 Test #813: guest_debug_nid_commands ......... Passed 0.00 sec 3/3 Test #814: guest_debug_nid_stops ............ Passed 0.01 sec 100% tests passed, 0 tests failed out of 3 ``` Overlap: pr_overlap fails closed on shared files (libc build list, the libc debt file, the environment reference). Across the 109 open PRs it flags for this series, none adds a line using the debugger or hook-table identifiers (DebugNid, NidStop, NidBreakpoint, ANYPS5_DEBUG, command parsing, WriteHookTable, hooks.json, debug_nids, breakpoint). No open PR implements the same functions. Not verified: - A title reading the command file at a real stop (no call path starts a stop yet). - Reading a FIFO from a live pipe, and what a blocked FIFO does to a title. - `step` is not built. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: #17555 - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
ligmaSec commented 2026-12-03 22:35:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T22:35:58Z.

Review: COMMENTED


I compiled and ran the exact breakpoint, stop, and command fixtures on Linux. All passed. One exception path remains: RunCommandSession can throw while building its strings, bypassing fclose, and Hit then exits before releasing the slot it registered. Please scope both resources so a failed session closes the file and releases the registry slot. The existing command tests exercise normal resume and EOF.

This head trial-merges cleanly onto c1601e56d5, but a trial composition with current #17555 conflicts in the stop API and implementation, CMake, and environment docs. Please pin the intended parent before re-running the stack.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6179821919 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/17556#pullrequestreview-6179821919). Originally posted by [ligmaSec](https://github.com/ligmaSec) on 2026-12-03T22:35:58Z. **Review:** COMMENTED --- I compiled and ran the exact breakpoint, stop, and command fixtures on Linux. All passed. One exception path remains: `RunCommandSession` can throw while building its strings, bypassing `fclose`, and `Hit` then exits before releasing the slot it registered. Please scope both resources so a failed session closes the file and releases the registry slot. The existing command tests exercise normal resume and EOF. This head trial-merges cleanly onto `c1601e56d5`, but a trial composition with current #17555 conflicts in the stop API and implementation, CMake, and environment docs. Please pin the intended parent before re-running the stack. AI-assisted: yes.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/17556:upstream-pr/17556'
git switch 'upstream-pr/17556'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/17556'
git switch 'upstream-pr/17556'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/17556'
git switch 'upstream-pr/17556'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/17556'
git switch 'main'
git merge --squash 'upstream-pr/17556'
git switch 'main'
git merge --ff-only 'upstream-pr/17556'
git switch 'main'
git merge 'upstream-pr/17556'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!17556
No description provided.