feat(debug): pause and resume a guest thread at a breakpoint #17555

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

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


What

Adds the NID stop registry, off by default: a thread that hits an armed NID can be held there until a Continue with the stop's id. Hit blocks the calling thread and holds no registry or table lock while it waits. Continue resumes it; the capacity of the registry is tested.

Nothing calls Hit yet. No call path consults the table, so arming a NID does not stop a title. The wiring is a follow-up.

Stacked on #17261 (the breakpoint table): this branch contains that PR's commits and the same merge with current main.

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=dbg2b ANYPS5_REQUIRE_DISPLAY=1 bash <main checkout>/.git/info/tools/run_tests.sh '^(guest_debug_nid_breakpoints|guest_debug_nid_stops)$' guest_debug_nid_breakpoints_tests guest_debug_nid_stops_tests

Output:

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

The per-file SYNTAX stage reports missing generated and SDL headers for some files; BUILD-EXIT is 0.

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 actually stopping at an armed NID. No call path calls Hit in this PR.
  • Any PS5 argument layout; the stop prints raw values only.
  • Behaviour when the caller holds a host lock: nothing checks that yet. The debt file lists it.

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: #17261
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5215584294 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/17555). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-08T22:08:37Z. --- ### What Adds the NID stop registry, off by default: a thread that hits an armed NID can be held there until a `Continue` with the stop's id. `Hit` blocks the calling thread and holds no registry or table lock while it waits. Continue resumes it; the capacity of the registry is tested. Nothing calls `Hit` yet. No call path consults the table, so arming a NID does not stop a title. The wiring is a follow-up. Stacked on #17261 (the breakpoint table): this branch contains that PR's commits and the same merge with current `main`. ### 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=dbg2b ANYPS5_REQUIRE_DISPLAY=1 bash <main checkout>/.git/info/tools/run_tests.sh '^(guest_debug_nid_breakpoints|guest_debug_nid_stops)$' guest_debug_nid_breakpoints_tests guest_debug_nid_stops_tests ``` Output: ``` BUILD-EXIT 0 1/2 Test #812: guest_debug_nid_breakpoints ...... Passed 0.01 sec 2/2 Test #813: guest_debug_nid_stops ............ Passed 0.01 sec 100% tests passed, 0 tests failed out of 2 ``` The per-file SYNTAX stage reports missing generated and SDL headers for some files; BUILD-EXIT is 0. 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 actually stopping at an armed NID. No call path calls `Hit` in this PR. - Any PS5 argument layout; the stop prints raw values only. - Behaviour when the caller holds a host lock: nothing checks that yet. The debt file lists it. ### 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: #17261 - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
ligmaSec commented 2026-12-03 22:36:00 +00:00 (Migrated from github.com)

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

Review: COMMENTED


I compiled and ran the exact breakpoint and stop fixtures on Linux. Both passed, including registry capacity. Hit releases the registry mutex before waiting and Continue keys the wake to the stop ID. Please preserve those checks when reconciling the separate libc/CMakeLists.txt conflict with exact #17261. This head trial-merges cleanly onto c1601e56d5 by itself.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6179822375 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/17555#pullrequestreview-6179822375). Originally posted by [ligmaSec](https://github.com/ligmaSec) on 2026-12-03T22:36:00Z. **Review:** COMMENTED --- I compiled and ran the exact breakpoint and stop fixtures on Linux. Both passed, including registry capacity. `Hit` releases the registry mutex before waiting and `Continue` keys the wake to the stop ID. Please preserve those checks when reconciling the separate `libc/CMakeLists.txt` conflict with exact #17261. This head trial-merges cleanly onto `c1601e56d5` by itself. 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/17555:upstream-pr/17555'
git switch 'upstream-pr/17555'

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/17555'
git switch 'upstream-pr/17555'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/17555'
git switch 'upstream-pr/17555'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/17555'
git switch 'main'
git merge --squash 'upstream-pr/17555'
git switch 'main'
git merge --ff-only 'upstream-pr/17555'
git switch 'main'
git merge 'upstream-pr/17555'
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!17555
No description provided.