Skip to content

A command that fails keeps what the engine printed - #198

Merged
glslang merged 1 commit into
mainfrom
failed-command-keeps-its-output
Oct 14, 2026
Merged

glslang merged 1 commit into
mainfrom
failed-command-keeps-its-output

Conversation

@glslang

@glslang glslang commented Oct 14, 2026

Copy link
Copy Markdown
Owner

For windbg-mcp FOLLOWUPS.md item 126: when Execute fails, this crate returns the HRESULT alone and drops the output it captured for the call.

What changed

  • DbgEngError::CommandFailedWithOutput { source, output }, read through DbgEngError::output(). The five calls that capture output now answer with it where they answered CommandFailed. That happens when Execute refuses the text or the wait after it fails. The five are execute_command, execute_command_bounded, execute_and_wait, settle and run_to_address.
  • The message is CommandFailed's word for word. A caller that renders errors as text sees no change until it asks for output().
  • CommandFailed stays. It still covers the failures that had no capture: setting the callbacks, a status read, and the pump inside an open. So branches already open against the old variant keep compiling.
  • examples/failed_command_output.rs is the measurement record.

Measured before it was written

The item's open question was whether the engine's reason reaches this call's capture at all. cdb printing the line shows the engine emits it, not that it lands in a DEBUG_OUTCTL_THIS_CLIENT capture. It does land there.

The readings were taken against a user-mode dump on ARM64, with dbgeng 10.0.29617.1000 and 10.0.26100.1742. Both builds answered byte for byte alike, and every failure below is 0x80040205:

command captured
zzzz Couldn't resolve error at 'zzz'
? ntdll!Nope, u ntdll!Nope, dd ntdll!Nope Couldn't resolve error at 'ntdll!Nope'
.echo before the failure; zzzz before the failure, then the line above
g (through execute_and_wait) ^ No runnable debuggees error in 'g'
||1s, after .opendump of a second dump ^ Illegal debuggee error in '||1s'

Some failures never take this road. These print their complaint and return success:

  • dt ntdll!_NOPE prints Symbol ntdll!_NOPE not found.
  • !nosuchextension prints No export nosuchextension found.
  • dd 0 L4 prints ????????.
  • x ntdll!Nope and lm m nope print no match.

The variant is for the failures that do return an error.

Tests

  • test_a_refused_command_keeps_what_the_engine_printed drives .echo before the failure; ? nowhere!Nope through execute_command, execute_command_bounded and execute_and_wait against a launched process. For each path it asserts two things are in the capture: the earlier segment's output, and the engine's Couldn't resolve line.
    • It passes on the VM's inbox dbgeng 10.0.26100.1.
    • It fails at each of the three paths with that path's change backed out, one at a time.
  • The wait-failure half has no test. That covers settle, and the pump in execute_and_wait and run_to_address. It needs a wait that fails with the target still present and no break raised, which is not something a test can arrange.
  • Full suite on the ARM64 VM: 455 passed, 13 ignored, 4 doctests passed.

🤖 Generated with Claude Code

https://claude.ai/code/session_01H7Gnmok17PyEYbcc3aHUm5

`DbgEngError::CommandFailedWithOutput`, read through `DbgEngError::output()`. The five calls
that capture output -- `execute_command`, `execute_command_bounded`, `execute_and_wait`,
`settle` and `run_to_address` -- answer with it where they answered `CommandFailed`, when
`Execute` refuses the text or the wait after it fails. The message is unchanged.

The capture used to be dropped on that path, and the code alone says little: `0x80040205` is
the answer to a mistyped command, to an argument naming nothing, to `g` on a dump and to `||1s`
on a system not yet loaded. Measured (`examples/failed_command_output.rs`) on dbgeng
10.0.29617.1000 and 10.0.26100.1742, ARM64, alike: the engine's own line saying which is printed
into this call's capture -- `Couldn't resolve error at 'ntdll!Nope'`, `^ No runnable debuggees
error in 'g'`, `^ Illegal debuggee error in '||1s'` -- beside whatever earlier segments of the
command printed. Some failures never take this road: `dt` of a missing type and an extension
command that does not exist print their complaint and return success.

`test_a_refused_command_keeps_what_the_engine_printed` drives the three paths a caller's text
takes against a launched process; it passes on the inbox 10.0.26100.1 and fails at each path
with that path's change backed out. The wait-failure half (`settle`, and the pump in
`execute_and_wait` and `run_to_address`) has no test: a wait that fails with the target still
present and no break raised is not something a test can arrange.

Asked for by windbg-mcp `FOLLOWUPS.md` item 126.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01H7Gnmok17PyEYbcc3aHUm5
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 14, 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-10-14T11:41:16.664793Z 05bc3df 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.

@coderabbitai

coderabbitai Bot commented Oct 14, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

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

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 8c1449b8-b055-44ec-adf6-035ae25d7c9e
  • 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

Comment @coderabbitai help to get the list of available commands.

@glslang
glslang merged commit 2795b96 into main Oct 14, 2026
8 checks passed
@glslang
glslang deleted the failed-command-keeps-its-output branch October 14, 2026 14:10
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