debugger: native build with a #line per statement (step 1 of #42) #405
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 1 of #42 (epic: debug native programs, DEBUGGER.md section 4). The C back end already writes a
#lineper block, but it ignores theStatementmarker a debugged lowering writes (backend/c/body.trb,.Statement(_, _) => {}), andtorb buildnever lowers for debugging. Until that holds, gdb and lldb can only stop block by block.Source
DEBUGGER.md sections 4, 5 and 18
Goal
torb build --debugproduces a native binary that gdb or lldb can break and step in by TorbScript line, statement by statement.Acceptance criteria
Instruction.Statement(at, ...)into a#lineof its location, and nothing else changes for an IR without markers (emit-c.test.trb: the C of a program lowered withoutdebuggingis byte for byte what it was; the C of one lowered with it has a#linein front of each statement, andKeepAlivestill emits nothing)torb build --debuglowers withdebugging: trueand compiles with-O0 -g(/Od /Zifor MSVC) whatever the profile says; without the flag nothing changes. It is listed intorb build --helpanddocs/tooling/--debug; a script intools/(a gate of tier B) checks on linux-x64 that the binary's DWARF line table has an entry for each statement line of the fixture (via the platform'sreadelf/objdump; the gate skips with a message where neither is installed) and that the binary prints what the plain build printsSeed
Adds a driver flag (
torb build --debug), so under the contract's definition it touches the seed's surface, but nothing in the compiler's own sources uses the flag and no syntax, native or looked-up std name changes: no seed refresh is needed. If the PR finds otherwise, a refresh stays Torben's.Size
One PR, two Conventional Commits:
feat(backend): a #line per statement of a debugged lowering(emitter +emit-ctests),feat(cli): torb build --debug(flag, gate script, docs).Dependencies
File overlap with #39 and #403 is small (they edit
compiler/src/debugger/,tests/debug/; this step editsbackend/c/body.trb,cli/build.trb,tools/). DEBUGGER.md section 18 and 20 overlap with them: rebase after whichever lands first. #403 is already ready and independent.Part of #42.
[loop:torbscript] refine: ready. Step 1 of the epic #42, filed just in time (keyword search of open issues found no duplicate). Goal, testable criteria, design record point (DEBUGGER.md sections 4, 5, 18), seed note and size (one PR, two commits) are in the body. Tokens used for this refine: about 90k.
[loop:torbscript] claim implement by session:loop-torbscript-20261023 until 2026-10-23T07:49:37Z
[loop:torbscript] implement: PR #408 open (#408), CI green (tier A, tier B incl. the new line-table gate in 4 s, bootstrap, pdisc), next: review. Notes: the C emitter already wrote a
#lineper statement on main, so commit 1 only pins it with emit-c tests; commit 2 addstorb build --debug,tools/debug-lines.sh,tests/debug-lines/and the docs. The decision on a debugged native conformance suite (not now, 442 s native run vs 4 s fixture gate) is in the PR body. One CI fix round (pdisc stamp of compiler/CONTRIBUTING.md). Tokens: not metered inside this subagent run.