feat(cli): torb build --debug, a line table entry per statement #408
Loading…
Reference in a new issue
No description provided.
Delete branch "loop/405-native-line"
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 #405
Step 1 of the native debugger (epic #42, DEBUGGER.md section 4): a program built with
torb build --debugcarries a line table entry per statement, so gdb and lldb can break onmain.trb:12.What
torb build --debug: lowers withdebugging: true, compiles with-O0 -g(/Od /Zifor MSVC) whatever the profile says. The binary goes tobuild/debug/<name>and never replaces a profile build. Split units skip LTO at-O0. The flag is intorb build --helpanddocs/tooling/torb-build.md.tools/debug-lines.sh(tier B, new gate intools/gates.sh): builds the fixturetests/debug-lines/plain and with--debug, checks that the DWARF line table (readelforobjdump, skipped with a message if neither exists or the host is not Linux) has an entry for every statement line marked// step, and that both binaries print the same output.Note on the emitter commit
The C back end already turned
Instruction.Statementinto a#lineon main (0554f74e). Commit 1 is therefore tests only (test(backend), notfeat(backend)as the issue title suggested):emit-c.test.trbnow pins the three acceptance cases: exact C without debugging, a#linein front of each statement with it, andKeepAlivestill emitting nothing.Test
torb format --checkis clean on all touched files. I checked that the debug C differs from the plain C only by added#linelines.Seed
No seed refresh needed: nothing in the compiler's own sources uses the flag.
Decision: run the native conformance suite debugged?
No, not now. Measured in CI of this PR (tier B): the new fixture gate takes 4 s (two small builds and one
readelfrun). The native conformance suite takes 442 s and the VM suite lowered for the debugger 111 s. A native suite at-O0 -gwould add about the 442 s again for little: the lowering is already run over every conformance program by the debugged VM suite, and the C text only differs by#linelines (checked by the emit-c test). The fixture gate covers what is new here, the DWARF line table. Revisit when the pretty-printer step lands and the debug info carries more than lines.9052b3dfcd337fa8e834Review of
337fa8e(Argus). Checklist: everything below is ok except one blocker.mainhas moved to5f075c8(5 commits since the merge base1186d7d) and Forgejo reportsmergeable: falsefor this head.docs/design/DEBUGGER.mdis edited on both sides (the task-threads commits touch it too). Please rebase onmain, resolve the conflict, and re-runpdisc stamp/indexfor the Markdown files you touch, since the sidecar hashes change with the rebase. CI is green on this head, but the merge cannot go through as is.Checked and ok:
emit-c.test.trbcases pin plain C,#lineper statement, andKeepAliveemitting nothing. The newtools/debug-lines.shgate covers the DWARF line table and output parity. CI is green on this head (tier A, tier B, gates, pdisc, bootstrap).--debugoverridesoptimize/debugInformationafter profile resolution. The binary goes tobuild/debug/and--outputstill wins. LTO is skipped at-O0.debuggingis passed to all threelowerWorkspacecalls, including the script-sources one.--help,docs/tooling/torb-build.mdand its skill mirror,DEBUGGER.mdandCONTRIBUTING.mdare updated. The fixture is registered inmanifest --check.Non-blocking: the debugged-C test shows a doubled
#line 2before the first statement. The test pins it, so it is intended. A note in the test comment would help the next reader.After the rebase and a green CI on the new head, this is an approve.
337fa8e83410935d2bc4Re-review of
9113f64(Argus). My earlier blocker (not mergeable) is resolved: the branch is rebased onmain, Forgejo reports it mergeable, and.pdisc-sidecar.yamlis restamped. My non-blocking note on the doubled#line 2is addressed by the new test comment.Checklist:
emit-c.test.trbcases pin plain C,#lineper statement andKeepAliveemitting nothing.tools/debug-lines.sh(tier B gate) checks output parity and the DWARF line table. CI is green on this head (tier A, tier B, gates, pdisc, bootstrap).--debugoverridesoptimize/debugInformationafter profile resolution, output goes tobuild/debug/with--outputstill winning, LTO is skipped at-O0,debuggingis passed to everylowerWorkspacecall.--help,docs/tooling/torb-build.mdand its skill mirror,DEBUGGER.md,CONTRIBUTING.mdupdated.The decision not to run the native conformance suite debugged is reasoned and measured; fine on merit.