debugger: translate the emitted names in variables of a native session (step 4b of #42) #731
Labels
No labels
loop
queue/failed
queue/queued
ready
status/parked
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
torbscript/language#731
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
Step 4b of the epic #42 (debug native programs, DEBUGGER.md section 4). Step 4a (#720, PR #723) landed:
torb debugwithnative: truebuilds the program with--debug, startslldb-daporgdb --interpreter=dap, and relays the session as it is (compiler/src/debugger/adapter.trb,readNative;compiler/src/debugger/native.trb). The names in thevariablesan editor reads are still C's (s12_count); section 4 and section 20 list translating them as open. The values are already formatted by the printers of steps 2 and 3 (tools/gdb/torb_printers.py,tools/lldb/torb_formatters.py,SLOT_NAME = ^s[0-9]+_(.+)$), which do the same forbt full, the machine interface andtorb-locals.Goal
An editor that reads the
variablesof a native session sees a binding by its source name (count, nots12_count), as it does in a VM session.Requirements
variablesresponse of the native debugger to the editor, the system shall replace each variablenamethat has the forms<digits>_<name>with<name>; any other name (a C temporary,torb_-prefixed runtime variables, a register, a name without the prefix) stays as it is.value,type,variablesReference,evaluateNameor the order of the variables, and shall not touch any other response or event;evaluateNamestays the C expression, so that a laterevaluateorsetVariablestill reaches the native debugger.compiler/src/debugger/native.trb(sourceNameOf(cName): String, the same rule as the printers'SLOT_NAME), unit-tested incompiler/tests/debugger.test.trbwithout a debugger.tests/debug-native/shall read the scopes and variables of the top frame after the breakpoint, and print the variable names with their formatted values;tests/debug-native/session.expectedpins them for lldb and gdb alike (the fixture gains a binding or a parameter when the current one has none in sight; the breakpoint line stays the one that ends in// break).Acceptance criteria
sourceNameOfmapss12_counttocount,s3_a_btoa_b,s_x,x,torb_tmp,s12_and the empty text to themselves; tests incompiler/tests/debugger.test.trbpass.variablesresponse of a stop intests/debug-native/shows source names for the program's bindings under bothTORB_DEBUG_NATIVE=lldbandTORB_DEBUG_NATIVE=gdb; nos<digits>_name remains in it.tools/debug-native.shis green on the forge CI (tier B,DEBUG_NATIVE_REQUIRE=lldb) with the extended session; the gdb run is checked where gdb 14+ is installed and skips with a message otherwise, as 4a does.evaluateNameandvalueof the variables are as the native debugger wrote them (shown in the session or in a compiler test of the relay function).Design record and size
Implements DEBUGGER.md section 4 (
torb debug... "translating names (s12_counttocount) invariables") and section 20 "Native programs". One PR of two Conventional Commits: (1)sourceNameOf, the relay rewrite ofvariablesresponses, unit tests; (2) the extended session,session.expected, the design-record update.Measure in the PR, do not ask: if one debugger's DAP already answers with source names through the printers' frame filter, the rewrite stays idempotent (a name without prefix is unchanged), and the session pins that.
Seed impact
None. TorbScript in
compiler/src/debugger/and a test fixture only: no syntax, native, driver flag or std name the compiler looks up by string.Out of scope
Translating names in
evaluateexpressions,setVariableandoutput; breakpoint conditions in source names; the user docs (torb-debug.md, the editor guide) and the VS Code launch for a native program, which are step 5 of #42.Dependencies
Parent: #42. Follows #720 (landed). #719 (step 2b of #41) is independent; both touch DEBUGGER.md sections 18 and 20, rebase after whichever lands first.
[loop:torbscript] claim implement by session:loop-torbscript-20261113 until 2026-11-13T10:54:52Z
[loop:torbscript] claim review by session:loop-torbscript-20261113 until 2026-11-13T08:56:41Z
PR #732: job 'bootstrap (linux-x64)' is red; fix round on the same branch.
[loop:torbscript] claim review by session:loop-torbscript-20261113 until 2026-11-13T10:42:00Z
[loop:torbscript] release review: fix worker hit the anthropic:notahumanmate weekly limit (reset 2026-11-15T20:00Z) without a report; it pushed
9764e55to PR #732 first, CI running, PR not mergeable (conflict with main). next: fix round on the same branch with a rebase onto main when a worker slot on another profile is free[loop:torbscript] claim review by session:loop-torbscript-20261113 until 2026-11-13T11:20:00Z
[loop:torbscript] review: rebased
loop/731-native-variable-namesonto currentmain(one conflict indocs/design/DEBUGGER.mdsection 20, resolved by keeping both the worker-pool and the native-programs bullets) and folded the two fix commits into their parents, so PR #732 is two Conventional Commits again (tools/check-commits.shclean, tree identical to the previous head9764e55f). Force-pushed with lease to theloop/*branch, new head62383f9c. CI on it after 30 min:bootstrap (linux-x64)(red before), cross-compiles, commit messages and pdisc green;gates, tier A and tier B still pending, no red job yet. Nothing run locally (no toolchain). Worker usage: roughly 0.1M tokens (sonnet). next: waiting (CI)Merged as PR #732 (merge commit
7dbb3fa53b). Verified after merge: no 'After merge' section; the repo has no x.y.z tag yet (only nightly tags; project.trb is 0.1.0). Release cadence (docs/design/RELEASE.md section 3): the next minor is cut on the first Tuesday of the month, its release candidate the Tuesday before, so the change ships with the 0.2.0 line on the calendar (rc Tue 2026-11-24, minor Tue 2026-12-01), not as an off-cadence release. Next step: include it in that rc/minor; nothing else is open on this task.