Repository navigation
WIP: 1.5.0 row 7 — stepping predicates + breakpoint resolution (WP-4/WP-8) - #1886
Merged
Merged
Conversation
…5.0 row 7, WP-8 part 1) First internal consumer shaped for api::syntax (API design Q4: owned Tier-B view types, the internal Ast is not frozen): a per-file SyntaxView carrying the command-line set, the seam-stoppable subset (debugger design 4.1 seam distribution), and function definition sites, built by walking the parsed Ast of one reader unit and merged across units of the same file. The walk also settles the dead-line judgment itself (design 5.1): a line classifies Stoppable / CommandOnly (a command node starts there but the seam never fires at it: detached contexts per 6.3, compound heads whose condition lives on a later line) / NoCommand (blank, comment, continuation, heredoc body, grouping openers and closing keywords on their own line). Grouping heads record no line of their own: the parser attributes a subshell node's line to its closing line, and no command starts on either grouping line. File identity is the exact string the engine puts on the BASH_SOURCE stack; no canonicalization. Unit tests pin the classification per shape.
… (1.5.0 row 7) WP-4 (design 6.1): the arming predicates move into debugger::stepping as the arming's one owner — arming_stops_at_seam (StepInto / StepOver by the engine's own function depth / Finish's shallower-frame backstop) and arming_stops_at_frame_return (Finish serviced at the DE-04 return site). The consult and the return-site note now call the predicates instead of carrying inline matches. Depth is read from shell_state.function_depth throughout; no shadow stack. return [status]: StopLoopOutcome::ForceReturn — the consult applies it by resuming under a finish-style arming and raising the engine's own ExecuteError::Return with the forced status (the current $? when none is named), so the return site reports the frame (DE-04) and the session stops in the caller at the return point. A sourced-file frame arms StepOver instead (its return has no function return site). At the main frame the outcome is rejected and the debuggee resumes under Continue. The funnel's no-action path now drops the trap re-entrancy flag before propagating a consult error, so a forced return leaves later seams live. WP-8 (design 5.1/5.2): DebugSession adjudicates breakpoints against the registered syntax views plus runtime definition notes. set_line_breakpoint / set_function_breakpoint adjudicate synchronously at insertion (verified / unverified with the design's two reason strings / pending); later changes emit DE-11 exactly on change. Pending function breakpoints resolve when a registered view or a function-entry-seam note proves the definition. Resolution is reporting, not gating: hit accounting is unchanged. Registration: Executor::debugger_register_syntax builds the api::syntax view; the source builtin's group runner registers each complete unit under the pushed BASH_SOURCE identity (its incomplete-group arm and the grouped script reader hand the identity through the new debug_syntax_unit_file field, taken at run_source_impl entry so synthetic units — eval, -c — never register).
… knowledge reaches (1.5.0 row 7)
Files parse incrementally, so a partial view cannot convict a
line it has not reached: a line beyond every parsed unit is
pending, not 'no command on this line'. SyntaxView now records
each unit's command-line span and a completeness flag set when
the file's reader finishes (DebugSession::note_syntax_file_complete,
called on the normal-completion path of both group drivers).
The line verdict: Unverified{no command} only inside a covered
span or in a completed file; CommandOnly and Stoppable verdicts
are sound from the unit that produced them. Re-adjudication
factored into one helper used by both registration and the
completion note.
…rn, pending resolution (1.5.0 row 7) Four session-level fixtures in debugger::stepping_tests, on the wiring harness's shape (quoted source path, per the row 6 CI lesson): - scenario4_step_next_finish_across_function_calls: design section 8 scenario 4 verbatim — line breakpoint on the call line, step-into to the entry seam and the body, step-over across a nested call (its body seam never stops), finish to the caller at the FunctionReturn seam, continue out. DE-04 reports both frames. - force_return_unwinds_the_frame_and_stops_in_the_caller: ForceReturn(7) inside a nested function skips the rest of its body, the frame reports Completed with status 7, the session stops in the caller at the return point, and the caller's $? is 7. - pending_function_breakpoint_resolves_at_definition_and_fires: Pending at insertion (only the first reader unit parsed), DE-11 Verified when the definition's unit registers, fired at the first call's entry seam. - line_breakpoint_on_a_definition_line_fires_at_the_entry_seam: pins the substrate's real shape — no seam fires while a definition executes (seam admission skips definition commands, as in GNU's dispatch), so the definition line binds through the entry seam, whose line stamp is the definition line. The syntax walk's comment now states this mechanism instead of the seam-before-definition claim it replaces.
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.
1.5.0 plan row 7: stepping arming predicates (WP-4) + breakpoint resolution (WP-8), on master
03a75183. Design basis:docs/design/debugger-full-design.md§5.1/§5.2/§6.1/§6.2 + API design Q4 (Tier-Bapi::syntax).Delivered
debugger::steppingowns the arming rules as pure predicates over the engine's ownfunction_depth(no shadow stack):arming_stops_at_seam(StepInto / StepOver / Finish's shallower-frame backstop) andarming_stops_at_frame_return(Finish serviced at the DE-04 return site). The consult and the return-site note call them; the inline matches are gone.return [status]:StopLoopOutcome::ForceReturn— the consult resumes under a finish-style arming and raises the engine's ownExecuteError::Returnwith the forced status (current$?if unnamed), so the frame reports DE-04 (route Completed) and the session stops in the caller at the return point; sourced-file frames arm StepOver (no function return site); the main frame rejects to Continue. The funnel's no-action path now drops the trap re-entrancy flag before propagating a consult error, so a forced return leaves later seams live.set_function_breakpointadjudicates synchronously (Verified when a view or runtime note already proves the name, else Pending); resolution lands when the definition's reader unit registers its syntax view, or at the function's entry seam (the runtime note foreval-defined names), emitting DE-11 exactly on change.api::syntaxfirst consumer — a minimal Tier-BSyntaxView(command-line set, seam-stoppable subset per §4.1, function sites, coverage spans + completeness), built by an AST walk at the two file-backed group sites (source builtin's group runner; the grouped script reader via thedebug_syntax_unit_filehand-off taken atrun_source_implentry — eval/-cunits never register). File identity is the engine's own BASH_SOURCE string, uncanonicalized.verified: falsewith the design's two reasons. The judgment (AST lines ∩ seam-stoppable lines) is unit-tested per shape, and coverage-aware: a line beyond every parsed unit stays Pending until its unit registers or the file's read completes — "no command on this line" is only pronounced where the view's knowledge reaches.Two substrate facts pinned by fixture (not changed): definition commands fire no seam (admission skips them, as in GNU's dispatch), so a definition line binds through the entry seam; and the entry seam's reported line is the definition line (the engine's entry line stamp).
Gates (local, this tree)
cargo test --libon03a75183= 789 passed / 1 failed / 1 ignored, sole failurebuiltins::test::tests::ownership_unary_operators_check_existing_file. Final tree: 821 passed / 1 failed / 1 ignored — failure set identical to baseline, 32 new tests all green (§8 scenario 4 fixture, force-return fixture, pending-resolution fixture, definition-line fixture; stepping predicates 7; resolution 10; syntax walk 11).RUSTFLAGS=-D warnings cargo check --lib: clean. UTF-8 boundary hygiene: clean. rustfmt per changed file; CR=0.ps06passes 3/3 in isolation (documented timing flake) → effective failure set ∅ ⊆ {ms10}.CI (run 40568919303, head fc19667): Rust tests / Rust tests (macOS) / niubash builds against this tree / cross-target (darwin, linux/android) / shell functionality / API ledger — all green, so the new tests pass on Windows and macOS too. Goldens job: its Windows lib step passed in full; its regression step fails on exactly one test,
upstream_suite_slice_snapshots(122 passed / 1 failed). That failure is pre-existing on master itself — the current master push run (40568288801, b163938) fails the same step with the same single test and the same counts; on 03a7518 the step was masked by the then-failing lib step (the 8 wiring debts, since fixed on master by #1885). Not introduced by this change: every engine-side edit here is gated on an attached session, which the regression suite never installs.Do not merge — row 7 lands by the captain's integration, like rows 3/5/6.