debugger: a worker pool the debugger can hold (step 2 of #41) #586
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 2 of #41 (epic), first half. Step 1 (#403, PR #404) made every task a DAP thread on the single-worker model. Letting a debugged program use several workers needs two things: the debugger's per-thread position state must live per interpreter (today one
Debuggerobject holds the innermostexecute's position, its loop records and the running task, which only one thread may write), and a stop-the-world handshake in the VM and runtime. This issue is the first, behaviour-preserving half; the handshake and the multi-worker session are the next issue, filed when this one has landed (just in time, linked by dependency).Source
DEBUGGER.md sections 14 and 20
Goal
The state that describes where one thread is -
chunk,pc,base,depth,statement,below,loops,executes,runningTask,taskBelowand the statementcountdown- moves out of the sharedDebugger(compiler/src/vm/debug.trb) into a per-interpreter record reached through that interpreter'sRegisters. What is decided for the whole run stays shared: breakpoints,steppingand its start,pauseRequested,stopsOnEntry, the tables and the host callbacks. The debugger sources (compiler/src/debugger/) read the stopped thread's record. The run still uses one worker under the debugger; nothing observable changes.Acceptance criteria
Debuggerholds no field that is written at a statement or bybeginLoop/finishLoop; they are written on a per-interpreter record (one for the one worker now), andreachStatement,height,position,beginLoop,finishLoop, therunningTask/taskBelowbookkeeping ininterpret.trband the frame code incompiler/src/debugger/take that recordstop), so a second record would not be confused with the first; a unit test in the compiler's test suite builds two records and checks thatbeginLoop/finishLoop/heighton one do not change the othertests/debug/produces a byte-identical.expected; no.dapor.expectedfile changesstatementstill costs oneOptiontest), andworkersForis untouchedSeed
Settled: not in the seed's closure for anything that changes the seed. The debugger and VM sources are ordinary compiler code compiled by the seed; this change adds no syntax, no std name the compiler looks up by string, no native and no driver flag. No seed refresh is needed.
Size
Settled: one PR, two Conventional Commits -
refactor(vm): keep a debugged thread's position on its interpreter(the move, tests/debug unchanged), thentest(vm): two thread records do not share a positionplus the DEBUGGER.md note. The remainder of the original scope is the next step, filed when this one lands: kernel operations to hold and release the other workers,workersForgiving each worker an interpreter under the debugger, the stop-the-world handshake, a multi-worker session intests/debug/, and the section 14 decision update.Dependencies
Builds on #403 (merged). Part of #41.
[loop:torbscript] intake: in scope (author orion, label loop), step 2 of epic #41 (DEBUGGER.md sections 14 and 20), not a duplicate; step 1 (#403) is merged. Touches the VM worker model and debugger only, no syntax, std name or driver flag; seed relevance and size are settled in refinement. No owner decision needed (internal technical design). next: refine
[loop:torbscript] claim refine by session:loop-torbscript-20261029-0858 until 2026-10-29T19:30:00Z
[loop:torbscript] decided by the loop: #586 is split just in time. The original scope (workers under the debugger, stop-the-world handshake, multi-worker session, new kernel hold/release operation in runtime/task.c) does not fit one PR of two commits:
Debugger(debug.trb) is one shared object whose 10 position fields (chunk, pc, base, depth, statement, below, loops, executes, runningTask, taskBelow) pluscountdownare written at every statement, so a second interpreter thread would race on all of them; that has to move per interpreter first, and it is behaviour-preserving and checkable against the 9 existing tests/debug sessions byte for byte. The handshake half (runtime C + VM + session + section 14 decision) is the next issue, filed when this lands; I did not file it now (no backlog). Seed: debugger/VM sources are ordinary compiler code, no syntax, std-name or driver-flag change, no seed refresh. Acceptance criteria and size rewritten in the issue body.[loop:torbscript] refine: body rewritten to testable criteria, size one PR/two commits, seed settled (none), next: implement. Tokens used about 60k.
[loop:torbscript] claim implement by session:loop-torbscript-20261029-0858 until 2026-10-29T20:35:00Z
[loop:torbscript] release implement: PR #603 opened, CI pending
[loop:torbscript] claim fix by session:loop-torbscript-20261029-0858 until 2026-10-29T21:00:00Z
[loop:torbscript] release fix: bootstrap (linux-x64) of PR #603 failed in step 1 with two checker errors, not a signature mismatch. (1)
Registers.threadhad the field defaultDebugThread(), and a field default is a constant that may not make ashared typeobject; it is now a required field and both construction sites (registersFor,workersFor) pass their ownDebugThread(). (2) The new test assertedfirst.…andsecond.…directly, andassertquotes what it captures whileDebugThreadis notEncode; the test now compares words made by two small helpers (spotOf,depthOf). Each fix is folded into the commit that owns it (force-push with lease on the loop branch; history stays the same two Conventional Commits,check-commits.shclean). New head6e8f4f19. Not verified locally: no compiler on this machine, so forge CI is the first compile; the expected strings in the test were traced by hand.[loop:torbscript] claim fix by session:loop-torbscript-20261029-0858 until 2026-10-30T00:00Z
[loop:torbscript] release fix: debugger.test.trb thread-position test binds the spotOf/depthOf results to constants (command form) before asserting, since the published seed rejects
assert(f x == y)and the nightly rejectsassert(f(x) == y)(assertquotes its condition, a DebugThread is noEncode); head4df953c6Post-merge follow-up (PR #603, merged 2026-10-29 22:29 UTC as
66bd7d7): the change is merged and this issue is closed by its Closes trailer. Post-merge CI on66bd7d7was still pending at check time: ci commit messages, ci what-the-change-touches, ci gates, pdisc, and the site:edge image. Compile, gates and tests/debug are therefore not yet verified on main. The repo has no deploy step for this change. Follow-up: re-check the commit status on66bd7d7; if gates fail, reopen with the failing job.