Skip to content

WIP: fix(debugger): breakpoint conditions report once, cannot kill the debuggee, consult-line diagnostics (#1962) - #1979

Merged
caomengxuan666 merged 2 commits into
masterfrom
fix/1962-debugger-conditions
Oct 28, 2026
Merged

caomengxuan666 merged 2 commits into
masterfrom
fix/1962-debugger-conditions

Conversation

@caomengxuan666

Copy link
Copy Markdown
Member

RC audit phase-2 (B-face cell group ②) fix for the three confirmed debugger breakpoint-condition defects. Design basis: docs/design/debugger-full-design.md §5.3 (failed condition = false + reported once per breakpoint), §9.5/§10 (source command files); GNU evalstring.c caller-line numbering for the re-parse.

What changed:

  • Report outlet (was missing entirely): note_condition_error only wrote a HashSet whose first-failure bool its sole caller discarded — no frontend ever read the record. New StopLoop::announce + SessionDriver::announce_condition_error: CLI renders at the consult, DAP rides the console output channel.
  • The debuggee can no longer be killed by a condition: evaluate_debug_condition now snapshots/restores the whole evalerror family + nounset latch + break-failure status; a fatal arm the condition raises against its own list (break 1 2's too-many-arguments DISCARD) reclassifies the evaluation as failed instead of leaking into the debuggee's abandon checks (previously: debuggee silently died after iter 1, session exit 0).
  • Diagnostics: evaluation stderr is captured (pipeline-stage mechanism) — replayed as-is on a verdict, quoted once inside the once-per-breakpoint report on failure (was: sprayed per consult). The condition text is re-parsed on the consult line, so diagnostics name the debuggee's file at the consult's line (was: line 1).
  • N4: the shipped CLI lacked design §10's source batch command — implemented (stack-ordered queue across stops), not a design-doc change.
  • 10 regression pins in cli_tests: 3 confirmed cells, 3 overturned cells as parity pins, source command.

Gates (local, Linux same-machine): -D warnings check clean; lib 914/1/3 vs pristine 904/1/3 (delta = exactly the 10 new pins, failure set identical); regression 171/4/1 with all 4 failures environmental (2 missing vendored .sub fixtures ENOENT, readdir-order flake, HOME-sensitive) matching the recorded pristine signature; diffcorpus 305/306 (sole failure bi08, adjudicated flake, 3/3 isolated passes); PTY six-cell re-verification byte-level in the fix report. Windows CI (goldens) is the merge gate.

Fixes #1962

…uggee, diagnostics carry the consult line (rubash#1962)

Design: docs/design/debugger-full-design.md 5.3 (a condition that
errors is treated as false and reported once per breakpoint), 9.5/10
(source command files as the batch driver). GNU convention:
evalstring.c parse_and_execute numbers a nested string from the
caller's line; the condition re-parse now does the same from the
consult line.

- driver: StopLoop::announce outlet plus
  SessionDriver::announce_condition_error. The note_condition_error
  record previously had no reader at all: its first-failure bool was
  discarded at the only call site, so failures were ledgered but
  never reported (audit cells 1 and 5).
- trap_exec evaluate_debug_condition: snapshot and restore the whole
  evalerror family, the nounset DISCARD latch, and the break-failure
  status around the evaluation. A fatal arm the condition raises
  against its own list (break 1 2 arming the too-many-arguments
  DISCARD) reclassifies the evaluation as failed instead of leaking
  into the debuggee's abandon checks, where it silently terminated
  the program while the session exited 0. The evaluation's stderr is
  captured (the pipeline-stage capture mechanism): replayed as-is
  on a true/false verdict, quoted once inside the report on a
  failure, so a failing condition's diagnostic no longer sprays
  per hit. The condition text is re-parsed on the consult line, so
  its diagnostics name the debuggee's file at the line whose
  consult raised them (was: the condition's own line 1).
- cli: announce renders at the consult; new `source <file>` batch
  command (design 10) with a stack-ordered command queue that
  survives across stops.
- dap: announce rides the console output channel (the watch
  banner's channel).
- cli_tests: 10 regression pins (the three confirmed cells, the
  three overturned cells as parity pins, the source command).
The pin embedded dir.join("ticks") verbatim into the break
condition. On Windows that string carries backslash separators,
and the condition is re-tokenized by the shell lexer
(evaluate_debug_condition), where a backslash in an unquoted word
is the escape character: the redirect target was dequoted to a
separator-stripped namesake, so the ticks landed in the wrong
file and the read-back panicked NotFound. The product side is
not at fault: a Linux reproduction with the Windows spelling
shows the debuggee completing all consults and exactly three
ticks in the mangled-name file, one per consult. Use the
shell-facing forward-slash spelling, the convention every other
shell-text path embedding in the test tree already follows
(e.g. tests/cli_tests.rs source operands). Assertion unchanged:
exactly three ticks, one per consult.
@caomengxuan666
caomengxuan666 marked this pull request as ready for review October 28, 2026 16:56
@caomengxuan666
caomengxuan666 merged commit 998132c into master Oct 28, 2026
8 of 9 checks passed
@caomengxuan666
caomengxuan666 deleted the fix/1962-debugger-conditions 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

1 participant