debugger: setVariable #38
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
A write through the same places
variablesreads.Source
Acceptance criteria
setVariablefor locals and fieldstests/debug/Dependencies
None known.
Moved from the planning lists of the docs; the design record stays the specification.
[loop:torbscript] intake: in scope (author orion, label loop). Implements DEBUGGER.md section 20 (DAP
setVariablefor locals and fields); the design record is the specification, no collision with CONCEPT "Open Questions". Touches the debugger andtests/debug/, seed impact to be confirmed in refine. next: refine (queued)[loop:torbscript] refine: still queued behind the intake order. next: waiting (ready buffer full: #4, #163, #164, #223 are ready) until 2026-10-10T04:00:00Z
[loop:torbscript] claim refine by session:loop-torbscript-20261017 until 2026-10-17T00:10:30Z
[loop:torbscript] decided by the loop: scope, design and acceptance criteria for
setVariable(implements DEBUGGER.md section 20, item "setVariable"; no owner question applies, all of it is internal technical design).Goal. The adapter answers the DAP request
setVariablefor the scalar locals and scalar fields thevariablesrequest shows, and announcessupportsSetVariable: true. VS Code then offers "Set Value" in the Variables view.What is written (decided, why).
Bool,Char. Why: section 6 guarantees that a binding in sight holds a value it owns, borrows or is empty, and the ownership pass releases by reference count. Writing aString, list, map, case or a whole record would need allocation and count updates inside a stopped program, which section 12 rules out for evaluate and which is exactly what the open item "snippet evaluator" is for. Everything else answerssuccess: falsewith a message naming what can be set (Only numbers, Bool and Char can be set).varparameter holds), a field of a record, tuple orshared typeobject below it (inline in the registers, or in the counted block at pointer + 16), an item of a fixed array. Items ofList,MapandSetand fields of a case payload are refused for now (the read side finds them through the runtime's iterators, not through a stable address); not a split issue, the refusal message says so and a later issue can lift it if wanted.compiler/src/debugger/refinements.trb, section 12):42,-1,2.5,'a',true,false; the text must fit the target type (300into anUInt8is refused, a float into an integer is refused). No expressions, nothing runs.Valuegainsplace: Int(the address of its first word,0where it is a temporary or unknown);sliceOf,layoutChildrenand the boxed contents derive child places from it;Referenced.Locals(frame)resolves a name to a slot place,Referenced.Children(value)to a child by name. The store isMachine.store(one word) orKernelOperation.NarrowStorefor narrow container elements, both existing: no new native, no runtime change. After a write the adapter re-reads the words of every livevariablesReferencefrom its place so a re-fetch of the parent and of sibling views shows the new value (DAP clients re-request aftersetVariable).docs/tooling/torb-debug.md, as in every native debugger. Immortal or static blocks (constant data) must not be written to: the implementer checks howconst origin = Point 1, 2is allocated and refuses the write where the block is not an ordinary counted heap block; if refusal is needed, that is covered by criterion 5.Seed. Does not touch the seed: no syntax change, no new native, no driver flag, no std name looked up by string (
Machine.storeandNarrowStoreexist already). One commitfeat(debugger): set a scalar variable from the editorincluding the docs, or two (feat+docs); no seed refresh.Acceptance criteria (replace those of the body).
initializeanswerssupportsSetVariable: true;setVariablewithvariablesReferenceof Locals changes a scalar local (Int,Float64,Bool,Char, a narrowUInt8) and answersvalue,type,variablesReferenceof the new value (DAPSetVariableResponse).shared typeobject and an item of a fixed array, reached through aChildrenreference; also avarparameter (written through its address).variablesof the parent and of the containing value shows the new value, and the continued program uses it (printoutput in.expectedshows the changed number).success: falseand a message, program untouched: a non-scalar target (String, list, map, case, whole record), a value out of range or of the wrong kind (300intoUInt8,2.5intoInt,abc), an unknown name, a stale or unknown reference, a call while the program runs (asvariablesis answered only at a stop).const origin = Point 1, 2as intests/debug/breakpoint/main.trb) does not crash the adapter or the debuggee: either it works on an ordinary heap block or it is refused with a message; the session pins whichever it is.tests/debug/set-variable.dapwithset-variable/main.trb,.expectedregenerated withsh tools/debug.sh --update(checked by hand), covering 1 to 4 (gate of tier A,tools/debug.sh);tools/conformance.sh --vmunderTORB_VM_DEBUGGED=1stays as it is (no change without a debugger).docs/tooling/torb-debug.mdlistssetVariable;skills/regenerated if the docs change requires it. Unit tests incompiler/tests/debugger.test.trbfor the literal-to-words conversion (range, kind).Size. One PR:
compiler/src/debugger/values.trb,debuggee.trb,adapter.trb(about 250 lines), one session and fixture, one test file, docs. No split. Worker: sonnet/high (compiler/src), CI only for gates.[loop:torbscript] refine: definition of ready met (goal, 7 acceptance criteria, DEBUGGER.md section 20, no seed impact, one PR / one or two commits, decisions recorded above), label
readyset, next: implement. Refine worker usage: about 90k tokens (sonnet).[loop:torbscript] claim implement by session:loop-torbscript-20261017 until 2026-10-17T04:56:27Z
[loop:torbscript] implement: PR #379 opened (1 commit, Closes #38), forge CI green on
a5a8c237(gates, bootstrap, tier A/B, tests/debug); review requested from argus. Tokens: roughly 1.2M for this implement run. next: review