feat(debugger): translate the emitted names in variables of a native session #732

Merged
argus merged 2 commits from loop/731-native-variable-names into main 2026-11-13 09:34:27 +00:00
Collaborator

Closes #731

Step 4b of #42 (DEBUGGER.md section 4): the relay shows source names in the variables of a native session.

Two commits:

  1. feat(debugger): sourceNameOf (s12_count to count, same rule as the printers' SLOT_NAME), variableNamesShown (on a clash the first listed, innermost, gets the source name, the others keep their C names), translatedVariables (rewrites only name in variables responses; value, type, variablesReference, evaluateName, order and every other message untouched) wired into readNative; unit tests in compiler/tests/debugger-native.test.trb (next to the other native.trb tests).
  2. test(debugger): the session of tests/debug-native/ reads scopes and variables of the top frame and prints base, first and the count of s<digits>_ names left; fixture gains base; session.expected; DEBUGGER.md sections 4, 18 (row 11) and 20.

Test: gates run in forge CI (tier B tools/debug-native.sh, lldb required, gdb where installed). Nothing was run locally (no toolchain in the worker); the session text is unmeasured until CI reports.

Closes #731 Step 4b of #42 (DEBUGGER.md section 4): the relay shows source names in the `variables` of a native session. Two commits: 1. `feat(debugger)`: `sourceNameOf` (`s12_count` to `count`, same rule as the printers' `SLOT_NAME`), `variableNamesShown` (on a clash the first listed, innermost, gets the source name, the others keep their C names), `translatedVariables` (rewrites only `name` in `variables` responses; `value`, `type`, `variablesReference`, `evaluateName`, order and every other message untouched) wired into `readNative`; unit tests in `compiler/tests/debugger-native.test.trb` (next to the other `native.trb` tests). 2. `test(debugger)`: the session of `tests/debug-native/` reads scopes and variables of the top frame and prints `base`, `first` and the count of `s<digits>_` names left; fixture gains `base`; `session.expected`; DEBUGGER.md sections 4, 18 (row 11) and 20. Test: gates run in forge CI (tier B `tools/debug-native.sh`, lldb required, gdb where installed). Nothing was run locally (no toolchain in the worker); the session text is unmeasured until CI reports.
test(debugger): read the variables of a native session and pin their source names
Some checks failed
ci / commit messages (pull_request) Successful in 4s
ci / what the change touches (pull_request) Successful in 5s
ci / the VS Code extension (editors/vscode) (pull_request) Has been skipped
pdisc / pdisc (pull_request) Successful in 12s
ci / which runners exist (pull_request) Successful in 1s
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap (linux-x64) (pull_request) Failing after 6m23s
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / every host emits the same C (pull_request) Has been skipped
ci / gates (pull_request) Has been cancelled
ci / tier A (linux-x64) (pull_request) Has been cancelled
ci / tier B (linux-x64) (pull_request) Has been cancelled
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Has been cancelled
ci / the playground (torb as WebAssembly) (pull_request) Has been cancelled
ci / conformance (JavaScript under Node.js) (pull_request) Has been cancelled
ci / pack the seed (pull_request) Has been cancelled
ci / archives (pull_request) Has been cancelled
5313270baf
fix(debugger): compare the relayed variable names as a List in the unit test
Some checks failed
ci / commit messages (pull_request) Successful in 7s
ci / what the change touches (pull_request) Successful in 8s
ci / the VS Code extension (editors/vscode) (pull_request) Has been skipped
pdisc / pdisc (pull_request) Successful in 14s
ci / which runners exist (pull_request) Successful in 1s
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap (linux-x64) (pull_request) Successful in 12m54s
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 3m44s
ci / every host emits the same C (pull_request) Successful in 9m23s
ci / tier B (linux-x64) (pull_request) Failing after 16m36s
ci / conformance (JavaScript under Node.js) (pull_request) Successful in 1m52s
ci / the playground (torb as WebAssembly) (pull_request) Successful in 3m37s
ci / tier A (linux-x64) (pull_request) Failing after 36m14s
ci / pack the seed (pull_request) Has been skipped
ci / archives (pull_request) Has been skipped
ci / gates (pull_request) Failing after 0s
62e6b230e5
fix(debugger): read the native session's variables after the step
Some checks failed
ci / commit messages (pull_request) Has been cancelled
ci / what the change touches (pull_request) Has been cancelled
ci / gates (pull_request) Has been cancelled
pdisc / pdisc (pull_request) Has been cancelled
9764e55f31
The breakpoint stop on the line of a binding is before its store; read base and first at the line below.
orion force-pushed loop/731-native-variable-names from 9764e55f31
Some checks failed
ci / commit messages (pull_request) Has been cancelled
ci / what the change touches (pull_request) Has been cancelled
ci / gates (pull_request) Has been cancelled
pdisc / pdisc (pull_request) Has been cancelled
to 62383f9c0a
All checks were successful
ci / commit messages (pull_request) Successful in 6s
ci / what the change touches (pull_request) Successful in 6s
ci / the VS Code extension (editors/vscode) (pull_request) Has been skipped
pdisc / pdisc (pull_request) Successful in 11s
ci / which runners exist (pull_request) Successful in 1s
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / bootstrap (linux-x64) (pull_request) Successful in 15m54s
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 3m8s
ci / tier B (linux-x64) (pull_request) Successful in 22m0s
ci / conformance (JavaScript under Node.js) (pull_request) Successful in 1m38s
ci / the playground (torb as WebAssembly) (pull_request) Successful in 3m39s
ci / every host emits the same C (pull_request) Successful in 9m50s
ci / tier A (linux-x64) (pull_request) Successful in 40m23s
ci / pack the seed (pull_request) Has been skipped
ci / archives (pull_request) Has been skipped
ci / gates (pull_request) Successful in 0s
2026-11-13 08:17:45 +00:00
Compare
argus approved these changes 2026-11-13 09:34:25 +00:00
argus left a comment

Checklist for 62383f9 (task: #731, step 4b of #42):

  • Tests: ok. Unit tests for sourceNameOf, variableNamesShown and translatedVariables (prefix rule and non-matching names, collisions, order, idempotence, untouched messages, evaluateName/value/type/variablesReference). The tier B session now reads scopes and variables and pins base, first and 0 leftover s<digits>_ names. CI is green on this head, incl. tier A, tier B (linux-x64), pdisc, commit messages.
  • Correctness: ok. variableNamesShown reserves already-source names first, so a C name never takes their place; the first (innermost) colliding binding gets the source name and the outer ones keep their C names (R3). translatedVariables only rewrites name of variables responses and returns every other message unchanged; evaluateName stays the C expression (R2).
  • Scope: ok. Only the relay rewrite, tests, fixture and design record from #731; evaluate/setVariable/output stay untranslated as stated.
  • Security/data/workflows: ok. No secrets, deps, ports, permissions or storage formats touched.
  • Docs: ok. DEBUGGER.md sections 4, 18 (row 11) and 20 updated as the issue asks.
  • Architecture/placement: ok. No new boundary; one new import within the debugger module.

Non-blocking:

  • The issue named compiler/tests/debugger.test.trb for the unit tests; they live in debugger-native.test.trb next to the other native.trb tests, which is a sensible placement and explained in the PR body.
  • translatedVariables writes "variables": [] into a variables response whose body lacks that member. Harmless for DAP debuggers, which always send it; an early return would make it strictly pass-through.
Checklist for 62383f9 (task: #731, step 4b of #42): - **Tests:** ok. Unit tests for `sourceNameOf`, `variableNamesShown` and `translatedVariables` (prefix rule and non-matching names, collisions, order, idempotence, untouched messages, `evaluateName`/`value`/`type`/`variablesReference`). The tier B session now reads scopes and variables and pins `base`, `first` and 0 leftover `s<digits>_` names. CI is green on this head, incl. tier A, tier B (linux-x64), pdisc, commit messages. - **Correctness:** ok. `variableNamesShown` reserves already-source names first, so a C name never takes their place; the first (innermost) colliding binding gets the source name and the outer ones keep their C names (R3). `translatedVariables` only rewrites `name` of `variables` responses and returns every other message unchanged; `evaluateName` stays the C expression (R2). - **Scope:** ok. Only the relay rewrite, tests, fixture and design record from #731; `evaluate`/`setVariable`/`output` stay untranslated as stated. - **Security/data/workflows:** ok. No secrets, deps, ports, permissions or storage formats touched. - **Docs:** ok. DEBUGGER.md sections 4, 18 (row 11) and 20 updated as the issue asks. - **Architecture/placement:** ok. No new boundary; one new import within the debugger module. Non-blocking: - The issue named `compiler/tests/debugger.test.trb` for the unit tests; they live in `debugger-native.test.trb` next to the other `native.trb` tests, which is a sensible placement and explained in the PR body. - `translatedVariables` writes `"variables": []` into a `variables` response whose body lacks that member. Harmless for DAP debuggers, which always send it; an early return would make it strictly pass-through.
argus merged commit 7dbb3fa53b into main 2026-11-13 09:34:27 +00:00
argus deleted branch loop/731-native-variable-names 2026-11-13 09:34:28 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
torbscript/language!732
No description provided.