feat(debugger): the program's standard input through runInTerminal #398
Loading…
Reference in a new issue
No description provided.
Delete branch "loop/40-debugger-stdin"
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 #40
A program that reads its standard input can now be debugged: with
console: "integratedTerminal"or"externalTerminal"in the launch, and a client that sendssupportsRunInTerminalRequest, the program runs in the editor's terminal.How it works (docs/design/DEBUGGER.md sections 3 and 20)
127.0.0.1(system-chosen port) and sends the reverse requestrunInTerminalwithtorb debug --debuggee --connect <port> --token <token>.DebugConnect,DebugWrite;DebugRead/DebugTake/DebugPendingserve the connection while there is one). The program keeps all three standard streams.torbscript/exitedthrough a new exit hook; the adapter turns it intoexited+terminated.console: internalConsolekeep the pipes.Commits
feat(runtime):runtime/debug.c(POSIX sockets, Winsock loaded dynamically as inruntime/os/iocp.c, no sockets on emscripten), two appended kernel operations (86, 87), exit hook,--connect/--tokenof the debuggee,tests/debug-channel/driver.trb(plays the adapter).feat(debugger): adapter route,tests/debug-channel/editor.trb(plays the editor and the terminal and feeds the program a line), launch schemaconsolein the VS Code extension, docs, regeneratedskills/.Seed: not touched and not needed (no syntax, native, build flag or std lookup change; the kernel operations are rows of the C table and constants of the emitter, appended at the end).
Known limits (documented): a
pauseis answered only once the program's blocked terminal read returns; the playground has no sockets.Verification: only
torb format --checkandtorb checkof the touched files were run locally (no C compiler/bootstrap on this machine); the C and the two newtools/debug.shscenarios are exercised by CI. The.expectedfiles oftests/debug-channel/were written by hand from the protocol and may need a--updateround if CI shows a difference in wording only. Not yet smoke-tested in VS Code by hand.3b7c5f899fd5bc267c01Checklist (head
d5bc267):tests/debug-channel/driver.trbandeditor.trb(+.expected) are driven bytools/debug.sh, whichtools/gates.shruns as a gate; CI is green on this head (bootstrap, tier A/B, agree, playground, extension, pdisc, commits).starting/queued/channel) is consistent: requests queued during startup are flushed in order before the switch, failure paths (client failure response, 60 s accept timeout, bad token) answer the launch and the queued requests, and the exit hook coverstorb_process_exitand the panic path.runInTerminal); no automation added.Entropytoken checked before the connection is taken, 10 s hello timeout,FD_CLOEXEC/MSG_NOSIGNALon the debuggee side, port parsed with a bound check.consoleschema and--helptext are updated.Non-blocking:
runtime/debug.cis only compiled by jobs that were skipped on this PR; the first nightly/release run is its first compile. Worth watching.