Skip to content

feat: a run cut short on a TTD replay is put back where it started - #202

Merged
glslang merged 1 commit into
mainfrom
feat/ttd-position
Nov 6, 2026
Merged

glslang merged 1 commit into
mainfrom
feat/ttd-position

Conversation

@glslang

@glslang glslang commented Nov 6, 2026

Copy link
Copy Markdown
Owner

What changes

TTD does not leave an interrupted replay where it had got to. It prints "the current position is approximately how far we had gone" and then moves it somewhere of its own choosing. Measured, that is usually the trace's end, past every breakpoint the run had not reached, with no hit reported. Now and then it is a breakpoint itself, again with no hit. A caller reading that stop as progress concludes the breakpoint is never hit (windbg-mcp item 125).

  • execute_and_wait, settle and run_to_address put a cut-short replay back. Each reads the position before the run, through the debugger data model (@$curthread.TTD.Position). When a deadline or a host's break cuts the run short, it calls that position object's own SeekTo, then reads the position and current thread again to confirm.
  • CommandRun::replay / RunToResult::replay carry the outcome as a ReplayLanding: Rewound { to }, or NotRewound { from, left_at } when the travel back failed. They are None on every other target.
  • DebugEngine::ttd_position is public and typed (TtdPosition { sequence, steps }, ordered as the trace is, Display as !tt reads it).
  • DebuggeeType::is_ttd_replay is the gate. A .run opened by open_trace reports class 2, qualifier 2 (DEBUG_USER_WINDOWS_IDNA), not a dump qualifier. So a live target pays one GetDebuggeeType per resume and never touches the data model.
  • windows gains Win32_System_Com, Win32_System_Ole and Win32_System_Variant, which IModelObject::GetIntrinsicValue is gated on.

Breaking: CommandRun and RunToResult gain a public field. Struct literals add replay: None (noted in the CHANGELOG's migration section).

Measured

examples/ttd_position_probe.rs, x64 host, dbgeng 10.0.29547.1002, TTD 1.11.617.0, against two unindexed traces (hostname.exe 28 MiB, cmd.exe /c for /L … 48 MiB), with a breakpoint on ntdll!RtlExitUserProcess.

Run Before After
1 ms bound left at the trace's end, six of six put back where it started
5 ms and 20 ms bounds sometimes left at the breakpoint itself put back where it started
g- — put back
settle — put back
run_to_address — put back

After every put-back, the next g stopped at the breakpoint. The seek takes about 1.5 ms and leaves the engine at DEBUG_STATUS_BREAK with nothing to pump. An ordinary user dump answers ttd_position() == None.

Tests

  • cargo test --lib: 469 passed, 13 ignored.
  • New tests:
    • test_a_replay_is_the_idna_qualifier_on_a_user_target
    • test_a_ttd_position_orders_by_sequence_then_steps_and_prints_as_tt_reads_it
    • test_a_live_target_is_no_replay_and_is_not_put_back, which runs all three bounded paths on a launched process.
  • Mutation check: making is_ttd_replay answer true for any user target fails both of the gate tests.
  • CI records no trace, so no test here covers the replay half. The probe covers it here, and windbg-mcp's TTD tier asserts it end to end: a mutant that reports Rewound without seeking fails that tier with the stop left at the end-of-trace IP.
  • cargo clippy --all-targets -D warnings reports ten findings, all in code this PR does not touch (newer toolchain lints). CI does not run clippy here.

The new code is FFI (VariantClear, an AddRef'd punkVal clone), so Miri, which does not run on PRs, has nothing new it can reach.

🤖 Generated with Claude Code

https://claude.ai/code/session_01H84hv8GzUbK25UnnEC6eSb

TTD does not leave an interrupted replay where it had got to. It prints
"the current position is approximately how far we had gone" and then,
measured, usually moves it to the trace's end - past every breakpoint the
run had not reached, with no hit reported - and now and then to a
breakpoint itself, again with no hit (windbg-mcp item 125). A caller
reading that stop as progress concludes the breakpoint is never hit.

execute_and_wait, settle and run_to_address now read the position before
the run, through the debugger data model, and when a deadline or a host's
break cuts the run short they SeekTo back to it and read the position and
current thread again to confirm. CommandRun::replay and
RunToResult::replay carry the outcome as a ReplayLanding.

ttd_position is public and typed (TtdPosition), and
DebuggeeType::is_ttd_replay gates it: a .run opened by open_trace reports
qualifier DEBUG_USER_WINDOWS_IDNA, not a dump qualifier, so a live target
pays one GetDebuggeeType per resume and never touches the data model.

examples/ttd_position_probe.rs holds the measurements (x64, two traces,
every bounded run put back and every following g reaching the breakpoint).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01H84hv8GzUbK25UnnEC6eSb
@coderabbitai

coderabbitai Bot commented Nov 6, 2026

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 55086742-2d59-4c3c-a25a-816314d6257a
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-06T07:42:12.289529Z 5bbddbe PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@glslang
glslang merged commit 92a1fe6 into main Nov 6, 2026
8 checks passed
@glslang
glslang deleted the feat/ttd-position branch November 6, 2026 08:17
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