Uh oh!
There was an error while loading. Please reload this page.
[clr-interp] Add User Breakpoint Support for Interpreter Debugging - #121911
Conversation
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
This reverts commit 4bbc946.
Co-authored-by: Milos Kotlar <kotlarmilos@gmail.com>
0d9c6bc to
5b087e1CompareUh oh!
There was an error while loading. Please reload this page.
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 |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
…kozak/runtime into prototype-interp-user-breakpoints
23ad599 to
4751352Comparematouskozak
commented
Dec 11, 2025
Merging, future work is tracked in #120842 |
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