Adjust interpreter debugger IL mapping#127469
Open
tommcdon wants to merge 2 commits intodotnet:mainfrom
Open
Conversation
…calls - Filter IL-to-native mapping to statement boundaries - Emit real NOP after call instructions so return address falls within call range - Add INTOP_NOP handler in interpreter executor Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Gate the post-call NOP emission on CORJIT_FLAG_DEBUG_CODE so that release/optimized interpreter code does not pay for the extra instruction. Debug builds need the NOP to preserve the native offset gap between a call and the next statement for correct debugger stack walk line numbers. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adjusts the CoreCLR interpreter’s debug IL→native boundary generation and stackwalk behavior to better match the debugger’s expectations (notably around call return addresses and sequence-point selection), reducing incorrect source line reporting for interpreter frames.
Changes:
- Restricts IL→native boundary emission to fewer IL offsets (intended to better approximate “sequence point” style mappings).
- Inserts an executable no-op after calls (in debug-code mode) when the next IL instruction is eliminated, so the call’s resumption IP maps to the expected statement.
- Adds runtime execution handling for the emitted no-op and clarifies a stack-unwind comment.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| src/coreclr/vm/interpexec.cpp | Adds execution handling for INTOP_NOP in the interpreter dispatch loop. |
| src/coreclr/vm/eetwain.cpp | Adds a clarifying comment about the interpreter frame IP resumption point during unwinding. |
| src/coreclr/interpreter/compiler.cpp | Changes IL→native boundary emission filtering and injects an executable no-op after calls in debug-code mode when encountering eliminated instructions. |
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
When the debugger walks the stack, interpreter frames sometimes report incorrect source line due to IL -> native mapping differences compared to how the JIT generates mappings. To better align interpreter debug output with how the debugger maps line numbers:
nopinstructions.nopIL instruction in its place.