Skip to content

Keep managed-only debug sessions alive after an unhandled native breakpoint - #137973

Open
tommcdon wants to merge 1 commit into
dotnet:mainfrom
tommcdon:dev/tommcdon/skip_unowned_int3
Open

tommcdon wants to merge 1 commit into
dotnet:mainfrom
tommcdon:dev/tommcdon/skip_unowned_int3

Conversation

@tommcdon

Copy link
Copy Markdown
Member

When an app is debugged with a managed-only debugger, a breakpoint instruction executed by native code in the app (for example, a profiler or native library that calls DebugBreak when it detects an attached debugger) can go unhandled and terminate the app with exit code 0x80000003. With this change, execution continues past such breakpoints so the debug session stays alive. Mixed-mode (native + managed) debugging is unchanged.

Setting DOTNET_DbgSkipUnhandledNativeBreakpoint=0 in the debugger's environment restores the previous behavior.

This is a speculative fix for the issue described in #137466. The root cause of the customer reports has not been confirmed yet.

Validation (Windows x64, Debug):

  • build.cmd clr -c Debug -a x64 succeeds.
  • A repro app whose native code executes DebugBreak/__debugbreak while a managed-only debugger is attached terminates with 0x80000003 without this change, and continues and exits normally with it.
  • Existing debugger test suites showed no new failures.

No tests are included in this PR; coverage is being added to the internal debugger test suite.

…kpoint

When an app is debugged with a managed-only debugger, a breakpoint
instruction executed by native code in the app (for example a profiler or
native library calling DebugBreak when a debugger is attached) can go
unhandled and terminate the app with 0x80000003. Continue past such
breakpoints instead. Setting DOTNET_DbgSkipUnhandledNativeBreakpoint=0 in
the debugger's environment restores the previous behavior.

Also keep runtime startup intact when a breakpoint during startup is
continued.

This is a speculative fix for dotnet#137466.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 6bc78aaf-5d8c-4be8-ba2f-5a50fa39b7cd
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
12 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag
See info in area-owners.md if you want to be subscribed.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant