Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to enable mixed mode debug for CoreCLR? #111183

Open
mingpepe opened this issue Jan 8, 2025 · 3 comments
Open

How to enable mixed mode debug for CoreCLR? #111183

mingpepe opened this issue Jan 8, 2025 · 3 comments
Labels
area-Diagnostics-coreclr untriaged New issue has not been triaged by the area owner

Comments

@mingpepe
Copy link

mingpepe commented Jan 8, 2025

I'm building code base on this guide and trying to set breakpoints in both native and managed code. When debugger type set to either native-only or managed-only, it works properly.

However, when set to mixed mode, only managed breakpoints work, and native breakpoints show the following message "Breakpoints in coreclr.dll are not allowed. This module contains the implementation for the underlying runtime that you are trying to debug".

Is this a limitation, or can I make some adjustment to enable this functionality?

@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Jan 8, 2025
Copy link
Contributor

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

@carlossanlop
Copy link
Member

I'm not the area expert, but not too long ago I was given this guidance and it worked for me, I was able to set native and managed breakpoints. @hoyosjs would you say this is still accurate?:

It's not recommended to build coreclr in debug because it's extremely noisy. But if you do, make sure to enable these environment variables:
COMPlus_ContinueOnAssert=1
COMPlus_SuppressChecks=1

Alternatively (recommended) build coreclr in release mode but without optimization:
build clr.corelib+clr.nativecorelib+libs.pretest -rc release /p:Optimize=false

For both cases, if you are using VS Code, remember to set this in your launch.json:
SuppressJitOptimizations=true

@hoyosjs
Copy link
Member

hoyosjs commented Jan 8, 2025

Yeah, that's a known limitation. You can't debug into the runtime. There's message passing that might result in a dead lock so mixed mode disables coreclr breakpoints. You can use windbg to sort of do this but it's not a very smooth experience compared to VS. As for mixed mode, that's meant for stepping into pinvokes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Diagnostics-coreclr untriaged New issue has not been triaged by the area owner
Projects
None yet
Development

No branches or pull requests

3 participants