[clr-interp] Fix debugger MethodEnter counter and INTOP_DEBUG_METHOD_ENTER assert - #127753
Merged
kotlarmilos merged 1 commit intoMay 12, 2026
Merged
Conversation
Contributor
|
Tagging subscribers to this area: @JulieLeeMSFT, @BrzVlad, @janvorli, @kg |
…R assert Two small interpreter-debugger callback correctness fixes. In DispatchMethodEnter, g_cTotalMethodEnter is supposed to count every controller with MethodEnter enabled regardless of which thread will actually fire the trigger. The increment was inside the per-thread filter, so unbound and other-thread controllers were not counted, and the post-loop _ASSERTE(g_cTotalMethodEnter == count) fired spuriously. Move ++count out of the filter. The trigger itself remains gated on thread affinity. In the interpreter dispatch loop, INTOP_DEBUG_METHOD_ENTER asserts that the seq-point offset patched into the bytecode by OnMethodEnter is INTOP_DEBUG_SEQ_POINT. Once the debugger sets a user breakpoint at that sequence point the opcode is overwritten with INTOP_BREAKPOINT, which is also valid here, so the assert is relaxed to accept either. This fixes the following interpreter debugger test failures: - JMC.jmcChange - JMC.jmcDelegates - JMC.jmcFunceval - Async.AsyncStepInto Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
kotlarmilos
force-pushed
the
interp-debug-callback-correctness
branch
from
May 4, 2026 14:23
3a75885 to
f0e5112
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes two debug-time assertions in the CoreCLR interpreter + debugger integration that were causing interpreter debugger test failures when MethodEnter controllers are thread-affinitized and when the debugger installs a breakpoint on the method-entry sequence point.
Changes:
- Fix
DispatchMethodEnter’s debug-only controller counting so it matchesg_cTotalMethodEnterregardless of per-thread filtering. - Update the interpreter
INTOP_DEBUG_METHOD_ENTERassertion to allow the entry seq-point opcode to be eitherINTOP_DEBUG_SEQ_POINTorINTOP_BREAKPOINT(when patched by the debugger).
Show a summary per file
| File | Description |
|---|---|
| src/coreclr/vm/interpexec.cpp | Allow INTOP_DEBUG_METHOD_ENTER’s target opcode to be a debugger-patched breakpoint as well as the original debug seq-point. |
| src/coreclr/debug/ee/controller.cpp | Count all MethodEnter-enabled controllers (even if not firing on the current thread) so the g_cTotalMethodEnter consistency assert holds. |
Copilot's findings
- Files reviewed: 2/2 changed files
- Comments generated: 0
BrzVlad
reviewed
May 5, 2026
noahfalk
approved these changes
May 12, 2026
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.
Description
In
DispatchMethodEnter,g_cTotalMethodEnteris supposed to count every controller withMethodEnterenabled regardless of which thread will actually fire the trigger. The increment was inside the per-thread filter, so unbound controllers were not counted, and the post-loop_ASSERTE(g_cTotalMethodEnter == count)fired. Move++countout of the filter.In the interpreter dispatch loop,
INTOP_DEBUG_METHOD_ENTERasserts that the seq-point offset patched into the bytecode byOnMethodEnterisINTOP_DEBUG_SEQ_POINT. Once the debugger sets a user breakpoint at that sequence point the opcode is overwritten withINTOP_BREAKPOINT, which is also valid here, so the assert is updated to support such cases.This fixes the following interpreter debugger test failures:
JMC.jmcChangeJMC.jmcDelegatesJMC.jmcFuncevalAsync.AsyncStepInto