feat(tui,trace): trace-replay search, jump-to-cycle, side-by-side diff#411
Merged
Conversation
Navigation for `-trace-replay` (issue #391): - `:find EXPR` / `:rfind EXPR` jump to the next/previous frame matching an expression over the frame's registers/flags (reuses the breakpoint `expr` grammar against a scratch CPU). Bare `=` is normalised to `==` so `:find PC=$8042` works as typed; bare `:find` repeats the last expression to sweep matches. - `:cycle N` binary-searches the monotonic cycle column to the first frame at/after N (O(log N) via Replay.SeekCycle). - `-diff PATH` loads a second trace; trace.Diff reports the first frame where the two runs disagree (Frame.Equal mismatch, or a length-mismatch divergence). The cycle is marked in the status line. - `d` toggles a side-by-side diff overlay centred on the cursor with mismatched frames highlighted and a marker at the divergence; `D` jumps both cursors there. Pure-trace logic (SeekCycle / FindFunc / Diff / Frame.Equal) is unit tested separately from the TUI wiring. No state-format change. Closes #391
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.




Trace-replay navigation polish for accuracy work (v1.3.0, Theme A). Builds on
-trace-replay(#64).What
:find EXPR/:rfind EXPR:find PC=$8042,:find A=$10 && X=0):find/:rfind(bare):cycle N-diff PATHd/DHow
framePredicatecompiles the expression with the existing breakpointexprpackage and evaluates it against a scratchcpu.CPUloaded from each frame.normalizeFindExprrewrites a bare=to==so the issue-spec form (PC=$ADDR) works;==/!=/<=/>=pass through. Memory derefs read live RAM (stale in replay) — register/flag predicates are the supported path, documented.Replay.SeekCyclebinary-searches the monotonic cycle column — O(log N) on a 1M-frame trace (acceptance criterion).trace.Diffwalks both replays by index, returns the firstFrame.Equalmismatch (or a length-mismatch divergence at the shorter trace) astrace.Divergence{Index, Cycle, Found}. Computed eagerly inWithReplayDiff, surfaced in the status line on open.Frame.Equalcompares PC + registers + cycles, ignoring the PC-derived mnemonic/opbytes and interrupt tag.diffModal— double-bordered overlay (same idiom as the help modal) centred on the primary cursor, left column-trace-replay, right-diff, mismatched frames red,✗gutter at the divergence,▶at the cursor.Tests
trace:SeekCycle(boundaries, duplicate cycles, past-end),FindFunc(fwd/back, cursor untouched),Diff(first divergence, length mismatch),Frame.Equal.tui::cycle(landing frame, between-cycles, past-end, bad input),:find/:rfind(forward, backward, repeat, PC expr, errors, not-in-replay),normalizeFindExprtable,WithReplayDiffdivergence + identical,diffModalrender.Docs
README flag table (
-diff) + new Trace-replay command table; help modal Trace-replay page;docs/context.mdmerged-PR entry.Closes #391