Repository navigation
WIP: feat(debugger): host-supplied startup file for --debug sessions (niubash#692 engine half) - #2095
Merged
Merged
Conversation
…m (niubash#692) DebugCliPreset gains `startup_file`: run_debug_cli_with_stream sources it as the run input's first unit, ahead of the program line, in the same session. The file's functions and traps are live for the debuggee, and an `exit` inside it ends the run with its status before the program starts — the startup-file discipline of every other route. With no startup file the run input is byte-identical to the previous form, and this binary's own --debug scan keeps passing None (its option model has no rcfile channel on this route). The niubash host maps its invocation's --rcfile onto this field (niubash#692); before, that route dropped the flag silently and the rc's definitions never reached the debuggee. Pins (cli_tests): startup definitions live at a program stop; a function-valued DEBUG trap installed by the startup file coexisting with a breakpoint (the niubash#681 shape); an exit in the startup file ending the run before the program; a missing startup file neither aborting nor silencing the session.
caomengxuan666
force-pushed
the
fix/692-debug-startup-file
branch
from
October 29, 2026 09:48
9c86df6 to
7c4cc78
Compare
caomengxuan666
marked this pull request as ready for review
October 29, 2026 09:57
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WIP: engine half of niubash#692 — the
--debugCLI frontend gains a host-supplied startup-file channel.Refs unixwin/niubash#692 (companion: the niubash host PR that maps
--rcfileonto this channel and carries theFixeslines; this PR must land first, since niubash CI pairs rubash master tip).What
DebugCliPresetgainsstartup_file: Option<String>.run_debug_cli_with_streamsources it as the run input's first unit, ahead of the program line, in the same session:exitinside it ends the run with its status before the program starts — the startup-file discipline of every other route;Before this, the niubash host's
--debug+ script route dropped--rcfilesilently — the rc never loaded, which is the face the niubash#681 repro was written against. This binary's own--debugscan keeps passingNone(its option model has no rcfile channel on this route; noted in the construction site).Pins (src/debugger/cli_tests.rs, all new)
startup_file_definitions_are_live_for_the_debuggee— rc-defined variable + function observed at a program breakpoint stop.startup_file_debug_trap_function_coexists_with_breakpoints— the niubash#681 shape loaded through this channel: a function-valued DEBUG trap from the rc, breakpoint still stops, trap observed live.startup_file_exit_ends_the_run_before_the_program—exit 7in the rc ends the run at 7; the program never starts.startup_file_missing_does_not_abort_the_session— a missing rc surfaces the source builtin's diagnostic on the debuggee's stderr and the program still runs (visible, never silent).Gates
cargo test --lib debugger::162 passed / 0 failed (incl. the 4 new pins; cli_tests subset 25/25);cargo test --test issue681_debug_trap_coexist4/4 (its preset literal is the fourth construction site updated for the new field);cargo check --all-targetswithRUSTFLAGS=-D warningsclean (verified with pipefail + full log after an initial truncated-read miss — see the cluster REPORT's correction note); per-file rustfmt applied, CR=0.