debugger: test names on closure frames #44
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 test body runs as a closure the test runner calls back, so its frame in
stackTraceis namedclosure(the chunk'slabel), and the body of a
groupisclosuretoo. A client seesdouble/closure/closure/math.test.trb(the session
tests/debug/tests.dap) and cannot tell which test it stopped in.Source
(the open point "Test names on closure frames"); frames and locals are section 10.
Acceptance criteria
test "<name>"with the name the test was given at run time, so a test created in aloop (
test "case {n}" { ... }, one chunk, many names) shows its own name. Proof:tests/debug/tests.expected(session
tests.dap, stops in the body ofMath > doubles) showstest "doubles"where it showedclosure; theframe after a step out shows it too.
sh tools/debug.sh.groupbody is namedgroup "<name>"the same way (group "Math"in that session), nestedgroups each with their own name. Proof: the same session.
closure), and so does a frame whose call site cannotbe resolved (fallback to the chunk name, never
?or a crash). Proof: a case incompiler/tests/debugger.test.trbthat stops in an ordinary closure and in a test body whose name is computed.
docs/design/DEBUGGER.mdsection 20 drops the point, section 10 says how frames are named, anddocs/tooling/torb-debug.md(stackTracerow) mentions the names;torb docs skill --checkstays clean.Design (decided by the loop, see the comment)
compiler/src/debugger/debuggee.trb.frameNameOfis computed once per chunk insessionOf, which cannotknow a run-time name.
stackTraceOfresolves the name per frame instead: a frame that is the outermost frame of acall-back loop (
vm/debug.trbframesOf) and whose chunk is a closure gets the name read from the frame below it,whose statement holds the
kernelcall of the nativetorb_test_case/torb_test_group(operand 1 is the nametext, read through the same value reader
variablesuses). Anything else keepsframeNames.Seed
Does not touch the seed: no syntax, no new native, no driver flag, no std name the compiler looks up by string (the
debugger reads the existing natives
torb_test_caseandtorb_test_groupby their position in the natives table).Size and model
One PR, one commit,
feat(debugger): name the frames of test and group bodies, with the session update and the docs.Tier A only (no
ir,backendorruntimefile). Implementer: opus/high (it reads VM frames and registers).Dependencies
None.
Moved from the planning lists of the docs; the design record stays the specification.
[loop:torbscript] intake: in scope (author orion, label loop), source DEBUGGER.md section 20, not a duplicate, no collision with a design record. Small debugger fix (frame naming of a test body); likely sonnet/medium. next: refine, waiting (ready buffer full: #4, #163, #164, #223 are ready) until 2026-10-10T04:00:00Z
[loop:torbscript] claim refine by session:loop-torbscript-20261010 until 2026-10-10T00:20Z (the earlier 'ready buffer full' wait named #4, #163 and #223, which are closed; the ready issues still open are all in flight or blocked on a seed or on PR #282)
[loop:torbscript] refine: ready, a test body's frame shows
test "<name>"and a group body'sgroup "<name>"(names read at run time, ordinary closures keepclosure), next: implementAcceptance criteria and design are in the issue body: (1) test frame named by its run-time name, proved by
tests/debug/tests.expected(sh tools/debug.sh); (2) group frame likewise; (3) ordinary closure and unresolvable call site keep the chunk name, proved incompiler/tests/debugger.test.trb; (4) DEBUGGER.md section 20/10 and torb-debug.md updated, skills check clean.Seed: not touched. Size: one PR, one commit
feat(debugger): name the frames of test and group bodies, tier A. Model: opus/high.[loop:torbscript] decided by the loop: the name is read per frame at stop time and not per chunk at session start. Today
frameNameOf(debuggee.trb) runs once per chunk and a test body is an anonymous closure chunk labelledclosure; the name is a run-time argument of the nativetest, so a test made in a loop shares one chunk across many names. A static lookup of string literals at the call site was rejected for that reason (wrong or empty for computed names). The call-back runs the body fromtorb_machine_test_case, so inframesOfthe frame below the body's loop is the one whose statement holds thetorb_test_case/torb_test_groupkernel call; its text operand is the name. This needs no C runtime change, no new native and no kernel operation, so no seed work. Thetest "..."/group "..."form (not the bare name) is chosen so a test named like a function is not mistaken for one in the call stack.[loop:torbscript] claim implement by session:loop-torbscript-20261010 until 2026-10-10T04:24Z
[loop:torbscript] implement: PR #289, CI green (
08e2eac6; the first run's tier B failed only in the unrelated runtime IO test test_io_a_cancelled_wait_releases_its_registration, the rerun passed), worker usage unknown, next: waiting (review by the merge gate argus)