proc/native: surface FlushInstructionCache failures on Windows - #4413
Draft
derekparker wants to merge 2 commits into
Draft
proc/native: surface FlushInstructionCache failures on Windows#4413derekparker wants to merge 2 commits into
derekparker wants to merge 2 commits into
Conversation
Previously flush errors were ignored, which made I-cache coherency problems on windows/arm64 hard to diagnose. Return and log the error so a failed flush fails the write instead of looking like a missed breakpoint.
aarzilli
reviewed
Aug 6, 2026
| // breakpoints or execute the wrong instruction after a patch. | ||
| if err := _FlushInstructionCache(t.dbp.os.hProcess, uintptr(addr), count); err != nil { | ||
| err = fmt.Errorf("FlushInstructionCache(%#x, %d): %w", addr, count, err) | ||
| logflags.DebuggerLogger().Errorf("%v", err) |
Member
There was a problem hiding this comment.
Why both logging and returning?
Member
Author
There was a problem hiding this comment.
I know it's redundant, but I wanted to throw everything at it and see if anything is discoverable by CI (maybe the error gets swallowed or something). Kind of grasping at straws here honestly trying to figure out these seemingly never-ending windows/arm64 flakes.
When we pass an exception through to the debuggee (or see a
breakpoint trap whose memory is not our BRK), dump ExceptionCode,
address, and ExceptionInformation so CI can distinguish access
violations from illegal instructions behind throw("fault").
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.
Summary
Stop swallowing FlushInstructionCache errors after WriteProcessMemory. If the flush fails, return the error so it shows up instead of looking like a missed breakpoint.
Part of digging into flaky TestNextWhileNexting / TestStepShadowConcurrentBreakpoint on windows/arm64 with Go 1.27.