Skip to content

WIP: feat(debugger): host-supplied startup file for --debug sessions (niubash#692 engine half) - #2095

Merged
caomengxuan666 merged 1 commit into
masterfrom
fix/692-debug-startup-file
Oct 29, 2026
Merged

caomengxuan666 merged 1 commit into
masterfrom
fix/692-debug-startup-file

Conversation

@caomengxuan666

@caomengxuan666 caomengxuan666 commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

WIP: engine half of niubash#692 — the --debug CLI frontend gains a host-supplied startup-file channel.

Refs unixwin/niubash#692 (companion: the niubash host PR that maps --rcfile onto this channel and carries the Fixes lines; this PR must land first, since niubash CI pairs rubash master tip).

What

DebugCliPreset gains startup_file: Option<String>. 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;
  • 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.

Before this, the niubash host's --debug + script route dropped --rcfile silently — the rc never loaded, which is the face the niubash#681 repro was written against. This binary's own --debug scan keeps passing None (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 7 in 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

  • Local (Linux, paired tree): cargo test --lib debugger:: 162 passed / 0 failed (incl. the 4 new pins; cli_tests subset 25/25); cargo test --test issue681_debug_trap_coexist 4/4 (its preset literal is the fourth construction site updated for the new field); cargo check --all-targets with RUSTFLAGS=-D warnings clean (verified with pipefail + full log after an initial truncated-read miss — see the cluster REPORT's correction note); per-file rustfmt applied, CR=0.
  • CI: this PR's own rubash CI is the merge gate (adjudicated by the main session; cluster does not self-merge).

…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
caomengxuan666 force-pushed the fix/692-debug-startup-file branch from 9c86df6 to 7c4cc78 Compare October 29, 2026 09:48
@caomengxuan666
caomengxuan666 marked this pull request as ready for review October 29, 2026 09:57
@caomengxuan666
caomengxuan666 merged commit b41150e into master Oct 29, 2026
8 of 9 checks passed
@caomengxuan666
caomengxuan666 deleted the fix/692-debug-startup-file branch October 30, 2026 01:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant