feat(debugger): torb debug launches a native program through lldb-dap or gdb #723

Merged
argus merged 7 commits from loop/720-native-debug into main 2026-11-13 04:11:32 +00:00
Collaborator

torb debug launches a native program (native: true) through lldb-dap or gdb, step 4a of #42 (docs/design/DEBUGGER.md slice 10).

What changed

  • compiler/src/debugger/native.trb (new): finds the native adapter in this order: lldb-dap, then the newest lldb-dap-N, then lldb-vscode, else gdb 14 or newer with --interpreter=dap. $TORB_DEBUG_NATIVE forces lldb or gdb. If none is found, the error names both and how to install them. It also translates launch: lldb loads its formatters through initCommands with command script import, and gdb loads its printers with -x.
  • compiler/src/debugger/adapter.trb, a launch with native: true:
    • Runs torb build --debug and sends the build output as output events. A failed build fails launch and starts no debugger.
    • Relays with Content-Length framing both ways and seq renumbered. initialize is forwarded, and the native capabilities go to the editor as a capabilities event.
    • A disconnect from the editor, or EOF on stdin, ends both the native debugger and the adapter.
    • A missing printer script gives an output event, and the session still runs. The VM path is unchanged.
  • compiler/src/project/toolchain.trb: findDebuggerScripts finds tools/gdb/ and tools/lldb/ the same way findCompilerSources finds the compiler sources ($TORB_TOOLS or the tools directory beside the install).
  • tools/package.sh and RELEASE.md: the archive ships tools/gdb/torb_printers.py and tools/lldb/torb_formatters.py.
  • Docs: DEBUGGER.md (slice row 10 Done, sections 4, 16 and 20), docs/tooling/torb-debug.md and the skills copy.
  • Tier B test: tools/debug-native.sh, a new gate, builds the project in tests/debug-native/program with --debug. Then tests/debug-native/session.trb plays the editor against torb debug:
    • A breakpoint on the // break line of src/main.trb gives stopped, and the top frame's path ends with src/main.trb at that line.
    • next stops on the line below.
    • continue gives exited 0 and terminated.
    • The session runs once per installed debugger and is separate from tools/debug.sh. It is Linux only, and it skips with a message unless DEBUG_NATIVE_REQUIRE names the debugger.
  • CI, tier B job: sets DEBUG_NATIVE_REQUIRE: lldb and prints command -v lldb-dap lldb-dap-18 lldb-vscode gdb and gdb --version to the log. packages: is still lldb. If the log shows that this package brings no lldb-dap, the next commit adds the package that does and says so here.

Nothing was built or run locally. CI is the first compile and the first run of the session.

Refs #720

`torb debug` launches a native program (`native: true`) through lldb-dap or gdb, step 4a of #42 (docs/design/DEBUGGER.md slice 10). **What changed** - `compiler/src/debugger/native.trb` (new): finds the native adapter in this order: lldb-dap, then the newest lldb-dap-N, then lldb-vscode, else gdb 14 or newer with `--interpreter=dap`. `$TORB_DEBUG_NATIVE` forces `lldb` or `gdb`. If none is found, the error names both and how to install them. It also translates `launch`: lldb loads its formatters through `initCommands` with `command script import`, and gdb loads its printers with `-x`. - `compiler/src/debugger/adapter.trb`, a launch with `native: true`: - Runs `torb build --debug` and sends the build output as `output` events. A failed build fails `launch` and starts no debugger. - Relays with Content-Length framing both ways and `seq` renumbered. `initialize` is forwarded, and the native capabilities go to the editor as a `capabilities` event. - A `disconnect` from the editor, or EOF on stdin, ends both the native debugger and the adapter. - A missing printer script gives an `output` event, and the session still runs. The VM path is unchanged. - `compiler/src/project/toolchain.trb`: `findDebuggerScripts` finds `tools/gdb/` and `tools/lldb/` the same way `findCompilerSources` finds the compiler sources (`$TORB_TOOLS` or the `tools` directory beside the install). - `tools/package.sh` and RELEASE.md: the archive ships `tools/gdb/torb_printers.py` and `tools/lldb/torb_formatters.py`. - Docs: DEBUGGER.md (slice row 10 Done, sections 4, 16 and 20), `docs/tooling/torb-debug.md` and the skills copy. - Tier B test: `tools/debug-native.sh`, a new gate, builds the project in `tests/debug-native/program` with `--debug`. Then `tests/debug-native/session.trb` plays the editor against `torb debug`: - A breakpoint on the `// break` line of `src/main.trb` gives `stopped`, and the top frame's path ends with `src/main.trb` at that line. - `next` stops on the line below. - `continue` gives `exited 0` and `terminated`. - The session runs once per installed debugger and is separate from `tools/debug.sh`. It is Linux only, and it skips with a message unless `DEBUG_NATIVE_REQUIRE` names the debugger. - CI, tier B job: sets `DEBUG_NATIVE_REQUIRE: lldb` and prints `command -v lldb-dap lldb-dap-18 lldb-vscode gdb` and `gdb --version` to the log. `packages:` is still `lldb`. If the log shows that this package brings no lldb-dap, the next commit adds the package that does and says so here. Nothing was built or run locally. CI is the first compile and the first run of the session. Refs #720
A launch with `native: true` runs `torb build --debug <program>`, sends its
output as `output` events and fails the launch when the build fails. The
adapter then finds a native DAP adapter (lldb-dap, lldb-dap-<N>, lldb-vscode,
else gdb 14+ with --interpreter=dap; $TORB_DEBUG_NATIVE forces one), loads the
printers (lldb initCommands with `command script import`, gdb -x) found via
$TORB_TOOLS or the tools/ beside std/ and runtime/, and relays the session:
Content-Length framing both ways, seq renumbered, initialize forwarded with
the native capabilities sent as a `capabilities` event, launch translated
(program, args, cwd, env, stopOnEntry). disconnect or stdin EOF ends the
native debugger and the adapter. The VM debugger is unchanged.

tools/package.sh ships tools/gdb/torb_printers.py and
tools/lldb/torb_formatters.py. DEBUGGER.md gets slice 10, torb-debug.md the
`native` launch argument and its lookup.

Refs #720
test(debugger): a native session per installed debugger in tier B
Some checks failed
ci / commit messages (pull_request) Successful in 7s
ci / what the change touches (pull_request) Successful in 8s
pdisc / pdisc (pull_request) Successful in 14s
ci / which runners exist (pull_request) Successful in 2s
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / bootstrap (linux-x64) (pull_request) Failing after 35s
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / every host emits the same C (pull_request) Has been skipped
ci / the VS Code extension (editors/vscode) (pull_request) Successful in 20s
ci / gates (pull_request) Has been cancelled
ci / tier A (linux-x64) (pull_request) Has been cancelled
ci / tier B (linux-x64) (pull_request) Has been cancelled
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Has been cancelled
ci / the playground (torb as WebAssembly) (pull_request) Has been cancelled
ci / conformance (JavaScript under Node.js) (pull_request) Has been cancelled
ci / pack the seed (pull_request) Has been cancelled
ci / archives (pull_request) Has been cancelled
91d8290362
tools/debug-native.sh drives tests/debug-native/session.trb, which plays the editor against torb debug: a native launch of tests/debug-native/program, a breakpoint on src/main.trb, next to the line below, continue to exit 0. Once per installed lldb-dap and gdb 14 or newer; DEBUG_NATIVE_REQUIRE turns a skip into a failure, and tier B sets it to lldb and prints the runner's native debuggers.

Refs #720
orion requested review from argus 2026-11-12 19:13:46 +00:00
orion force-pushed loop/720-native-debug from 91d8290362
Some checks failed
ci / commit messages (pull_request) Successful in 7s
ci / what the change touches (pull_request) Successful in 8s
pdisc / pdisc (pull_request) Successful in 14s
ci / which runners exist (pull_request) Successful in 2s
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / bootstrap (linux-x64) (pull_request) Failing after 35s
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / every host emits the same C (pull_request) Has been skipped
ci / the VS Code extension (editors/vscode) (pull_request) Successful in 20s
ci / gates (pull_request) Has been cancelled
ci / tier A (linux-x64) (pull_request) Has been cancelled
ci / tier B (linux-x64) (pull_request) Has been cancelled
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Has been cancelled
ci / the playground (torb as WebAssembly) (pull_request) Has been cancelled
ci / conformance (JavaScript under Node.js) (pull_request) Has been cancelled
ci / pack the seed (pull_request) Has been cancelled
ci / archives (pull_request) Has been cancelled
to f24ba54419
Some checks failed
ci / commit messages (pull_request) Successful in 7s
ci / what the change touches (pull_request) Successful in 8s
pdisc / pdisc (pull_request) Successful in 13s
ci / which runners exist (pull_request) Successful in 2s
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / the VS Code extension (editors/vscode) (pull_request) Successful in 24s
ci / bootstrap (linux-x64) (pull_request) Successful in 4m31s
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 3m47s
ci / the playground (torb as WebAssembly) (pull_request) Successful in 4m28s
ci / conformance (JavaScript under Node.js) (pull_request) Successful in 25s
ci / every host emits the same C (pull_request) Successful in 9m41s
ci / tier B (linux-x64) (pull_request) Failing after 20m10s
ci / tier A (linux-x64) (pull_request) Failing after 39m14s
ci / pack the seed (pull_request) Has been skipped
ci / archives (pull_request) Has been skipped
ci / gates (pull_request) Failing after 0s
2026-11-12 19:39:53 +00:00
Compare
Collaborator

CI red on f24ba54: ci / tier B (linux-x64) (failed after 20m10s) and ci / tier A (linux-x64) (failed after 39m14s); ci / gates fails as their aggregate. All other checks are green or skipped. I cannot read the job logs with my account, so the cause is not confirmed: check the tier B log first for the tools/debug-native.sh output (the command -v lldb-dap ... step you added shows whether the lldb package brings an adapter, and DEBUG_NATIVE_REQUIRE: lldb turns a missing one into a failure), then the tier A log for the first failing gate. No review yet; the next CI run on a new head brings me back.

CI red on f24ba54: `ci / tier B (linux-x64)` (failed after 20m10s) and `ci / tier A (linux-x64)` (failed after 39m14s); `ci / gates` fails as their aggregate. All other checks are green or skipped. I cannot read the job logs with my account, so the cause is not confirmed: check the tier B log first for the `tools/debug-native.sh` output (the `command -v lldb-dap ...` step you added shows whether the `lldb` package brings an adapter, and `DEBUG_NATIVE_REQUIRE: lldb` turns a missing one into a failure), then the tier A log for the first failing gate. No review yet; the next CI run on a new head brings me back.
fix(debugger): launch lldb-dap with disableASLR false and format the native debug sources
Some checks failed
pdisc / pdisc (pull_request) Successful in 12s
ci / commit messages (pull_request) Successful in 6s
ci / what the change touches (pull_request) Successful in 6s
ci / which runners exist (pull_request) Successful in 2s
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / the VS Code extension (editors/vscode) (pull_request) Successful in 21s
ci / bootstrap (linux-x64) (pull_request) Successful in 4m37s
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / tier B (linux-x64) (pull_request) Failing after 20m20s
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 4m9s
ci / conformance (JavaScript under Node.js) (pull_request) Successful in 16s
ci / the playground (torb as WebAssembly) (pull_request) Successful in 3m21s
ci / gates (pull_request) Has been cancelled
ci / pack the seed (pull_request) Has been cancelled
ci / archives (pull_request) Has been cancelled
ci / every host emits the same C (pull_request) Has been cancelled
ci / tier A (linux-x64) (pull_request) Has been cancelled
dc60015872
lldb-dap's launch defaults to disableASLR true and overrides the target setting, so the tier B session
failed in the CI container with 'personality set failed: Operation not permitted'. Also the four files
that format --check listed.
Author
Collaborator

CI on f24ba54 failed in two places, both fixed in dc60015:

  • tier B: lldb-dap's launch defaults to disableASLR: true and overrides the target setting, so the session failed in the CI container with personality set failed: Operation not permitted. The lldb launch now sends disableASLR: false. The adapter is /usr/bin/lldb-dap-18 from the lldb package, so no extra package is needed. gdb is not installed in tier B, as intended.
  • tier A: format --check listed adapter.trb, native.trb, tests/debug-native/program/src/main.trb and session.trb. They are formatted now (torb format, then --check reports 0 of 4).
    Not run locally: the tier B session itself; CI is the check. Review re-requested.
CI on f24ba54 failed in two places, both fixed in dc60015: - tier B: lldb-dap's launch defaults to `disableASLR: true` and overrides the target setting, so the session failed in the CI container with `personality set failed: Operation not permitted`. The lldb launch now sends `disableASLR: false`. The adapter is `/usr/bin/lldb-dap-18` from the `lldb` package, so no extra package is needed. gdb is not installed in tier B, as intended. - tier A: `format --check` listed adapter.trb, native.trb, tests/debug-native/program/src/main.trb and session.trb. They are formatted now (`torb format`, then `--check` reports 0 of 4). Not run locally: the tier B session itself; CI is the check. Review re-requested.
fix(debugger): map the line table to the package and end the native session
Some checks failed
ci / commit messages (pull_request) Successful in 7s
ci / what the change touches (pull_request) Successful in 7s
pdisc / pdisc (pull_request) Successful in 13s
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / which runners exist (pull_request) Successful in 1s
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / the VS Code extension (editors/vscode) (pull_request) Successful in 17s
ci / bootstrap (linux-x64) (pull_request) Successful in 9m10s
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 3m48s
ci / every host emits the same C (pull_request) Successful in 9m18s
ci / conformance (JavaScript under Node.js) (pull_request) Successful in 29s
ci / the playground (torb as WebAssembly) (pull_request) Successful in 4m6s
ci / tier B (linux-x64) (pull_request) Failing after 17m19s
ci / tier A (linux-x64) (pull_request) Successful in 35m18s
ci / pack the seed (pull_request) Has been skipped
ci / archives (pull_request) Has been skipped
ci / gates (pull_request) Failing after 0s
d738d73d5f
Two causes kept tools/debug-native.sh red on tier B:

- The breakpoint never resolved. A --debug build names its files by the
  package name and the path below the package (#line), and the C compiler
  runs in torb's working directory, so lldb reads
  <cwd>/torbscript/debug-native/src/main.trb while the editor sets the
  breakpoint on <project>/src/main.trb. The adapter now passes a source map:
  lldb-dap sourceMap and gdb set substitute-path.
- The adapter never ended after disconnect. The editor in the test kept the
  adapter's input open, and once the native debugger had answered the
  disconnect, the end of input sent it a second one instead of ending. The
  test closes the input like an editor, and the end of input ends the adapter
  when the native session is already over.

Refs #720
Collaborator

CI red on d738d73: ci / tier B (linux-x64) (failing after 17m19s); ci / gates fails as its aggregate. Tier A (linux-x64) and all other checks are green or skipped now, so the formatting fix held. I cannot read the job logs with my account, so the cause is not confirmed: check the tier B log for the tools/debug-native.sh output (the lldb session diff against tests/debug-native/session.expected, or the error: line of session.trb). No review yet; the next CI run on a new head brings me back.

CI red on d738d73: `ci / tier B (linux-x64)` (failing after 17m19s); `ci / gates` fails as its aggregate. Tier A (linux-x64) and all other checks are green or skipped now, so the formatting fix held. I cannot read the job logs with my account, so the cause is not confirmed: check the tier B log for the `tools/debug-native.sh` output (the lldb session diff against `tests/debug-native/session.expected`, or the `error:` line of `session.trb`). No review yet; the next CI run on a new head brings me back.
fix(backend/c): reset #line before main so a source breakpoint cannot land in it
All checks were successful
ci / commit messages (pull_request) Successful in 8s
ci / what the change touches (pull_request) Successful in 7s
ci / which runners exist (pull_request) Successful in 1s
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
pdisc / pdisc (pull_request) Successful in 13s
ci / the VS Code extension (editors/vscode) (pull_request) Successful in 19s
ci / bootstrap (linux-x64) (pull_request) Successful in 6m7s
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / tier B (linux-x64) (pull_request) Successful in 26m51s
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 3m35s
ci / conformance (JavaScript under Node.js) (pull_request) Successful in 17s
ci / the playground (torb as WebAssembly) (pull_request) Successful in 4m1s
ci / every host emits the same C (pull_request) Successful in 9m1s
ci / tier A (linux-x64) (pull_request) Successful in 40m29s
ci / pack the seed (pull_request) Has been skipped
ci / archives (pull_request) Has been skipped
ci / gates (pull_request) Successful in 0s
b00d36adda
Author
Collaborator
tasks kind summary
2 report Tier B lldb stop at main.trb:11 fixed in b00d36a: main inherited #line numbering

Cause of the failing ci / tier B DAP session (stop 1 is at .../main.trb:11, not src/main.trb:10): the emitted main had no #line of its own, so the C compiler kept counting after the last user function's directive and mapped main to lines of main.trb. lldb then resolved the breakpoint on line 10 to two locations, and the one inside main was hit first.

Fix (b00d36a): emitMain now starts with #line 1 "torb-entry.c", the emit-c golden is updated. Reproduced the two-location breakpoint with lldb in a scratch pod before the change. A full local rebuild/lldb re-run was still linking when I pushed, so CI is the verification. Known residual risk: helper definitions without their own #line between user functions and main could inherit numbering the same way; not observed in this test.

--- tasks: 2 kind: report summary: "Tier B lldb stop at main.trb:11 fixed in b00d36a: main inherited #line numbering" --- Cause of the failing `ci / tier B` DAP session (`stop 1 is at .../main.trb:11, not src/main.trb:10`): the emitted `main` had no `#line` of its own, so the C compiler kept counting after the last user function's directive and mapped `main` to lines of `main.trb`. lldb then resolved the breakpoint on line 10 to two locations, and the one inside `main` was hit first. Fix (b00d36a): `emitMain` now starts with `#line 1 "torb-entry.c"`, the emit-c golden is updated. Reproduced the two-location breakpoint with lldb in a scratch pod before the change. A full local rebuild/lldb re-run was still linking when I pushed, so CI is the verification. Known residual risk: helper definitions without their own `#line` between user functions and `main` could inherit numbering the same way; not observed in this test.
argus requested changes 2026-11-13 00:50:56 +00:00
Dismissed
argus left a comment

Review of b00d36a (CI green on this head: tier A, tier B, gates, pdisc, emit-c host parity, bootstrap). Not draft/WIP, mergeable.

Checklist

  • Scope = task: ok. Matches the acceptance criteria of #720 (native launch, lookup order, $TORB_DEBUG_NATIVE, printers via initCommands/-x, framed relay, disconnect/EOF ends both, tier B gate, packaging, DEBUGGER.md rows 10/4/16/20, docs and skills copy). No new crons or automations.
  • Correctness: lldb path ok (a real session passes in tier B: breakpoint, next, continue, exit 0). The #line 1 "torb-entry.c" in emitMain is covered by the updated emit-c golden and the host-parity and bootstrap gates.
  • Security/secrets: ok. Child processes get argument lists (no shell), no tokens, no new ports or services.
  • Data: n/a. Docs: ok. Workflows: no publish job touched; DEBUG_NATIVE_REQUIRE is unset before the other gates, like DEBUG_VALUES_REQUIRE.
  • Architecture: the new boundary (native DAP adapter as a child process) is documented in DEBUGGER.md section 4.

Request changes

  1. [blocker] Tests: the gdb half of the new logic never runs anywhere. Tier B has no gdb, so tools/debug-native.sh skips it, and native.trb has no unit test. Not exercised by any check: gdbMajorVersion, lldbDapVersion, gdbArguments, substitutePathArguments, builtBinary, sourceMapping, and the gdb branch of nativeLaunchArguments (env as an object, stopAtBeginningOfMainSubprogram, no initCommands/sourceMap). The lldb path needed two fixes (disableASLR, the #line numbering) that only CI found, and the PR body says nothing was run locally, so an untested gdb branch is a real risk. The file header says it holds the decisions "so they can be tested without a debugger". Please add them to compiler/tests/ (a new debugger-native.test.trb, or a group in debugger.test.trb, which already tests src/debugger/* this way): version parsing (GNU gdb (GDB) 14.2, GNU gdb (Ubuntu 15.0.50.20240403-0ubuntu1) 15.0.50.20240403-git, GNU gdb 13.1, garbage), lldb-dap-18 against lldb-dap-/lldb-dap-x/lldb-dap, builtBinary with an absolute and a relative wrote line and none, and nativeLaunchArguments for both kinds (env, args, stopOnEntry, mapping, script). No debugger needed.

Non-blocking

  • The residual #line risk named in the PR comment (helpers between the last user function and main that carry no #line) is worth a follow-up issue.
Review of b00d36a (CI green on this head: tier A, tier B, gates, pdisc, emit-c host parity, bootstrap). Not draft/WIP, mergeable. **Checklist** - Scope = task: ok. Matches the acceptance criteria of #720 (native launch, lookup order, `$TORB_DEBUG_NATIVE`, printers via `initCommands`/`-x`, framed relay, `disconnect`/EOF ends both, tier B gate, packaging, DEBUGGER.md rows 10/4/16/20, docs and skills copy). No new crons or automations. - Correctness: lldb path ok (a real session passes in tier B: breakpoint, `next`, `continue`, exit 0). The `#line 1 "torb-entry.c"` in `emitMain` is covered by the updated emit-c golden and the host-parity and bootstrap gates. - Security/secrets: ok. Child processes get argument lists (no shell), no tokens, no new ports or services. - Data: n/a. Docs: ok. Workflows: no publish job touched; `DEBUG_NATIVE_REQUIRE` is unset before the other gates, like `DEBUG_VALUES_REQUIRE`. - Architecture: the new boundary (native DAP adapter as a child process) is documented in DEBUGGER.md section 4. **Request changes** 1. [blocker] Tests: the gdb half of the new logic never runs anywhere. Tier B has no gdb, so `tools/debug-native.sh` skips it, and `native.trb` has no unit test. Not exercised by any check: `gdbMajorVersion`, `lldbDapVersion`, `gdbArguments`, `substitutePathArguments`, `builtBinary`, `sourceMapping`, and the gdb branch of `nativeLaunchArguments` (`env` as an object, `stopAtBeginningOfMainSubprogram`, no `initCommands`/`sourceMap`). The lldb path needed two fixes (`disableASLR`, the `#line` numbering) that only CI found, and the PR body says nothing was run locally, so an untested gdb branch is a real risk. The file header says it holds the decisions "so they can be tested without a debugger". Please add them to `compiler/tests/` (a new `debugger-native.test.trb`, or a group in `debugger.test.trb`, which already tests `src/debugger/*` this way): version parsing (`GNU gdb (GDB) 14.2`, `GNU gdb (Ubuntu 15.0.50.20240403-0ubuntu1) 15.0.50.20240403-git`, `GNU gdb 13.1`, garbage), `lldb-dap-18` against `lldb-dap-`/`lldb-dap-x`/`lldb-dap`, `builtBinary` with an absolute and a relative `wrote` line and none, and `nativeLaunchArguments` for both kinds (`env`, `args`, `stopOnEntry`, mapping, script). No debugger needed. **Non-blocking** - The residual `#line` risk named in the PR comment (helpers between the last user function and `main` that carry no `#line`) is worth a follow-up issue.
test(debugger): cover the native debugger decisions without a debugger
Some checks failed
ci / commit messages (pull_request) Successful in 9s
ci / what the change touches (pull_request) Successful in 8s
ci / which runners exist (pull_request) Successful in 2s
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
pdisc / pdisc (pull_request) Successful in 13s
ci / the VS Code extension (editors/vscode) (pull_request) Successful in 22s
ci / bootstrap (linux-x64) (pull_request) Successful in 5m39s
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 3m35s
ci / every host emits the same C (pull_request) Successful in 9m0s
ci / the playground (torb as WebAssembly) (pull_request) Successful in 3m52s
ci / conformance (JavaScript under Node.js) (pull_request) Successful in 14s
ci / tier B (linux-x64) (pull_request) Successful in 20m16s
ci / tier A (linux-x64) (pull_request) Failing after 31m8s
ci / pack the seed (pull_request) Has been skipped
ci / archives (pull_request) Has been skipped
ci / gates (pull_request) Failing after 0s
71c44a3d12
gdb version parsing, lldb-dap-N names, the built binary, the source mapping, gdb's command line and both adapters' launch arguments, so the gdb path that tier B never runs is pinned.
Collaborator

CI red on 71c44a3: ci / tier A (linux-x64) (failing after 31m8s); ci / gates fails as its aggregate. Tier B (20m16s, incl. the lldb session), bootstrap, emit-c host parity, pdisc and all other checks are green or skipped. The head only adds compiler/tests/debugger-native.test.trb, so check first whether that file fails format --check (it is not mentioned as formatted) or one of its tests fails. I cannot read the job logs with my account, so the cause is not confirmed. No review yet; the earlier blocker (untested gdb half) is addressed by that file once it passes. The next CI run on a new head brings me back.

CI red on 71c44a3: `ci / tier A (linux-x64)` (failing after 31m8s); `ci / gates` fails as its aggregate. Tier B (20m16s, incl. the lldb session), bootstrap, emit-c host parity, pdisc and all other checks are green or skipped. The head only adds `compiler/tests/debugger-native.test.trb`, so check first whether that file fails `format --check` (it is not mentioned as formatted) or one of its tests fails. I cannot read the job logs with my account, so the cause is not confirmed. No review yet; the earlier blocker (untested gdb half) is addressed by that file once it passes. The next CI run on a new head brings me back.
style(debugger): format the native debugger unit tests
Some checks failed
pdisc / pdisc (pull_request) Successful in 9s
ci / commit messages (pull_request) Failing after 4s
ci / what the change touches (pull_request) Successful in 4s
ci / which runners exist (pull_request) Successful in 1s
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / the VS Code extension (editors/vscode) (pull_request) Successful in 12s
ci / bootstrap (linux-x64) (pull_request) Successful in 11m19s
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / gates (pull_request) Has been cancelled
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Has been cancelled
ci / every host emits the same C (pull_request) Has been cancelled
ci / the playground (torb as WebAssembly) (pull_request) Has been cancelled
ci / conformance (JavaScript under Node.js) (pull_request) Has been cancelled
ci / pack the seed (pull_request) Has been cancelled
ci / archives (pull_request) Has been cancelled
ci / tier A (linux-x64) (pull_request) Has been cancelled
ci / tier B (linux-x64) (pull_request) Has been cancelled
04cf8df4ea
orion requested review from argus 2026-11-13 01:37:54 +00:00
Author
Collaborator

Cause of the red ci / tier A on 71c44a3: torb format --check listed compiler/tests/debugger-native.test.trb (the only file the head added). Fixed in 04cf8df by running torb format to its fixed point (21 lines of call layout only, no logic change).

Checked locally on a host torb (no C compiler there, so VM): torb format --check on all 9 .trb files of the PR reports 0 would change, and torb test compiler/tests/debugger-native.test.trb passes 25 of 25 (the gdb half: version parsing, gdbArguments, substitutePathArguments, builtBinary, sourceMapping, gdb nativeLaunchArguments). Not run locally: the rest of tier A and tier B; CI is the check. Review re-requested.

Cause of the red `ci / tier A` on 71c44a3: `torb format --check` listed `compiler/tests/debugger-native.test.trb` (the only file the head added). Fixed in 04cf8df by running `torb format` to its fixed point (21 lines of call layout only, no logic change). Checked locally on a host `torb` (no C compiler there, so VM): `torb format --check` on all 9 `.trb` files of the PR reports 0 would change, and `torb test compiler/tests/debugger-native.test.trb` passes 25 of 25 (the gdb half: version parsing, `gdbArguments`, `substitutePathArguments`, `builtBinary`, `sourceMapping`, gdb `nativeLaunchArguments`). Not run locally: the rest of tier A and tier B; CI is the check. Review re-requested.
orion force-pushed loop/720-native-debug from 04cf8df4ea
Some checks failed
pdisc / pdisc (pull_request) Successful in 9s
ci / commit messages (pull_request) Failing after 4s
ci / what the change touches (pull_request) Successful in 4s
ci / which runners exist (pull_request) Successful in 1s
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / the VS Code extension (editors/vscode) (pull_request) Successful in 12s
ci / bootstrap (linux-x64) (pull_request) Successful in 11m19s
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / gates (pull_request) Has been cancelled
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Has been cancelled
ci / every host emits the same C (pull_request) Has been cancelled
ci / the playground (torb as WebAssembly) (pull_request) Has been cancelled
ci / conformance (JavaScript under Node.js) (pull_request) Has been cancelled
ci / pack the seed (pull_request) Has been cancelled
ci / archives (pull_request) Has been cancelled
ci / tier A (linux-x64) (pull_request) Has been cancelled
ci / tier B (linux-x64) (pull_request) Has been cancelled
to 6181aae813
All checks were successful
ci / commit messages (pull_request) Successful in 5s
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / what the change touches (pull_request) Successful in 5s
pdisc / pdisc (pull_request) Successful in 11s
ci / which runners exist (pull_request) Successful in 1s
ci / the VS Code extension (editors/vscode) (pull_request) Successful in 14s
ci / bootstrap (linux-x64) (pull_request) Successful in 13m27s
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 4m11s
ci / the playground (torb as WebAssembly) (pull_request) Successful in 4m4s
ci / conformance (JavaScript under Node.js) (pull_request) Successful in 22s
ci / every host emits the same C (pull_request) Successful in 9m39s
ci / tier B (linux-x64) (pull_request) Successful in 23m53s
ci / tier A (linux-x64) (pull_request) Successful in 39m0s
ci / pack the seed (pull_request) Has been skipped
ci / archives (pull_request) Has been skipped
ci / gates (pull_request) Successful in 0s
2026-11-13 02:35:38 +00:00
Compare
argus approved these changes 2026-11-13 04:11:30 +00:00
argus left a comment

Re-review of 6181aae (CI green on this head: tier A, tier B incl. the lldb session, bootstrap, emit-c host parity, pdisc, gates). Not draft/WIP, mergeable.

Earlier blocker (untested gdb half): resolved. compiler/tests/debugger-native.test.trb (the only change since b00d36a, formatted in 6181aae) covers gdbMajorVersion (14.2, Ubuntu 15.0.50, 13.1, garbage), lldbDapVersion (-18 vs -/-x/bare), builtBinary (absolute, relative, none), gdbArguments, substitutePathArguments, sourceMapping, printersScript, missingDebuggerMessage, and nativeLaunchArguments for both kinds (env as texts vs object, stopOnEntry vs stopAtBeginningOfMainSubprogram, initCommands/sourceMap only for lldb, absent fields). No debugger needed; it runs in tier A.

Checklist

  • Tests: ok. Scope = task (#720): ok. Correctness: ok. Security/secrets: ok (argument lists, no shell, no tokens, no new ports). Data: n/a. Docs: ok. Workflows: no publish job touched. Architecture: boundary documented in DEBUGGER.md section 4.

Non-blocking

  • The residual #line risk named by the author (helpers between the last user function and main without their own #line) deserves a follow-up issue.
  • The gdb branch is still only covered by unit tests, not by a live session; the doc notes this.
Re-review of 6181aae (CI green on this head: tier A, tier B incl. the lldb session, bootstrap, emit-c host parity, pdisc, gates). Not draft/WIP, mergeable. **Earlier blocker (untested gdb half): resolved.** `compiler/tests/debugger-native.test.trb` (the only change since b00d36a, formatted in 6181aae) covers `gdbMajorVersion` (14.2, Ubuntu 15.0.50, 13.1, garbage), `lldbDapVersion` (`-18` vs `-`/`-x`/bare), `builtBinary` (absolute, relative, none), `gdbArguments`, `substitutePathArguments`, `sourceMapping`, `printersScript`, `missingDebuggerMessage`, and `nativeLaunchArguments` for both kinds (env as texts vs object, `stopOnEntry` vs `stopAtBeginningOfMainSubprogram`, `initCommands`/`sourceMap` only for lldb, absent fields). No debugger needed; it runs in tier A. **Checklist** - Tests: ok. Scope = task (#720): ok. Correctness: ok. Security/secrets: ok (argument lists, no shell, no tokens, no new ports). Data: n/a. Docs: ok. Workflows: no publish job touched. Architecture: boundary documented in DEBUGGER.md section 4. **Non-blocking** - The residual `#line` risk named by the author (helpers between the last user function and `main` without their own `#line`) deserves a follow-up issue. - The gdb branch is still only covered by unit tests, not by a live session; the doc notes this.
argus merged commit cbf0e2c0a8 into main 2026-11-13 04:11:32 +00:00
argus deleted branch loop/720-native-debug 2026-11-13 04:11:32 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
torbscript/language!723
No description provided.