[clr-interp] Add User Breakpoint Support for Interpreter Debugging#121911
Merged
matouskozak merged 33 commits intodotnet:mainfrom Dec 11, 2025
Merged
[clr-interp] Add User Breakpoint Support for Interpreter Debugging#121911matouskozak merged 33 commits intodotnet:mainfrom
matouskozak merged 33 commits intodotnet:mainfrom
Conversation
kotlarmilos
reviewed
Nov 24, 2025
This reverts commit 4bbc946.
Co-authored-by: Milos Kotlar <kotlarmilos@gmail.com>
0d9c6bc to
5b087e1
Compare
9 tasks
janvorli
reviewed
Dec 2, 2025
3 tasks
Contributor
There was a problem hiding this comment.
Pull request overview
This PR implements support for user breakpoints (System.Diagnostics.Debugger.Break()) in interpreted code by introducing an execution control abstraction layer. The implementation uses bytecode patching to replace interpreter instructions with INTOP_BREAKPOINT opcodes.
Key Changes
- Introduced
IExecutionControlinterface andInterpreterExecutionControlimplementation for bytecode patching - Modified debugger controller to delegate patch operations to execution control for interpreter code
- Implemented
GetFunctionSizeforInterpreterCodeManagerto support debugger operations - Disabled
JITCompletenotification for interpreter code as a temporary workaround - Added frame filtering to prevent interpreter frames from being treated as managed frames during stack walks
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| src/coreclr/debug/ee/executioncontrol.h | Defines IExecutionControl interface and InterpreterExecutionControl class for bytecode patching abstraction |
| src/coreclr/debug/ee/executioncontrol.cpp | Implements bytecode patch application/removal by replacing opcodes with INTOP_BREAKPOINT |
| src/coreclr/debug/ee/controller.h | Adds include for execution control header |
| src/coreclr/debug/ee/controller.cpp | Modifies ApplyPatch/UnapplyPatch to delegate to execution control for interpreter code |
| src/coreclr/debug/ee/frameinfo.cpp | Filters out interpreter frames from debugger stack walks |
| src/coreclr/debug/ee/CMakeLists.txt | Adds new execution control source files to build |
| src/coreclr/vm/codeman.h | Adds virtual GetExecutionControl() method to IJitManager and overrides for InterpreterJitManager |
| src/coreclr/vm/codeman.cpp | Implements GetExecutionControl() and includes execution control header |
| src/coreclr/vm/jitinterface.cpp | Temporarily disables JITComplete notification for interpreter code |
| src/coreclr/vm/interpexec.cpp | Implements InterpBreakpoint handler that notifies debugger of breakpoint via exception mechanism |
| src/coreclr/vm/eetwain.cpp | Implements GetFunctionSize for interpreter code manager using GC info decoder |
BrzVlad
reviewed
Dec 3, 2025
kotlarmilos
reviewed
Dec 3, 2025
…kozak/runtime into prototype-interp-user-breakpoints
23ad599 to
4751352
Compare
thaystg
approved these changes
Dec 8, 2025
Member
Author
|
Merging, future work is tracked in #120842 |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
This PR implements support for setting and handling user breakpoints (
System.Diagnostics.Debugger.Break()) in interpreted code. Regular breakpoints, stepping, etc. are not covered by these changes.Key Changes
Execution Control Abstraction (
executioncontrol.h/cpp)IExecutionControlinterface to abstract breakpoint operations across different execution strategies. Currently just for interpreter but will be extended to other codegens.InterpreterExecutionControlclass for interpreter-specific bytecode patchingApplyPatch(): Replaces bytecode instruction withINTOP_BREAKPOINTopcodeUnapplyPatch(): Restores original bytecode instructionPatch Mechanism:
INTOP_BREAKPOINTinstructionBreakpoint Flow:
INTOP_BREAKPOINTopcodeFirstChanceNativeException()Notes
Testing
Future work