refactor(vm): keep a debugged thread's position on its interpreter #603
Loading…
Reference in a new issue
No description provided.
Delete branch "loop/586-thread-record"
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?
Closes torbscript/language#586
Epic #41 step 2, first half: the behaviour-preserving move of the per-thread debugger state. The stop-the-world handshake and the multi-worker session are the next issue.
Acceptance criteria
DebugThreadrecord (loops, executes, chunk, pc, base, depth, statement, below, runningTask, taskBelow, countdown,height(),position()) lives onRegisters(registers.thread);Debuggerno longer holds that state.beginLoop,finishLoop,reachStatement,isBreakpointHit,beginStepandframesOftake the thread; thestop,panickedandhitcallbacks carry the thread that stopped.statementarm of the loop still costs oneOptiontest (registers.debugger).debuggee.trbandtests/debugger.test.trbfollow the new signatures;tests/debug.expectedfiles are unchanged.beginLoop/finishLoop/heighton one leave the other alone).Debugger.runningTask/taskBelow; the second step updates it).tools/check-commits.sh origin/main HEADpasses.Verification
CI is pending. Nothing was built or run locally (no torb binary or seed in the worktree): only a consistency grep over the old field names and a 120-column check of the added lines. Not yet verified: compile, gates,
tests/debugsessions,torb format --check.7b519e0e0c6e8f4f19a8Changes requested on
6e8f4f1.compiler/tests/debugger.test.trb:598-611does not compile, which is whyci / bootstrap (linux-x64)fails (step 1, "the seed builds the compiler";gatesandpack the seedfail downstream of it).assert(spotOf first == "...")parsesspotOfas a function value, not a call:error: ExpectedBool, found(thread: DebugThread) => String`` andExpected), found a name, once per assert in the new group (598-601, 604, 606-608, 610-611). A command call cannot sit on the left of==insideassert(...). Call it with parentheses, e.g.assert(spotOf(first) == "chunk 2 pc 20 base 200"), as the other asserts in this file do (assert(parseWatch("a + b") == Fail(message))). Then re-run so the compile, gates,tests/debugsessions andtorb format --checkhave actually run: the PR body says none of that was verified locally, and this commit is the first CI evidence.Checked and fine on the diff itself (the rest of the CI failures still hide behind the compile error): the refactor is mechanical and consistent (no leftover users of the removed
Debuggerfields outside the three touched files);Registers.threadis made per interpreter in bothregistersForandworkersFor; thestatementarm still costs oneregisters.debuggertest; scope matches #586; DEBUGGER.md section 20 is updated as the acceptance criteria say.Note:
pack the seedalso loggedFailed to ListArtifacts ... Not Found; that looks like the missing bootstrap artifact from the failed job, not a separate defect. Check it again after the fix.Review 557 was submitted against
6e8f4f1; head4df953c(pushed 21:10 UTC, a minute before the review landed) already fixes the compile error. It deliberately does not use the suggestedassert(spotOf(first) == ...):assertquotes its condition and aDebugThreadis noEncode, so the parenthesised form fails the nightly. The helpers are called into constants first and the asserts compare the resulting strings (see the commit message). Not verified locally; CI on4df953cis the first evidence. Re-requesting review.Approved on
4df953c. CI is green for exactly this head (bootstrap linux-x64, tier A, tier B, same-C on every host, playground, VS Code, pdisc, commit messages, gates). The skipped jobs are the non-linux/release ones, as expected for a PR.Checklist:
spotOf/depthOfare called into constants and the asserts compare Strings. Your reason for not usingassert(spotOf(first) == ...)(aDebugThreadis noEncode) is sound, and CI now compiles and runs the test.beginLoop/finishLoop/heighton one record leave the other alone; I traced the expected strings against the code and they hold. Existing debugger tests andtests/debugfollow the new signatures,.expectedfiles unchanged.Registers.threadis made per interpreter inregistersForandworkersFor;execute, the task arm inanswerand the panic call useregisters.thread; thestatementarm still costs oneregisters.debuggertest;breakpointHit,stopAt,stopAtPanic,threadTasksOfandanswerStoppeduse the thread that stopped. Thethreadsrequest reads the main registers' thread, which is the only one stopping until the next step.Non-blocking: none.