Skip to content

proc/native: surface FlushInstructionCache failures on Windows - #4413

Draft
derekparker wants to merge 2 commits into
go-delve:masterfrom
derekparker:fix/windows-arm64-go127-ci
Draft

proc/native: surface FlushInstructionCache failures on Windows#4413
derekparker wants to merge 2 commits into
go-delve:masterfrom
derekparker:fix/windows-arm64-go127-ci

Conversation

@derekparker

Copy link
Copy Markdown
Member

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.

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.
// 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)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why both logging and returning?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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").
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.

2 participants