feat(tools): nid_names client for the debugger #17558

Open
MarcZX10 wants to merge 47 commits from upstream-pr/17558 into main
MarcZX10 commented 2026-11-08 22:09:29 +00:00 (Migrated from github.com)

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


What

Adds tools/debug_nids.py, a client that writes breakpoint commands into the file named by ANYPS5_DEBUG_CMD (or --cmd). add and remove take NIDs or symbol names; names are hashed the same way the tables are, and anything else is refused. list, args and continue are written as they are. The file is overwritten on each call, because a stop reads its first line.

Documented in docs/dev/REVERSE_ENGINEERING.md. Unit tests use the sinh vector from the NID name database tests.

Stacked on the PR 4 branch (feat/relinker-nid-hook-table); this branch contains its 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=dbg5a ANYPS5_REQUIRE_DISPLAY=1 bash <main checkout>/.git/info/tools/run_tests.sh '^(debug_nids_client)$' build.ninja

Output:

BUILD-EXIT 0
1/1 Test #229: debug_nids_client ................   Passed    0.22 sec
100% tests passed, 0 tests failed out of 1

The client's tests also run on their own with python3 -m unittest tools/tests/test_debug_nids.py: 7 tests, all pass.

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:

  • Whether a running title receives the commands: the stop wiring is not in this series yet.
  • The file-overwrite behaviour with a FIFO.

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: #17557
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5215591512 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/17558). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-08T22:09:29Z. --- ### What Adds `tools/debug_nids.py`, a client that writes breakpoint commands into the file named by `ANYPS5_DEBUG_CMD` (or `--cmd`). `add` and `remove` take NIDs or symbol names; names are hashed the same way the tables are, and anything else is refused. `list`, `args` and `continue` are written as they are. The file is overwritten on each call, because a stop reads its first line. Documented in `docs/dev/REVERSE_ENGINEERING.md`. Unit tests use the sinh vector from the NID name database tests. Stacked on the PR 4 branch (`feat/relinker-nid-hook-table`); this branch contains its 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=dbg5a ANYPS5_REQUIRE_DISPLAY=1 bash <main checkout>/.git/info/tools/run_tests.sh '^(debug_nids_client)$' build.ninja ``` Output: ``` BUILD-EXIT 0 1/1 Test #229: debug_nids_client ................ Passed 0.22 sec 100% tests passed, 0 tests failed out of 1 ``` The client's tests also run on their own with `python3 -m unittest tools/tests/test_debug_nids.py`: 7 tests, all pass. 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: - Whether a running title receives the commands: the stop wiring is not in this series yet. - The file-overwrite behaviour with a FIFO. ### 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: #17557 - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
ligmaSec commented 2026-12-03 11:21:20 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T11:21:20Z.

Review: COMMENTED


Ran the submitted debugger NID client suite on Linux. All eight cases passed, including ordered command output, replacement of an existing output file, canonical NID checks, and print mode.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6168740840 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/17558#pullrequestreview-6168740840). Originally posted by [ligmaSec](https://github.com/ligmaSec) on 2026-12-03T11:21:20Z. **Review:** COMMENTED --- Ran the submitted debugger NID client suite on Linux. All eight cases passed, including ordered command output, replacement of an existing output file, canonical NID checks, and print mode. 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/17558:upstream-pr/17558'
git switch 'upstream-pr/17558'

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