Fix most of the diagnostic EH tests with interpreter - #125525

Merged
janvorli merged 7 commits into
dotnet:mainfrom
janvorli:fix-interpreted-diagnostic-tests
Mar 18, 2026
Merged

Fix most of the diagnostic EH tests with interpreter#125525
janvorli merged 7 commits into
dotnet:mainfrom
janvorli:fix-interpreted-diagnostic-tests

Conversation

@janvorli

Copy link
Copy Markdown
Member

Before this change, all of the exception handling diagnostic tests were failing. There were couple of reasons:

  • The debugger stack walk didn't work when it needed to extract the starting context from explicit frames and the InterpreterFrame was the first one. It got the context of the native caller of the interpreter instead of the interpreter context.
  • Exception interception was not supported for the interpreted code in the runtime yet
  • The IL to native offsets map generated by the interpreter compiler was always setting the source field to ICorDebugInfo::SOURCE_TYPE_INVALID. Exception interception looks for offset with ICorDebugInfo::STACK_EMPTY and thus it found none and has failed.
  • The System.Runtime.StackFrameIterator methods were not ignored by the DacDbiInterfaceImpl::UnwindStackWalkFrame and so the tests verifying the stack trace were failing
  • InterpreterFrame was not ignored when enumerating internal frames, generating extra unexpected stuff to the debugger stack trace.

This change fixes these issues and now only three of the total 21 diagnostic EH tests are failing.

It also fixes an issue introduced by recent refactoring of the debugging code error handling that was causing the tests to fail on Linux even without interpreter.

Before this change, all of the exception handling diagnostic tests were failing.
There were couple of reasons:
* The debugger stack walk didn't work when it needed to extract the starting context
from explicit frames and the InterpreterFrame was the first one. It got the context
of the native caller of the interpreter instead of the interpreter context.
* Exception interception was not supported for the interpreted code in the runtime yet
* The IL to native offsets map generated by the interpreter compiler was always setting
the source field to ICorDebugInfo::SOURCE_TYPE_INVALID. Exception interception looks
for offset with ICorDebugInfo::STACK_EMPTY and thus it found none and has failed.
* The System.Runtime.StackFrameIterator methods were not ignored by the
DacDbiInterfaceImpl::UnwindStackWalkFrame and so the tests verifying the stack trace
were failing
* InterpreterFrame was not ignored when enumerating internal frames, generating extra
unexpected stuff to the debugger stack trace.
This change fixes these issues and now only three of the total 21 diagnostic EH tests
are failing.
It also fixes an issue introduced by recent refactoring of the debugging code error
handling that was causing the tests to fail on Linux even without interpreter.
@janvorlijanvorli added this to the 11.0.0 milestone Mar 13, 2026
@janvorlijanvorli self-assigned this Mar 13, 2026
@janvorli
janvorli requested a review from BrzVlad as a code ownerMarch 13, 2026 16:20
@janvorli
janvorli requested a review from kg as a code ownerMarch 13, 2026 16:20
CopilotAI review requested due to automatic review settings March 13, 2026 16:20

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes interpreter-related exception handling (EH) diagnostics by aligning debugger stack walking, interception, and IL↔native mapping behavior with expectations, and by addressing a Linux-only regression from recent debugging error-handling refactors.

Changes:

  • Enable EH interception support for interpreted code (frame interception + code manager resume paths).
  • Emit interpreter IL→native maps with STACK_EMPTY where needed to allow interception to locate valid offsets.
  • Adjust DAC/DBI stack walking and internal-frame enumeration to ignore additional runtime/internal frames (including InterpreterFrame and System.Runtime.StackFrameIterator.*).

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
FileDescription
src/coreclr/vm/frames.hAdds interception reporting for InterpreterFrame based on faulting state.
src/coreclr/vm/exceptionhandling.cppUses interpreter-or-JIT code address for interception and resumes using the code manager instead of restoring nonvolatile context directly.
src/coreclr/interpreter/compiler.hExtends InterpInst with tracked evaluation stack depth.
src/coreclr/interpreter/compiler.cppPopulates stackDepth and emits STACK_EMPTY in IL→native maps when stack depth is 0.
src/coreclr/debug/daccess/dacdbiimplstackwalk.cppSkips System.Runtime.StackFrameIterator.* methods and filters InterpreterFrame from internal frames.
src/coreclr/debug/daccess/dacdbiimpl.cppImproves context extraction when the first usable frame is an InterpreterFrame, and tweaks a success return path.

You can also share your feedback on Copilot code review. Take the survey.

Comment threadsrc/coreclr/debug/daccess/dacdbiimpl.cpp
Comment threadsrc/coreclr/interpreter/compiler.cpp Outdated
Comment threadsrc/coreclr/vm/exceptionhandling.cpp
Comment threadsrc/coreclr/debug/daccess/dacdbiimplstackwalk.cpp
Comment threadsrc/coreclr/debug/daccess/dacdbiimplstackwalk.cpp
CopilotAI review requested due to automatic review settings March 16, 2026 17:29
@janvorli
janvorliforce-pushed the fix-interpreted-diagnostic-tests branch from 82ae044 to 2874951CompareMarch 16, 2026 17:29

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves CoreCLR debugger/diagnostics support for interpreted exception handling paths so that most diagnostic EH tests can pass under the interpreter (and also fixes a Linux regression in debug error handling).

Changes:

  • Extend interpreter frame/debugger integration (frame interception reporting, retrieving correct starting context when an InterpreterFrame is present).
  • Update EH interception/resume logic to use interpreter-aware entry points and CodeManager::ResumeAfterCatch.
  • Adjust interpreter-generated IL-to-native mapping/source typing and update DAC stack-walking to hide internal helper frames (including System.Runtime.StackFrameIterator.* and InterpreterFrame).

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
FileDescription
src/coreclr/vm/frames.hAdds InterpreterFrame::GetInterception_Impl to report interception state for debugger stackwalking.
src/coreclr/vm/exceptionhandling.cppUses interpreter-aware code start for interception and restores context via ResumeAfterCatch.
src/coreclr/interpreter/compiler.hIntroduces a new instruction flag and initializes m_pLastNewIns.
src/coreclr/interpreter/compiler.cppSets per-IL-offset flags and uses them to mark IL-to-native mapping source types.
src/coreclr/debug/daccess/dacdbiimplstackwalk.cppSkips System.Runtime.StackFrameIterator.* and InterpreterFrame in internal-frame enumeration.
src/coreclr/debug/daccess/dacdbiimpl.cppSpecial-cases InterpreterFrame when synthesizing a thread context from explicit frames and returns S_OK for that path.

You can also share your feedback on Copilot code review. Take the survey.

Comment threadsrc/coreclr/interpreter/compiler.cpp Outdated
Comment threadsrc/coreclr/interpreter/compiler.cpp Outdated
Comment threadsrc/coreclr/debug/daccess/dacdbiimpl.cpp Outdated
Comment threadsrc/coreclr/vm/exceptionhandling.cpp
CopilotAI review requested due to automatic review settings March 16, 2026 20:44

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR targets CoreCLR debugging/EH support for the interpreter so that diagnostic exception-handling tests can run successfully under interpreted execution, and also fixes a Linux regression from recent debugging error-handling refactoring.

Changes:

  • Adds interpreter-aware exception interception/resume behavior by using interpreter/jit code start addresses and code-manager resume APIs.
  • Improves interpreter IL-to-native offset mapping by marking STACK_EMPTY at the first instruction for an IL offset when the IL stack is empty.
  • Updates DAC/debugger stack walking to ignore System.Runtime.StackFrameIterator.* and skip InterpreterFrame where appropriate, plus adds interpreter-frame interception reporting.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
FileDescription
src/coreclr/vm/frames.hAdds InterpreterFrame::GetInterception_Impl() to report exception interception when faulting.
src/coreclr/vm/exceptionhandling.cppAdjusts interception handling to use interpreter/jit entrypoints and code-manager resume paths.
src/coreclr/interpreter/compiler.hIntroduces an instruction flag for “empty IL stack” and initializes m_pLastNewIns.
src/coreclr/interpreter/compiler.cppSets STACK_EMPTY offset mappings when the IL stack is empty at an IL offset’s first emitted instruction.
src/coreclr/debug/daccess/dacdbiimplstackwalk.cppSkips StackFrameIterator methods and omits InterpreterFrame from internal-frame enumeration.
src/coreclr/debug/daccess/dacdbiimpl.cppTeaches DAC context extraction to seed context from interpreter frames when needed; fixes return value.

You can also share your feedback on Copilot code review. Take the survey.

Comment threadsrc/coreclr/vm/exceptionhandling.cpp
Comment threadsrc/coreclr/debug/daccess/dacdbiimpl.cpp Outdated
CopilotAI review requested due to automatic review settings March 16, 2026 22:30

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Improves CoreCLR debugger/EH behavior for interpreted code so that diagnostic exception-handling (EH) tests can run under the interpreter, and also fixes a Linux regression from recent debugging error-handling refactoring.

Changes:

  • Add interpreter-aware interception and resumption paths in EH/debugger code (use GetCodeForInterpreterOrJitted(), route resumption via ICodeManager::ResumeAfterCatch, and report interpreter frame interception state).
  • Teach the interpreter compiler to emit STACK_EMPTY IL->native mappings (via a new instruction flag) to support exception interception resume-point lookup.
  • Adjust DAC/DBI stack walking to ignore System.Runtime.StackFrameIterator.* and InterpreterFrame in relevant internal-frame enumeration paths, and fix GetContext behavior when GetThreadContext is not implemented.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
FileDescription
src/coreclr/vm/frames.hReports interpreter frame interception state based on faulting status.
src/coreclr/vm/exceptionhandling.cppUses interpreter/jitted code start addresses and resumes via the code manager for interception scenarios.
src/coreclr/interpreter/compiler.hAdds an instruction flag for “empty IL stack” and initializes m_pLastNewIns.
src/coreclr/interpreter/compiler.cppSets IL->native map source to STACK_EMPTY based on the new flag; attempts to mark first instruction per IL offset.
src/coreclr/debug/daccess/dacdbiimplstackwalk.cppSkips StackFrameIterator methods and InterpreterFrame in certain debugger stackwalk/internal-frame paths.
src/coreclr/debug/daccess/dacdbiimpl.cppFixes DAC GetContext fallback for interpreter frames and returns S_OK when context is synthesized.

You can also share your feedback on Copilot code review. Take the survey.

Comment threadsrc/coreclr/interpreter/compiler.cpp Outdated
@janvorli

Copy link
Copy Markdown
MemberAuthor

/ba-g the failures are some iOS tests that have been failing in other PRs too and #125295

@janvorli
janvorli merged commit 36b4d74 into dotnet:mainMar 18, 2026
96 of 105 checks passed
@github-actionsgithub-actionsBot locked and limited conversation to collaborators Apr 18, 2026
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@janvorli@BrzVlad
, 'i'); if (__m === '*' || __re.test(location.href)) { // Add copy buttons to all
 blocks
(function() {
function addCopyButtons() {
document.querySelectorAll('pre code').forEach(function(codeBlock) {
if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;
codeBlock.parentElement.setAttribute('data-copy-added', 'true');
var btn = document.createElement('button');
btn.textContent = 'Copy';
btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';
btn.onmouseover = function() { this.style.opacity = '1'; };
btn.onmouseout = function() { this.style.opacity = '0.7'; };
btn.onclick = function() {
navigator.clipboard.writeText(codeBlock.textContent).then(function() {
btn.textContent = 'Copied!';
setTimeout(function() { btn.textContent = 'Copy'; }, 1500);
});
};
codeBlock.parentElement.style.position = 'relative';
codeBlock.parentElement.appendChild(btn);
});
}
addCopyButtons();
// Re-run on dynamic content
var observer = new MutationObserver(addCopyButtons);
observer.observe(document.body, { childList: true, subtree: true });
})();
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content

Fix most of the diagnostic EH tests with interpreter - #125525

Merged
janvorli merged 7 commits into
dotnet:mainfrom
janvorli:fix-interpreted-diagnostic-tests
Mar 18, 2026
Merged

Fix most of the diagnostic EH tests with interpreter#125525
janvorli merged 7 commits into
dotnet:mainfrom
janvorli:fix-interpreted-diagnostic-tests

Conversation

@janvorli

Copy link
Copy Markdown
Member

Before this change, all of the exception handling diagnostic tests were failing. There were couple of reasons:

  • The debugger stack walk didn't work when it needed to extract the starting context from explicit frames and the InterpreterFrame was the first one. It got the context of the native caller of the interpreter instead of the interpreter context.
  • Exception interception was not supported for the interpreted code in the runtime yet
  • The IL to native offsets map generated by the interpreter compiler was always setting the source field to ICorDebugInfo::SOURCE_TYPE_INVALID. Exception interception looks for offset with ICorDebugInfo::STACK_EMPTY and thus it found none and has failed.
  • The System.Runtime.StackFrameIterator methods were not ignored by the DacDbiInterfaceImpl::UnwindStackWalkFrame and so the tests verifying the stack trace were failing
  • InterpreterFrame was not ignored when enumerating internal frames, generating extra unexpected stuff to the debugger stack trace.

This change fixes these issues and now only three of the total 21 diagnostic EH tests are failing.

It also fixes an issue introduced by recent refactoring of the debugging code error handling that was causing the tests to fail on Linux even without interpreter.

Before this change, all of the exception handling diagnostic tests were failing.
There were couple of reasons:
* The debugger stack walk didn't work when it needed to extract the starting context
from explicit frames and the InterpreterFrame was the first one. It got the context
of the native caller of the interpreter instead of the interpreter context.
* Exception interception was not supported for the interpreted code in the runtime yet
* The IL to native offsets map generated by the interpreter compiler was always setting
the source field to ICorDebugInfo::SOURCE_TYPE_INVALID. Exception interception looks
for offset with ICorDebugInfo::STACK_EMPTY and thus it found none and has failed.
* The System.Runtime.StackFrameIterator methods were not ignored by the
DacDbiInterfaceImpl::UnwindStackWalkFrame and so the tests verifying the stack trace
were failing
* InterpreterFrame was not ignored when enumerating internal frames, generating extra
unexpected stuff to the debugger stack trace.
This change fixes these issues and now only three of the total 21 diagnostic EH tests
are failing.
It also fixes an issue introduced by recent refactoring of the debugging code error
handling that was causing the tests to fail on Linux even without interpreter.
@janvorlijanvorli added this to the 11.0.0 milestone Mar 13, 2026
@janvorlijanvorli self-assigned this Mar 13, 2026
@janvorli
janvorli requested a review from BrzVlad as a code ownerMarch 13, 2026 16:20
@janvorli
janvorli requested a review from kg as a code ownerMarch 13, 2026 16:20
CopilotAI review requested due to automatic review settings March 13, 2026 16:20

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes interpreter-related exception handling (EH) diagnostics by aligning debugger stack walking, interception, and IL↔native mapping behavior with expectations, and by addressing a Linux-only regression from recent debugging error-handling refactors.

Changes:

  • Enable EH interception support for interpreted code (frame interception + code manager resume paths).
  • Emit interpreter IL→native maps with STACK_EMPTY where needed to allow interception to locate valid offsets.
  • Adjust DAC/DBI stack walking and internal-frame enumeration to ignore additional runtime/internal frames (including InterpreterFrame and System.Runtime.StackFrameIterator.*).

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
FileDescription
src/coreclr/vm/frames.hAdds interception reporting for InterpreterFrame based on faulting state.
src/coreclr/vm/exceptionhandling.cppUses interpreter-or-JIT code address for interception and resumes using the code manager instead of restoring nonvolatile context directly.
src/coreclr/interpreter/compiler.hExtends InterpInst with tracked evaluation stack depth.
src/coreclr/interpreter/compiler.cppPopulates stackDepth and emits STACK_EMPTY in IL→native maps when stack depth is 0.
src/coreclr/debug/daccess/dacdbiimplstackwalk.cppSkips System.Runtime.StackFrameIterator.* methods and filters InterpreterFrame from internal frames.
src/coreclr/debug/daccess/dacdbiimpl.cppImproves context extraction when the first usable frame is an InterpreterFrame, and tweaks a success return path.

You can also share your feedback on Copilot code review. Take the survey.

Comment threadsrc/coreclr/debug/daccess/dacdbiimpl.cpp
Comment threadsrc/coreclr/interpreter/compiler.cpp Outdated
Comment threadsrc/coreclr/vm/exceptionhandling.cpp
Comment threadsrc/coreclr/debug/daccess/dacdbiimplstackwalk.cpp
Comment threadsrc/coreclr/debug/daccess/dacdbiimplstackwalk.cpp
CopilotAI review requested due to automatic review settings March 16, 2026 17:29
@janvorli
janvorliforce-pushed the fix-interpreted-diagnostic-tests branch from 82ae044 to 2874951CompareMarch 16, 2026 17:29

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves CoreCLR debugger/diagnostics support for interpreted exception handling paths so that most diagnostic EH tests can pass under the interpreter (and also fixes a Linux regression in debug error handling).

Changes:

  • Extend interpreter frame/debugger integration (frame interception reporting, retrieving correct starting context when an InterpreterFrame is present).
  • Update EH interception/resume logic to use interpreter-aware entry points and CodeManager::ResumeAfterCatch.
  • Adjust interpreter-generated IL-to-native mapping/source typing and update DAC stack-walking to hide internal helper frames (including System.Runtime.StackFrameIterator.* and InterpreterFrame).

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
FileDescription
src/coreclr/vm/frames.hAdds InterpreterFrame::GetInterception_Impl to report interception state for debugger stackwalking.
src/coreclr/vm/exceptionhandling.cppUses interpreter-aware code start for interception and restores context via ResumeAfterCatch.
src/coreclr/interpreter/compiler.hIntroduces a new instruction flag and initializes m_pLastNewIns.
src/coreclr/interpreter/compiler.cppSets per-IL-offset flags and uses them to mark IL-to-native mapping source types.
src/coreclr/debug/daccess/dacdbiimplstackwalk.cppSkips System.Runtime.StackFrameIterator.* and InterpreterFrame in internal-frame enumeration.
src/coreclr/debug/daccess/dacdbiimpl.cppSpecial-cases InterpreterFrame when synthesizing a thread context from explicit frames and returns S_OK for that path.

You can also share your feedback on Copilot code review. Take the survey.

Comment threadsrc/coreclr/interpreter/compiler.cpp Outdated
Comment threadsrc/coreclr/interpreter/compiler.cpp Outdated
Comment threadsrc/coreclr/debug/daccess/dacdbiimpl.cpp Outdated
Comment threadsrc/coreclr/vm/exceptionhandling.cpp
CopilotAI review requested due to automatic review settings March 16, 2026 20:44

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR targets CoreCLR debugging/EH support for the interpreter so that diagnostic exception-handling tests can run successfully under interpreted execution, and also fixes a Linux regression from recent debugging error-handling refactoring.

Changes:

  • Adds interpreter-aware exception interception/resume behavior by using interpreter/jit code start addresses and code-manager resume APIs.
  • Improves interpreter IL-to-native offset mapping by marking STACK_EMPTY at the first instruction for an IL offset when the IL stack is empty.
  • Updates DAC/debugger stack walking to ignore System.Runtime.StackFrameIterator.* and skip InterpreterFrame where appropriate, plus adds interpreter-frame interception reporting.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
FileDescription
src/coreclr/vm/frames.hAdds InterpreterFrame::GetInterception_Impl() to report exception interception when faulting.
src/coreclr/vm/exceptionhandling.cppAdjusts interception handling to use interpreter/jit entrypoints and code-manager resume paths.
src/coreclr/interpreter/compiler.hIntroduces an instruction flag for “empty IL stack” and initializes m_pLastNewIns.
src/coreclr/interpreter/compiler.cppSets STACK_EMPTY offset mappings when the IL stack is empty at an IL offset’s first emitted instruction.
src/coreclr/debug/daccess/dacdbiimplstackwalk.cppSkips StackFrameIterator methods and omits InterpreterFrame from internal-frame enumeration.
src/coreclr/debug/daccess/dacdbiimpl.cppTeaches DAC context extraction to seed context from interpreter frames when needed; fixes return value.

You can also share your feedback on Copilot code review. Take the survey.

Comment threadsrc/coreclr/vm/exceptionhandling.cpp
Comment threadsrc/coreclr/debug/daccess/dacdbiimpl.cpp Outdated
CopilotAI review requested due to automatic review settings March 16, 2026 22:30

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Improves CoreCLR debugger/EH behavior for interpreted code so that diagnostic exception-handling (EH) tests can run under the interpreter, and also fixes a Linux regression from recent debugging error-handling refactoring.

Changes:

  • Add interpreter-aware interception and resumption paths in EH/debugger code (use GetCodeForInterpreterOrJitted(), route resumption via ICodeManager::ResumeAfterCatch, and report interpreter frame interception state).
  • Teach the interpreter compiler to emit STACK_EMPTY IL->native mappings (via a new instruction flag) to support exception interception resume-point lookup.
  • Adjust DAC/DBI stack walking to ignore System.Runtime.StackFrameIterator.* and InterpreterFrame in relevant internal-frame enumeration paths, and fix GetContext behavior when GetThreadContext is not implemented.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
FileDescription
src/coreclr/vm/frames.hReports interpreter frame interception state based on faulting status.
src/coreclr/vm/exceptionhandling.cppUses interpreter/jitted code start addresses and resumes via the code manager for interception scenarios.
src/coreclr/interpreter/compiler.hAdds an instruction flag for “empty IL stack” and initializes m_pLastNewIns.
src/coreclr/interpreter/compiler.cppSets IL->native map source to STACK_EMPTY based on the new flag; attempts to mark first instruction per IL offset.
src/coreclr/debug/daccess/dacdbiimplstackwalk.cppSkips StackFrameIterator methods and InterpreterFrame in certain debugger stackwalk/internal-frame paths.
src/coreclr/debug/daccess/dacdbiimpl.cppFixes DAC GetContext fallback for interpreter frames and returns S_OK when context is synthesized.

You can also share your feedback on Copilot code review. Take the survey.

Comment threadsrc/coreclr/interpreter/compiler.cpp Outdated
@janvorli

Copy link
Copy Markdown
MemberAuthor

/ba-g the failures are some iOS tests that have been failing in other PRs too and #125295

@janvorli
janvorli merged commit 36b4d74 into dotnet:mainMar 18, 2026
96 of 105 checks passed
@github-actionsgithub-actionsBot locked and limited conversation to collaborators Apr 18, 2026
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@janvorli@BrzVlad
, 'i'); if (__m === '*' || __re.test(location.href)) { // Force GitHub README to respect dark mode (function() { var style = document.createElement('style'); style.textContent = ' .markdown-body { color-scheme: dark light; } .markdown-body pre { background: #161b22 !important; } .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; } .markdown-body table th, .markdown-body table td { border-color: #30363d !important; } .markdown-body img { background: #0d1117; } .markdown-body blockquote { border-left-color: #8b949e; } .markdown-body hr { border-color: #30363d; } '; document.head.appendChild(style); })(); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Fix most of the diagnostic EH tests with interpreter - #125525

Merged
janvorli merged 7 commits into
dotnet:mainfrom
janvorli:fix-interpreted-diagnostic-tests
Mar 18, 2026
Merged

Fix most of the diagnostic EH tests with interpreter#125525
janvorli merged 7 commits into
dotnet:mainfrom
janvorli:fix-interpreted-diagnostic-tests

Conversation

@janvorli

Copy link
Copy Markdown
Member

Before this change, all of the exception handling diagnostic tests were failing. There were couple of reasons:

  • The debugger stack walk didn't work when it needed to extract the starting context from explicit frames and the InterpreterFrame was the first one. It got the context of the native caller of the interpreter instead of the interpreter context.
  • Exception interception was not supported for the interpreted code in the runtime yet
  • The IL to native offsets map generated by the interpreter compiler was always setting the source field to ICorDebugInfo::SOURCE_TYPE_INVALID. Exception interception looks for offset with ICorDebugInfo::STACK_EMPTY and thus it found none and has failed.
  • The System.Runtime.StackFrameIterator methods were not ignored by the DacDbiInterfaceImpl::UnwindStackWalkFrame and so the tests verifying the stack trace were failing
  • InterpreterFrame was not ignored when enumerating internal frames, generating extra unexpected stuff to the debugger stack trace.

This change fixes these issues and now only three of the total 21 diagnostic EH tests are failing.

It also fixes an issue introduced by recent refactoring of the debugging code error handling that was causing the tests to fail on Linux even without interpreter.

Before this change, all of the exception handling diagnostic tests were failing.
There were couple of reasons:
* The debugger stack walk didn't work when it needed to extract the starting context
from explicit frames and the InterpreterFrame was the first one. It got the context
of the native caller of the interpreter instead of the interpreter context.
* Exception interception was not supported for the interpreted code in the runtime yet
* The IL to native offsets map generated by the interpreter compiler was always setting
the source field to ICorDebugInfo::SOURCE_TYPE_INVALID. Exception interception looks
for offset with ICorDebugInfo::STACK_EMPTY and thus it found none and has failed.
* The System.Runtime.StackFrameIterator methods were not ignored by the
DacDbiInterfaceImpl::UnwindStackWalkFrame and so the tests verifying the stack trace
were failing
* InterpreterFrame was not ignored when enumerating internal frames, generating extra
unexpected stuff to the debugger stack trace.
This change fixes these issues and now only three of the total 21 diagnostic EH tests
are failing.
It also fixes an issue introduced by recent refactoring of the debugging code error
handling that was causing the tests to fail on Linux even without interpreter.
@janvorlijanvorli added this to the 11.0.0 milestone Mar 13, 2026
@janvorlijanvorli self-assigned this Mar 13, 2026
@janvorli
janvorli requested a review from BrzVlad as a code ownerMarch 13, 2026 16:20
@janvorli
janvorli requested a review from kg as a code ownerMarch 13, 2026 16:20
CopilotAI review requested due to automatic review settings March 13, 2026 16:20

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes interpreter-related exception handling (EH) diagnostics by aligning debugger stack walking, interception, and IL↔native mapping behavior with expectations, and by addressing a Linux-only regression from recent debugging error-handling refactors.

Changes:

  • Enable EH interception support for interpreted code (frame interception + code manager resume paths).
  • Emit interpreter IL→native maps with STACK_EMPTY where needed to allow interception to locate valid offsets.
  • Adjust DAC/DBI stack walking and internal-frame enumeration to ignore additional runtime/internal frames (including InterpreterFrame and System.Runtime.StackFrameIterator.*).

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
FileDescription
src/coreclr/vm/frames.hAdds interception reporting for InterpreterFrame based on faulting state.
src/coreclr/vm/exceptionhandling.cppUses interpreter-or-JIT code address for interception and resumes using the code manager instead of restoring nonvolatile context directly.
src/coreclr/interpreter/compiler.hExtends InterpInst with tracked evaluation stack depth.
src/coreclr/interpreter/compiler.cppPopulates stackDepth and emits STACK_EMPTY in IL→native maps when stack depth is 0.
src/coreclr/debug/daccess/dacdbiimplstackwalk.cppSkips System.Runtime.StackFrameIterator.* methods and filters InterpreterFrame from internal frames.
src/coreclr/debug/daccess/dacdbiimpl.cppImproves context extraction when the first usable frame is an InterpreterFrame, and tweaks a success return path.

You can also share your feedback on Copilot code review. Take the survey.

Comment threadsrc/coreclr/debug/daccess/dacdbiimpl.cpp
Comment threadsrc/coreclr/interpreter/compiler.cpp Outdated
Comment threadsrc/coreclr/vm/exceptionhandling.cpp
Comment threadsrc/coreclr/debug/daccess/dacdbiimplstackwalk.cpp
Comment threadsrc/coreclr/debug/daccess/dacdbiimplstackwalk.cpp
CopilotAI review requested due to automatic review settings March 16, 2026 17:29
@janvorli
janvorliforce-pushed the fix-interpreted-diagnostic-tests branch from 82ae044 to 2874951CompareMarch 16, 2026 17:29

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves CoreCLR debugger/diagnostics support for interpreted exception handling paths so that most diagnostic EH tests can pass under the interpreter (and also fixes a Linux regression in debug error handling).

Changes:

  • Extend interpreter frame/debugger integration (frame interception reporting, retrieving correct starting context when an InterpreterFrame is present).
  • Update EH interception/resume logic to use interpreter-aware entry points and CodeManager::ResumeAfterCatch.
  • Adjust interpreter-generated IL-to-native mapping/source typing and update DAC stack-walking to hide internal helper frames (including System.Runtime.StackFrameIterator.* and InterpreterFrame).

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
FileDescription
src/coreclr/vm/frames.hAdds InterpreterFrame::GetInterception_Impl to report interception state for debugger stackwalking.
src/coreclr/vm/exceptionhandling.cppUses interpreter-aware code start for interception and restores context via ResumeAfterCatch.
src/coreclr/interpreter/compiler.hIntroduces a new instruction flag and initializes m_pLastNewIns.
src/coreclr/interpreter/compiler.cppSets per-IL-offset flags and uses them to mark IL-to-native mapping source types.
src/coreclr/debug/daccess/dacdbiimplstackwalk.cppSkips System.Runtime.StackFrameIterator.* and InterpreterFrame in internal-frame enumeration.
src/coreclr/debug/daccess/dacdbiimpl.cppSpecial-cases InterpreterFrame when synthesizing a thread context from explicit frames and returns S_OK for that path.

You can also share your feedback on Copilot code review. Take the survey.

Comment threadsrc/coreclr/interpreter/compiler.cpp Outdated
Comment threadsrc/coreclr/interpreter/compiler.cpp Outdated
Comment threadsrc/coreclr/debug/daccess/dacdbiimpl.cpp Outdated
Comment threadsrc/coreclr/vm/exceptionhandling.cpp
CopilotAI review requested due to automatic review settings March 16, 2026 20:44

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR targets CoreCLR debugging/EH support for the interpreter so that diagnostic exception-handling tests can run successfully under interpreted execution, and also fixes a Linux regression from recent debugging error-handling refactoring.

Changes:

  • Adds interpreter-aware exception interception/resume behavior by using interpreter/jit code start addresses and code-manager resume APIs.
  • Improves interpreter IL-to-native offset mapping by marking STACK_EMPTY at the first instruction for an IL offset when the IL stack is empty.
  • Updates DAC/debugger stack walking to ignore System.Runtime.StackFrameIterator.* and skip InterpreterFrame where appropriate, plus adds interpreter-frame interception reporting.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
FileDescription
src/coreclr/vm/frames.hAdds InterpreterFrame::GetInterception_Impl() to report exception interception when faulting.
src/coreclr/vm/exceptionhandling.cppAdjusts interception handling to use interpreter/jit entrypoints and code-manager resume paths.
src/coreclr/interpreter/compiler.hIntroduces an instruction flag for “empty IL stack” and initializes m_pLastNewIns.
src/coreclr/interpreter/compiler.cppSets STACK_EMPTY offset mappings when the IL stack is empty at an IL offset’s first emitted instruction.
src/coreclr/debug/daccess/dacdbiimplstackwalk.cppSkips StackFrameIterator methods and omits InterpreterFrame from internal-frame enumeration.
src/coreclr/debug/daccess/dacdbiimpl.cppTeaches DAC context extraction to seed context from interpreter frames when needed; fixes return value.

You can also share your feedback on Copilot code review. Take the survey.

Comment threadsrc/coreclr/vm/exceptionhandling.cpp
Comment threadsrc/coreclr/debug/daccess/dacdbiimpl.cpp Outdated
CopilotAI review requested due to automatic review settings March 16, 2026 22:30

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Improves CoreCLR debugger/EH behavior for interpreted code so that diagnostic exception-handling (EH) tests can run under the interpreter, and also fixes a Linux regression from recent debugging error-handling refactoring.

Changes:

  • Add interpreter-aware interception and resumption paths in EH/debugger code (use GetCodeForInterpreterOrJitted(), route resumption via ICodeManager::ResumeAfterCatch, and report interpreter frame interception state).
  • Teach the interpreter compiler to emit STACK_EMPTY IL->native mappings (via a new instruction flag) to support exception interception resume-point lookup.
  • Adjust DAC/DBI stack walking to ignore System.Runtime.StackFrameIterator.* and InterpreterFrame in relevant internal-frame enumeration paths, and fix GetContext behavior when GetThreadContext is not implemented.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
FileDescription
src/coreclr/vm/frames.hReports interpreter frame interception state based on faulting status.
src/coreclr/vm/exceptionhandling.cppUses interpreter/jitted code start addresses and resumes via the code manager for interception scenarios.
src/coreclr/interpreter/compiler.hAdds an instruction flag for “empty IL stack” and initializes m_pLastNewIns.
src/coreclr/interpreter/compiler.cppSets IL->native map source to STACK_EMPTY based on the new flag; attempts to mark first instruction per IL offset.
src/coreclr/debug/daccess/dacdbiimplstackwalk.cppSkips StackFrameIterator methods and InterpreterFrame in certain debugger stackwalk/internal-frame paths.
src/coreclr/debug/daccess/dacdbiimpl.cppFixes DAC GetContext fallback for interpreter frames and returns S_OK when context is synthesized.

You can also share your feedback on Copilot code review. Take the survey.

Comment threadsrc/coreclr/interpreter/compiler.cpp Outdated
@janvorli

Copy link
Copy Markdown
MemberAuthor

/ba-g the failures are some iOS tests that have been failing in other PRs too and #125295

@janvorli
janvorli merged commit 36b4d74 into dotnet:mainMar 18, 2026
96 of 105 checks passed
@github-actionsgithub-actionsBot locked and limited conversation to collaborators Apr 18, 2026
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@janvorli@BrzVlad
, 'i'); if (__m === '*' || __re.test(location.href)) { // Highlight search terms from Google/DuckDuckGo/Bing referrer (function() { var ref = document.referrer; var terms = []; if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) { var url = new URL(ref); var q = url.searchParams.get('q') || url.searchParams.get('p'); if (q) { terms = q.split(/\s+/).filter(function(t) { return t.length > 2; }); } } if (terms.length === 0) return; var style = document.createElement('style'); style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }'; document.head.appendChild(style); function highlight(node) { if (node.nodeType === 3) { // text node var text = node.textContent; var found = false; terms.forEach(function(term) { var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\]\\]/g, '\\') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Fix most of the diagnostic EH tests with interpreter - #125525

Merged
janvorli merged 7 commits into
dotnet:mainfrom
janvorli:fix-interpreted-diagnostic-tests
Mar 18, 2026
Merged

Fix most of the diagnostic EH tests with interpreter#125525
janvorli merged 7 commits into
dotnet:mainfrom
janvorli:fix-interpreted-diagnostic-tests

Conversation

@janvorli

Copy link
Copy Markdown
Member

Before this change, all of the exception handling diagnostic tests were failing. There were couple of reasons:

  • The debugger stack walk didn't work when it needed to extract the starting context from explicit frames and the InterpreterFrame was the first one. It got the context of the native caller of the interpreter instead of the interpreter context.
  • Exception interception was not supported for the interpreted code in the runtime yet
  • The IL to native offsets map generated by the interpreter compiler was always setting the source field to ICorDebugInfo::SOURCE_TYPE_INVALID. Exception interception looks for offset with ICorDebugInfo::STACK_EMPTY and thus it found none and has failed.
  • The System.Runtime.StackFrameIterator methods were not ignored by the DacDbiInterfaceImpl::UnwindStackWalkFrame and so the tests verifying the stack trace were failing
  • InterpreterFrame was not ignored when enumerating internal frames, generating extra unexpected stuff to the debugger stack trace.

This change fixes these issues and now only three of the total 21 diagnostic EH tests are failing.

It also fixes an issue introduced by recent refactoring of the debugging code error handling that was causing the tests to fail on Linux even without interpreter.

Before this change, all of the exception handling diagnostic tests were failing.
There were couple of reasons:
* The debugger stack walk didn't work when it needed to extract the starting context
from explicit frames and the InterpreterFrame was the first one. It got the context
of the native caller of the interpreter instead of the interpreter context.
* Exception interception was not supported for the interpreted code in the runtime yet
* The IL to native offsets map generated by the interpreter compiler was always setting
the source field to ICorDebugInfo::SOURCE_TYPE_INVALID. Exception interception looks
for offset with ICorDebugInfo::STACK_EMPTY and thus it found none and has failed.
* The System.Runtime.StackFrameIterator methods were not ignored by the
DacDbiInterfaceImpl::UnwindStackWalkFrame and so the tests verifying the stack trace
were failing
* InterpreterFrame was not ignored when enumerating internal frames, generating extra
unexpected stuff to the debugger stack trace.
This change fixes these issues and now only three of the total 21 diagnostic EH tests
are failing.
It also fixes an issue introduced by recent refactoring of the debugging code error
handling that was causing the tests to fail on Linux even without interpreter.
@janvorlijanvorli added this to the 11.0.0 milestone Mar 13, 2026
@janvorlijanvorli self-assigned this Mar 13, 2026
@janvorli
janvorli requested a review from BrzVlad as a code ownerMarch 13, 2026 16:20
@janvorli
janvorli requested a review from kg as a code ownerMarch 13, 2026 16:20
CopilotAI review requested due to automatic review settings March 13, 2026 16:20

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes interpreter-related exception handling (EH) diagnostics by aligning debugger stack walking, interception, and IL↔native mapping behavior with expectations, and by addressing a Linux-only regression from recent debugging error-handling refactors.

Changes:

  • Enable EH interception support for interpreted code (frame interception + code manager resume paths).
  • Emit interpreter IL→native maps with STACK_EMPTY where needed to allow interception to locate valid offsets.
  • Adjust DAC/DBI stack walking and internal-frame enumeration to ignore additional runtime/internal frames (including InterpreterFrame and System.Runtime.StackFrameIterator.*).

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
FileDescription
src/coreclr/vm/frames.hAdds interception reporting for InterpreterFrame based on faulting state.
src/coreclr/vm/exceptionhandling.cppUses interpreter-or-JIT code address for interception and resumes using the code manager instead of restoring nonvolatile context directly.
src/coreclr/interpreter/compiler.hExtends InterpInst with tracked evaluation stack depth.
src/coreclr/interpreter/compiler.cppPopulates stackDepth and emits STACK_EMPTY in IL→native maps when stack depth is 0.
src/coreclr/debug/daccess/dacdbiimplstackwalk.cppSkips System.Runtime.StackFrameIterator.* methods and filters InterpreterFrame from internal frames.
src/coreclr/debug/daccess/dacdbiimpl.cppImproves context extraction when the first usable frame is an InterpreterFrame, and tweaks a success return path.

You can also share your feedback on Copilot code review. Take the survey.

Comment threadsrc/coreclr/debug/daccess/dacdbiimpl.cpp
Comment threadsrc/coreclr/interpreter/compiler.cpp Outdated
Comment threadsrc/coreclr/vm/exceptionhandling.cpp
Comment threadsrc/coreclr/debug/daccess/dacdbiimplstackwalk.cpp
Comment threadsrc/coreclr/debug/daccess/dacdbiimplstackwalk.cpp
CopilotAI review requested due to automatic review settings March 16, 2026 17:29
@janvorli
janvorliforce-pushed the fix-interpreted-diagnostic-tests branch from 82ae044 to 2874951CompareMarch 16, 2026 17:29

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves CoreCLR debugger/diagnostics support for interpreted exception handling paths so that most diagnostic EH tests can pass under the interpreter (and also fixes a Linux regression in debug error handling).

Changes:

  • Extend interpreter frame/debugger integration (frame interception reporting, retrieving correct starting context when an InterpreterFrame is present).
  • Update EH interception/resume logic to use interpreter-aware entry points and CodeManager::ResumeAfterCatch.
  • Adjust interpreter-generated IL-to-native mapping/source typing and update DAC stack-walking to hide internal helper frames (including System.Runtime.StackFrameIterator.* and InterpreterFrame).

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
FileDescription
src/coreclr/vm/frames.hAdds InterpreterFrame::GetInterception_Impl to report interception state for debugger stackwalking.
src/coreclr/vm/exceptionhandling.cppUses interpreter-aware code start for interception and restores context via ResumeAfterCatch.
src/coreclr/interpreter/compiler.hIntroduces a new instruction flag and initializes m_pLastNewIns.
src/coreclr/interpreter/compiler.cppSets per-IL-offset flags and uses them to mark IL-to-native mapping source types.
src/coreclr/debug/daccess/dacdbiimplstackwalk.cppSkips System.Runtime.StackFrameIterator.* and InterpreterFrame in internal-frame enumeration.
src/coreclr/debug/daccess/dacdbiimpl.cppSpecial-cases InterpreterFrame when synthesizing a thread context from explicit frames and returns S_OK for that path.

You can also share your feedback on Copilot code review. Take the survey.

Comment threadsrc/coreclr/interpreter/compiler.cpp Outdated
Comment threadsrc/coreclr/interpreter/compiler.cpp Outdated
Comment threadsrc/coreclr/debug/daccess/dacdbiimpl.cpp Outdated
Comment threadsrc/coreclr/vm/exceptionhandling.cpp
CopilotAI review requested due to automatic review settings March 16, 2026 20:44

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR targets CoreCLR debugging/EH support for the interpreter so that diagnostic exception-handling tests can run successfully under interpreted execution, and also fixes a Linux regression from recent debugging error-handling refactoring.

Changes:

  • Adds interpreter-aware exception interception/resume behavior by using interpreter/jit code start addresses and code-manager resume APIs.
  • Improves interpreter IL-to-native offset mapping by marking STACK_EMPTY at the first instruction for an IL offset when the IL stack is empty.
  • Updates DAC/debugger stack walking to ignore System.Runtime.StackFrameIterator.* and skip InterpreterFrame where appropriate, plus adds interpreter-frame interception reporting.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
FileDescription
src/coreclr/vm/frames.hAdds InterpreterFrame::GetInterception_Impl() to report exception interception when faulting.
src/coreclr/vm/exceptionhandling.cppAdjusts interception handling to use interpreter/jit entrypoints and code-manager resume paths.
src/coreclr/interpreter/compiler.hIntroduces an instruction flag for “empty IL stack” and initializes m_pLastNewIns.
src/coreclr/interpreter/compiler.cppSets STACK_EMPTY offset mappings when the IL stack is empty at an IL offset’s first emitted instruction.
src/coreclr/debug/daccess/dacdbiimplstackwalk.cppSkips StackFrameIterator methods and omits InterpreterFrame from internal-frame enumeration.
src/coreclr/debug/daccess/dacdbiimpl.cppTeaches DAC context extraction to seed context from interpreter frames when needed; fixes return value.

You can also share your feedback on Copilot code review. Take the survey.

Comment threadsrc/coreclr/vm/exceptionhandling.cpp
Comment threadsrc/coreclr/debug/daccess/dacdbiimpl.cpp Outdated
CopilotAI review requested due to automatic review settings March 16, 2026 22:30

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Improves CoreCLR debugger/EH behavior for interpreted code so that diagnostic exception-handling (EH) tests can run under the interpreter, and also fixes a Linux regression from recent debugging error-handling refactoring.

Changes:

  • Add interpreter-aware interception and resumption paths in EH/debugger code (use GetCodeForInterpreterOrJitted(), route resumption via ICodeManager::ResumeAfterCatch, and report interpreter frame interception state).
  • Teach the interpreter compiler to emit STACK_EMPTY IL->native mappings (via a new instruction flag) to support exception interception resume-point lookup.
  • Adjust DAC/DBI stack walking to ignore System.Runtime.StackFrameIterator.* and InterpreterFrame in relevant internal-frame enumeration paths, and fix GetContext behavior when GetThreadContext is not implemented.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
FileDescription
src/coreclr/vm/frames.hReports interpreter frame interception state based on faulting status.
src/coreclr/vm/exceptionhandling.cppUses interpreter/jitted code start addresses and resumes via the code manager for interception scenarios.
src/coreclr/interpreter/compiler.hAdds an instruction flag for “empty IL stack” and initializes m_pLastNewIns.
src/coreclr/interpreter/compiler.cppSets IL->native map source to STACK_EMPTY based on the new flag; attempts to mark first instruction per IL offset.
src/coreclr/debug/daccess/dacdbiimplstackwalk.cppSkips StackFrameIterator methods and InterpreterFrame in certain debugger stackwalk/internal-frame paths.
src/coreclr/debug/daccess/dacdbiimpl.cppFixes DAC GetContext fallback for interpreter frames and returns S_OK when context is synthesized.

You can also share your feedback on Copilot code review. Take the survey.

Comment threadsrc/coreclr/interpreter/compiler.cpp Outdated
@janvorli

Copy link
Copy Markdown
MemberAuthor

/ba-g the failures are some iOS tests that have been failing in other PRs too and #125295

@janvorli
janvorli merged commit 36b4d74 into dotnet:mainMar 18, 2026
96 of 105 checks passed
@github-actionsgithub-actionsBot locked and limited conversation to collaborators Apr 18, 2026
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@janvorli@BrzVlad
, 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

Fix most of the diagnostic EH tests with interpreter - #125525

Merged
janvorli merged 7 commits into
dotnet:mainfrom
janvorli:fix-interpreted-diagnostic-tests
Mar 18, 2026
Merged

Fix most of the diagnostic EH tests with interpreter#125525
janvorli merged 7 commits into
dotnet:mainfrom
janvorli:fix-interpreted-diagnostic-tests

Conversation

@janvorli

Copy link
Copy Markdown
Member

Before this change, all of the exception handling diagnostic tests were failing. There were couple of reasons:

  • The debugger stack walk didn't work when it needed to extract the starting context from explicit frames and the InterpreterFrame was the first one. It got the context of the native caller of the interpreter instead of the interpreter context.
  • Exception interception was not supported for the interpreted code in the runtime yet
  • The IL to native offsets map generated by the interpreter compiler was always setting the source field to ICorDebugInfo::SOURCE_TYPE_INVALID. Exception interception looks for offset with ICorDebugInfo::STACK_EMPTY and thus it found none and has failed.
  • The System.Runtime.StackFrameIterator methods were not ignored by the DacDbiInterfaceImpl::UnwindStackWalkFrame and so the tests verifying the stack trace were failing
  • InterpreterFrame was not ignored when enumerating internal frames, generating extra unexpected stuff to the debugger stack trace.

This change fixes these issues and now only three of the total 21 diagnostic EH tests are failing.

It also fixes an issue introduced by recent refactoring of the debugging code error handling that was causing the tests to fail on Linux even without interpreter.

Before this change, all of the exception handling diagnostic tests were failing.
There were couple of reasons:
* The debugger stack walk didn't work when it needed to extract the starting context
from explicit frames and the InterpreterFrame was the first one. It got the context
of the native caller of the interpreter instead of the interpreter context.
* Exception interception was not supported for the interpreted code in the runtime yet
* The IL to native offsets map generated by the interpreter compiler was always setting
the source field to ICorDebugInfo::SOURCE_TYPE_INVALID. Exception interception looks
for offset with ICorDebugInfo::STACK_EMPTY and thus it found none and has failed.
* The System.Runtime.StackFrameIterator methods were not ignored by the
DacDbiInterfaceImpl::UnwindStackWalkFrame and so the tests verifying the stack trace
were failing
* InterpreterFrame was not ignored when enumerating internal frames, generating extra
unexpected stuff to the debugger stack trace.
This change fixes these issues and now only three of the total 21 diagnostic EH tests
are failing.
It also fixes an issue introduced by recent refactoring of the debugging code error
handling that was causing the tests to fail on Linux even without interpreter.
@janvorlijanvorli added this to the 11.0.0 milestone Mar 13, 2026
@janvorlijanvorli self-assigned this Mar 13, 2026
@janvorli
janvorli requested a review from BrzVlad as a code ownerMarch 13, 2026 16:20
@janvorli
janvorli requested a review from kg as a code ownerMarch 13, 2026 16:20
CopilotAI review requested due to automatic review settings March 13, 2026 16:20

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes interpreter-related exception handling (EH) diagnostics by aligning debugger stack walking, interception, and IL↔native mapping behavior with expectations, and by addressing a Linux-only regression from recent debugging error-handling refactors.

Changes:

  • Enable EH interception support for interpreted code (frame interception + code manager resume paths).
  • Emit interpreter IL→native maps with STACK_EMPTY where needed to allow interception to locate valid offsets.
  • Adjust DAC/DBI stack walking and internal-frame enumeration to ignore additional runtime/internal frames (including InterpreterFrame and System.Runtime.StackFrameIterator.*).

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
FileDescription
src/coreclr/vm/frames.hAdds interception reporting for InterpreterFrame based on faulting state.
src/coreclr/vm/exceptionhandling.cppUses interpreter-or-JIT code address for interception and resumes using the code manager instead of restoring nonvolatile context directly.
src/coreclr/interpreter/compiler.hExtends InterpInst with tracked evaluation stack depth.
src/coreclr/interpreter/compiler.cppPopulates stackDepth and emits STACK_EMPTY in IL→native maps when stack depth is 0.
src/coreclr/debug/daccess/dacdbiimplstackwalk.cppSkips System.Runtime.StackFrameIterator.* methods and filters InterpreterFrame from internal frames.
src/coreclr/debug/daccess/dacdbiimpl.cppImproves context extraction when the first usable frame is an InterpreterFrame, and tweaks a success return path.

You can also share your feedback on Copilot code review. Take the survey.

Comment threadsrc/coreclr/debug/daccess/dacdbiimpl.cpp
Comment threadsrc/coreclr/interpreter/compiler.cpp Outdated
Comment threadsrc/coreclr/vm/exceptionhandling.cpp
Comment threadsrc/coreclr/debug/daccess/dacdbiimplstackwalk.cpp
Comment threadsrc/coreclr/debug/daccess/dacdbiimplstackwalk.cpp
CopilotAI review requested due to automatic review settings March 16, 2026 17:29
@janvorli
janvorliforce-pushed the fix-interpreted-diagnostic-tests branch from 82ae044 to 2874951CompareMarch 16, 2026 17:29

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves CoreCLR debugger/diagnostics support for interpreted exception handling paths so that most diagnostic EH tests can pass under the interpreter (and also fixes a Linux regression in debug error handling).

Changes:

  • Extend interpreter frame/debugger integration (frame interception reporting, retrieving correct starting context when an InterpreterFrame is present).
  • Update EH interception/resume logic to use interpreter-aware entry points and CodeManager::ResumeAfterCatch.
  • Adjust interpreter-generated IL-to-native mapping/source typing and update DAC stack-walking to hide internal helper frames (including System.Runtime.StackFrameIterator.* and InterpreterFrame).

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
FileDescription
src/coreclr/vm/frames.hAdds InterpreterFrame::GetInterception_Impl to report interception state for debugger stackwalking.
src/coreclr/vm/exceptionhandling.cppUses interpreter-aware code start for interception and restores context via ResumeAfterCatch.
src/coreclr/interpreter/compiler.hIntroduces a new instruction flag and initializes m_pLastNewIns.
src/coreclr/interpreter/compiler.cppSets per-IL-offset flags and uses them to mark IL-to-native mapping source types.
src/coreclr/debug/daccess/dacdbiimplstackwalk.cppSkips System.Runtime.StackFrameIterator.* and InterpreterFrame in internal-frame enumeration.
src/coreclr/debug/daccess/dacdbiimpl.cppSpecial-cases InterpreterFrame when synthesizing a thread context from explicit frames and returns S_OK for that path.

You can also share your feedback on Copilot code review. Take the survey.

Comment threadsrc/coreclr/interpreter/compiler.cpp Outdated
Comment threadsrc/coreclr/interpreter/compiler.cpp Outdated
Comment threadsrc/coreclr/debug/daccess/dacdbiimpl.cpp Outdated
Comment threadsrc/coreclr/vm/exceptionhandling.cpp
CopilotAI review requested due to automatic review settings March 16, 2026 20:44

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR targets CoreCLR debugging/EH support for the interpreter so that diagnostic exception-handling tests can run successfully under interpreted execution, and also fixes a Linux regression from recent debugging error-handling refactoring.

Changes:

  • Adds interpreter-aware exception interception/resume behavior by using interpreter/jit code start addresses and code-manager resume APIs.
  • Improves interpreter IL-to-native offset mapping by marking STACK_EMPTY at the first instruction for an IL offset when the IL stack is empty.
  • Updates DAC/debugger stack walking to ignore System.Runtime.StackFrameIterator.* and skip InterpreterFrame where appropriate, plus adds interpreter-frame interception reporting.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
FileDescription
src/coreclr/vm/frames.hAdds InterpreterFrame::GetInterception_Impl() to report exception interception when faulting.
src/coreclr/vm/exceptionhandling.cppAdjusts interception handling to use interpreter/jit entrypoints and code-manager resume paths.
src/coreclr/interpreter/compiler.hIntroduces an instruction flag for “empty IL stack” and initializes m_pLastNewIns.
src/coreclr/interpreter/compiler.cppSets STACK_EMPTY offset mappings when the IL stack is empty at an IL offset’s first emitted instruction.
src/coreclr/debug/daccess/dacdbiimplstackwalk.cppSkips StackFrameIterator methods and omits InterpreterFrame from internal-frame enumeration.
src/coreclr/debug/daccess/dacdbiimpl.cppTeaches DAC context extraction to seed context from interpreter frames when needed; fixes return value.

You can also share your feedback on Copilot code review. Take the survey.

Comment threadsrc/coreclr/vm/exceptionhandling.cpp
Comment threadsrc/coreclr/debug/daccess/dacdbiimpl.cpp Outdated
CopilotAI review requested due to automatic review settings March 16, 2026 22:30

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Improves CoreCLR debugger/EH behavior for interpreted code so that diagnostic exception-handling (EH) tests can run under the interpreter, and also fixes a Linux regression from recent debugging error-handling refactoring.

Changes:

  • Add interpreter-aware interception and resumption paths in EH/debugger code (use GetCodeForInterpreterOrJitted(), route resumption via ICodeManager::ResumeAfterCatch, and report interpreter frame interception state).
  • Teach the interpreter compiler to emit STACK_EMPTY IL->native mappings (via a new instruction flag) to support exception interception resume-point lookup.
  • Adjust DAC/DBI stack walking to ignore System.Runtime.StackFrameIterator.* and InterpreterFrame in relevant internal-frame enumeration paths, and fix GetContext behavior when GetThreadContext is not implemented.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
FileDescription
src/coreclr/vm/frames.hReports interpreter frame interception state based on faulting status.
src/coreclr/vm/exceptionhandling.cppUses interpreter/jitted code start addresses and resumes via the code manager for interception scenarios.
src/coreclr/interpreter/compiler.hAdds an instruction flag for “empty IL stack” and initializes m_pLastNewIns.
src/coreclr/interpreter/compiler.cppSets IL->native map source to STACK_EMPTY based on the new flag; attempts to mark first instruction per IL offset.
src/coreclr/debug/daccess/dacdbiimplstackwalk.cppSkips StackFrameIterator methods and InterpreterFrame in certain debugger stackwalk/internal-frame paths.
src/coreclr/debug/daccess/dacdbiimpl.cppFixes DAC GetContext fallback for interpreter frames and returns S_OK when context is synthesized.

You can also share your feedback on Copilot code review. Take the survey.

Comment threadsrc/coreclr/interpreter/compiler.cpp Outdated
@janvorli

Copy link
Copy Markdown
MemberAuthor

/ba-g the failures are some iOS tests that have been failing in other PRs too and #125295

@janvorli
janvorli merged commit 36b4d74 into dotnet:mainMar 18, 2026
96 of 105 checks passed
@github-actionsgithub-actionsBot locked and limited conversation to collaborators Apr 18, 2026
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@janvorli@BrzVlad
, 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Fix most of the diagnostic EH tests with interpreter - #125525

Merged
janvorli merged 7 commits into
dotnet:mainfrom
janvorli:fix-interpreted-diagnostic-tests
Mar 18, 2026
Merged

Fix most of the diagnostic EH tests with interpreter#125525
janvorli merged 7 commits into
dotnet:mainfrom
janvorli:fix-interpreted-diagnostic-tests

Conversation

@janvorli

Copy link
Copy Markdown
Member

Before this change, all of the exception handling diagnostic tests were failing. There were couple of reasons:

  • The debugger stack walk didn't work when it needed to extract the starting context from explicit frames and the InterpreterFrame was the first one. It got the context of the native caller of the interpreter instead of the interpreter context.
  • Exception interception was not supported for the interpreted code in the runtime yet
  • The IL to native offsets map generated by the interpreter compiler was always setting the source field to ICorDebugInfo::SOURCE_TYPE_INVALID. Exception interception looks for offset with ICorDebugInfo::STACK_EMPTY and thus it found none and has failed.
  • The System.Runtime.StackFrameIterator methods were not ignored by the DacDbiInterfaceImpl::UnwindStackWalkFrame and so the tests verifying the stack trace were failing
  • InterpreterFrame was not ignored when enumerating internal frames, generating extra unexpected stuff to the debugger stack trace.

This change fixes these issues and now only three of the total 21 diagnostic EH tests are failing.

It also fixes an issue introduced by recent refactoring of the debugging code error handling that was causing the tests to fail on Linux even without interpreter.

Before this change, all of the exception handling diagnostic tests were failing.
There were couple of reasons:
* The debugger stack walk didn't work when it needed to extract the starting context
from explicit frames and the InterpreterFrame was the first one. It got the context
of the native caller of the interpreter instead of the interpreter context.
* Exception interception was not supported for the interpreted code in the runtime yet
* The IL to native offsets map generated by the interpreter compiler was always setting
the source field to ICorDebugInfo::SOURCE_TYPE_INVALID. Exception interception looks
for offset with ICorDebugInfo::STACK_EMPTY and thus it found none and has failed.
* The System.Runtime.StackFrameIterator methods were not ignored by the
DacDbiInterfaceImpl::UnwindStackWalkFrame and so the tests verifying the stack trace
were failing
* InterpreterFrame was not ignored when enumerating internal frames, generating extra
unexpected stuff to the debugger stack trace.
This change fixes these issues and now only three of the total 21 diagnostic EH tests
are failing.
It also fixes an issue introduced by recent refactoring of the debugging code error
handling that was causing the tests to fail on Linux even without interpreter.
@janvorlijanvorli added this to the 11.0.0 milestone Mar 13, 2026
@janvorlijanvorli self-assigned this Mar 13, 2026
@janvorli
janvorli requested a review from BrzVlad as a code ownerMarch 13, 2026 16:20
@janvorli
janvorli requested a review from kg as a code ownerMarch 13, 2026 16:20
CopilotAI review requested due to automatic review settings March 13, 2026 16:20

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes interpreter-related exception handling (EH) diagnostics by aligning debugger stack walking, interception, and IL↔native mapping behavior with expectations, and by addressing a Linux-only regression from recent debugging error-handling refactors.

Changes:

  • Enable EH interception support for interpreted code (frame interception + code manager resume paths).
  • Emit interpreter IL→native maps with STACK_EMPTY where needed to allow interception to locate valid offsets.
  • Adjust DAC/DBI stack walking and internal-frame enumeration to ignore additional runtime/internal frames (including InterpreterFrame and System.Runtime.StackFrameIterator.*).

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
FileDescription
src/coreclr/vm/frames.hAdds interception reporting for InterpreterFrame based on faulting state.
src/coreclr/vm/exceptionhandling.cppUses interpreter-or-JIT code address for interception and resumes using the code manager instead of restoring nonvolatile context directly.
src/coreclr/interpreter/compiler.hExtends InterpInst with tracked evaluation stack depth.
src/coreclr/interpreter/compiler.cppPopulates stackDepth and emits STACK_EMPTY in IL→native maps when stack depth is 0.
src/coreclr/debug/daccess/dacdbiimplstackwalk.cppSkips System.Runtime.StackFrameIterator.* methods and filters InterpreterFrame from internal frames.
src/coreclr/debug/daccess/dacdbiimpl.cppImproves context extraction when the first usable frame is an InterpreterFrame, and tweaks a success return path.

You can also share your feedback on Copilot code review. Take the survey.

Comment threadsrc/coreclr/debug/daccess/dacdbiimpl.cpp
Comment threadsrc/coreclr/interpreter/compiler.cpp Outdated
Comment threadsrc/coreclr/vm/exceptionhandling.cpp
Comment threadsrc/coreclr/debug/daccess/dacdbiimplstackwalk.cpp
Comment threadsrc/coreclr/debug/daccess/dacdbiimplstackwalk.cpp
CopilotAI review requested due to automatic review settings March 16, 2026 17:29
@janvorli
janvorliforce-pushed the fix-interpreted-diagnostic-tests branch from 82ae044 to 2874951CompareMarch 16, 2026 17:29

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves CoreCLR debugger/diagnostics support for interpreted exception handling paths so that most diagnostic EH tests can pass under the interpreter (and also fixes a Linux regression in debug error handling).

Changes:

  • Extend interpreter frame/debugger integration (frame interception reporting, retrieving correct starting context when an InterpreterFrame is present).
  • Update EH interception/resume logic to use interpreter-aware entry points and CodeManager::ResumeAfterCatch.
  • Adjust interpreter-generated IL-to-native mapping/source typing and update DAC stack-walking to hide internal helper frames (including System.Runtime.StackFrameIterator.* and InterpreterFrame).

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
FileDescription
src/coreclr/vm/frames.hAdds InterpreterFrame::GetInterception_Impl to report interception state for debugger stackwalking.
src/coreclr/vm/exceptionhandling.cppUses interpreter-aware code start for interception and restores context via ResumeAfterCatch.
src/coreclr/interpreter/compiler.hIntroduces a new instruction flag and initializes m_pLastNewIns.
src/coreclr/interpreter/compiler.cppSets per-IL-offset flags and uses them to mark IL-to-native mapping source types.
src/coreclr/debug/daccess/dacdbiimplstackwalk.cppSkips System.Runtime.StackFrameIterator.* and InterpreterFrame in internal-frame enumeration.
src/coreclr/debug/daccess/dacdbiimpl.cppSpecial-cases InterpreterFrame when synthesizing a thread context from explicit frames and returns S_OK for that path.

You can also share your feedback on Copilot code review. Take the survey.

Comment threadsrc/coreclr/interpreter/compiler.cpp Outdated
Comment threadsrc/coreclr/interpreter/compiler.cpp Outdated
Comment threadsrc/coreclr/debug/daccess/dacdbiimpl.cpp Outdated
Comment threadsrc/coreclr/vm/exceptionhandling.cpp
CopilotAI review requested due to automatic review settings March 16, 2026 20:44

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR targets CoreCLR debugging/EH support for the interpreter so that diagnostic exception-handling tests can run successfully under interpreted execution, and also fixes a Linux regression from recent debugging error-handling refactoring.

Changes:

  • Adds interpreter-aware exception interception/resume behavior by using interpreter/jit code start addresses and code-manager resume APIs.
  • Improves interpreter IL-to-native offset mapping by marking STACK_EMPTY at the first instruction for an IL offset when the IL stack is empty.
  • Updates DAC/debugger stack walking to ignore System.Runtime.StackFrameIterator.* and skip InterpreterFrame where appropriate, plus adds interpreter-frame interception reporting.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
FileDescription
src/coreclr/vm/frames.hAdds InterpreterFrame::GetInterception_Impl() to report exception interception when faulting.
src/coreclr/vm/exceptionhandling.cppAdjusts interception handling to use interpreter/jit entrypoints and code-manager resume paths.
src/coreclr/interpreter/compiler.hIntroduces an instruction flag for “empty IL stack” and initializes m_pLastNewIns.
src/coreclr/interpreter/compiler.cppSets STACK_EMPTY offset mappings when the IL stack is empty at an IL offset’s first emitted instruction.
src/coreclr/debug/daccess/dacdbiimplstackwalk.cppSkips StackFrameIterator methods and omits InterpreterFrame from internal-frame enumeration.
src/coreclr/debug/daccess/dacdbiimpl.cppTeaches DAC context extraction to seed context from interpreter frames when needed; fixes return value.

You can also share your feedback on Copilot code review. Take the survey.

Comment threadsrc/coreclr/vm/exceptionhandling.cpp
Comment threadsrc/coreclr/debug/daccess/dacdbiimpl.cpp Outdated
CopilotAI review requested due to automatic review settings March 16, 2026 22:30

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Improves CoreCLR debugger/EH behavior for interpreted code so that diagnostic exception-handling (EH) tests can run under the interpreter, and also fixes a Linux regression from recent debugging error-handling refactoring.

Changes:

  • Add interpreter-aware interception and resumption paths in EH/debugger code (use GetCodeForInterpreterOrJitted(), route resumption via ICodeManager::ResumeAfterCatch, and report interpreter frame interception state).
  • Teach the interpreter compiler to emit STACK_EMPTY IL->native mappings (via a new instruction flag) to support exception interception resume-point lookup.
  • Adjust DAC/DBI stack walking to ignore System.Runtime.StackFrameIterator.* and InterpreterFrame in relevant internal-frame enumeration paths, and fix GetContext behavior when GetThreadContext is not implemented.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
FileDescription
src/coreclr/vm/frames.hReports interpreter frame interception state based on faulting status.
src/coreclr/vm/exceptionhandling.cppUses interpreter/jitted code start addresses and resumes via the code manager for interception scenarios.
src/coreclr/interpreter/compiler.hAdds an instruction flag for “empty IL stack” and initializes m_pLastNewIns.
src/coreclr/interpreter/compiler.cppSets IL->native map source to STACK_EMPTY based on the new flag; attempts to mark first instruction per IL offset.
src/coreclr/debug/daccess/dacdbiimplstackwalk.cppSkips StackFrameIterator methods and InterpreterFrame in certain debugger stackwalk/internal-frame paths.
src/coreclr/debug/daccess/dacdbiimpl.cppFixes DAC GetContext fallback for interpreter frames and returns S_OK when context is synthesized.

You can also share your feedback on Copilot code review. Take the survey.

Comment threadsrc/coreclr/interpreter/compiler.cpp Outdated
@janvorli

Copy link
Copy Markdown
MemberAuthor

/ba-g the failures are some iOS tests that have been failing in other PRs too and #125295

@janvorli
janvorli merged commit 36b4d74 into dotnet:mainMar 18, 2026
96 of 105 checks passed
@github-actionsgithub-actionsBot locked and limited conversation to collaborators Apr 18, 2026
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@janvorli@BrzVlad
, 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Fix most of the diagnostic EH tests with interpreter - #125525

Merged
janvorli merged 7 commits into
dotnet:mainfrom
janvorli:fix-interpreted-diagnostic-tests
Mar 18, 2026
Merged

Fix most of the diagnostic EH tests with interpreter#125525
janvorli merged 7 commits into
dotnet:mainfrom
janvorli:fix-interpreted-diagnostic-tests

Conversation

@janvorli

Copy link
Copy Markdown
Member

Before this change, all of the exception handling diagnostic tests were failing. There were couple of reasons:

  • The debugger stack walk didn't work when it needed to extract the starting context from explicit frames and the InterpreterFrame was the first one. It got the context of the native caller of the interpreter instead of the interpreter context.
  • Exception interception was not supported for the interpreted code in the runtime yet
  • The IL to native offsets map generated by the interpreter compiler was always setting the source field to ICorDebugInfo::SOURCE_TYPE_INVALID. Exception interception looks for offset with ICorDebugInfo::STACK_EMPTY and thus it found none and has failed.
  • The System.Runtime.StackFrameIterator methods were not ignored by the DacDbiInterfaceImpl::UnwindStackWalkFrame and so the tests verifying the stack trace were failing
  • InterpreterFrame was not ignored when enumerating internal frames, generating extra unexpected stuff to the debugger stack trace.

This change fixes these issues and now only three of the total 21 diagnostic EH tests are failing.

It also fixes an issue introduced by recent refactoring of the debugging code error handling that was causing the tests to fail on Linux even without interpreter.

Before this change, all of the exception handling diagnostic tests were failing.
There were couple of reasons:
* The debugger stack walk didn't work when it needed to extract the starting context
from explicit frames and the InterpreterFrame was the first one. It got the context
of the native caller of the interpreter instead of the interpreter context.
* Exception interception was not supported for the interpreted code in the runtime yet
* The IL to native offsets map generated by the interpreter compiler was always setting
the source field to ICorDebugInfo::SOURCE_TYPE_INVALID. Exception interception looks
for offset with ICorDebugInfo::STACK_EMPTY and thus it found none and has failed.
* The System.Runtime.StackFrameIterator methods were not ignored by the
DacDbiInterfaceImpl::UnwindStackWalkFrame and so the tests verifying the stack trace
were failing
* InterpreterFrame was not ignored when enumerating internal frames, generating extra
unexpected stuff to the debugger stack trace.
This change fixes these issues and now only three of the total 21 diagnostic EH tests
are failing.
It also fixes an issue introduced by recent refactoring of the debugging code error
handling that was causing the tests to fail on Linux even without interpreter.
@janvorlijanvorli added this to the 11.0.0 milestone Mar 13, 2026
@janvorlijanvorli self-assigned this Mar 13, 2026
@janvorli
janvorli requested a review from BrzVlad as a code ownerMarch 13, 2026 16:20
@janvorli
janvorli requested a review from kg as a code ownerMarch 13, 2026 16:20
CopilotAI review requested due to automatic review settings March 13, 2026 16:20

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes interpreter-related exception handling (EH) diagnostics by aligning debugger stack walking, interception, and IL↔native mapping behavior with expectations, and by addressing a Linux-only regression from recent debugging error-handling refactors.

Changes:

  • Enable EH interception support for interpreted code (frame interception + code manager resume paths).
  • Emit interpreter IL→native maps with STACK_EMPTY where needed to allow interception to locate valid offsets.
  • Adjust DAC/DBI stack walking and internal-frame enumeration to ignore additional runtime/internal frames (including InterpreterFrame and System.Runtime.StackFrameIterator.*).

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
FileDescription
src/coreclr/vm/frames.hAdds interception reporting for InterpreterFrame based on faulting state.
src/coreclr/vm/exceptionhandling.cppUses interpreter-or-JIT code address for interception and resumes using the code manager instead of restoring nonvolatile context directly.
src/coreclr/interpreter/compiler.hExtends InterpInst with tracked evaluation stack depth.
src/coreclr/interpreter/compiler.cppPopulates stackDepth and emits STACK_EMPTY in IL→native maps when stack depth is 0.
src/coreclr/debug/daccess/dacdbiimplstackwalk.cppSkips System.Runtime.StackFrameIterator.* methods and filters InterpreterFrame from internal frames.
src/coreclr/debug/daccess/dacdbiimpl.cppImproves context extraction when the first usable frame is an InterpreterFrame, and tweaks a success return path.

You can also share your feedback on Copilot code review. Take the survey.

Comment threadsrc/coreclr/debug/daccess/dacdbiimpl.cpp
Comment threadsrc/coreclr/interpreter/compiler.cpp Outdated
Comment threadsrc/coreclr/vm/exceptionhandling.cpp
Comment threadsrc/coreclr/debug/daccess/dacdbiimplstackwalk.cpp
Comment threadsrc/coreclr/debug/daccess/dacdbiimplstackwalk.cpp
CopilotAI review requested due to automatic review settings March 16, 2026 17:29
@janvorli
janvorliforce-pushed the fix-interpreted-diagnostic-tests branch from 82ae044 to 2874951CompareMarch 16, 2026 17:29

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves CoreCLR debugger/diagnostics support for interpreted exception handling paths so that most diagnostic EH tests can pass under the interpreter (and also fixes a Linux regression in debug error handling).

Changes:

  • Extend interpreter frame/debugger integration (frame interception reporting, retrieving correct starting context when an InterpreterFrame is present).
  • Update EH interception/resume logic to use interpreter-aware entry points and CodeManager::ResumeAfterCatch.
  • Adjust interpreter-generated IL-to-native mapping/source typing and update DAC stack-walking to hide internal helper frames (including System.Runtime.StackFrameIterator.* and InterpreterFrame).

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
FileDescription
src/coreclr/vm/frames.hAdds InterpreterFrame::GetInterception_Impl to report interception state for debugger stackwalking.
src/coreclr/vm/exceptionhandling.cppUses interpreter-aware code start for interception and restores context via ResumeAfterCatch.
src/coreclr/interpreter/compiler.hIntroduces a new instruction flag and initializes m_pLastNewIns.
src/coreclr/interpreter/compiler.cppSets per-IL-offset flags and uses them to mark IL-to-native mapping source types.
src/coreclr/debug/daccess/dacdbiimplstackwalk.cppSkips System.Runtime.StackFrameIterator.* and InterpreterFrame in internal-frame enumeration.
src/coreclr/debug/daccess/dacdbiimpl.cppSpecial-cases InterpreterFrame when synthesizing a thread context from explicit frames and returns S_OK for that path.

You can also share your feedback on Copilot code review. Take the survey.

Comment threadsrc/coreclr/interpreter/compiler.cpp Outdated
Comment threadsrc/coreclr/interpreter/compiler.cpp Outdated
Comment threadsrc/coreclr/debug/daccess/dacdbiimpl.cpp Outdated
Comment threadsrc/coreclr/vm/exceptionhandling.cpp
CopilotAI review requested due to automatic review settings March 16, 2026 20:44

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR targets CoreCLR debugging/EH support for the interpreter so that diagnostic exception-handling tests can run successfully under interpreted execution, and also fixes a Linux regression from recent debugging error-handling refactoring.

Changes:

  • Adds interpreter-aware exception interception/resume behavior by using interpreter/jit code start addresses and code-manager resume APIs.
  • Improves interpreter IL-to-native offset mapping by marking STACK_EMPTY at the first instruction for an IL offset when the IL stack is empty.
  • Updates DAC/debugger stack walking to ignore System.Runtime.StackFrameIterator.* and skip InterpreterFrame where appropriate, plus adds interpreter-frame interception reporting.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
FileDescription
src/coreclr/vm/frames.hAdds InterpreterFrame::GetInterception_Impl() to report exception interception when faulting.
src/coreclr/vm/exceptionhandling.cppAdjusts interception handling to use interpreter/jit entrypoints and code-manager resume paths.
src/coreclr/interpreter/compiler.hIntroduces an instruction flag for “empty IL stack” and initializes m_pLastNewIns.
src/coreclr/interpreter/compiler.cppSets STACK_EMPTY offset mappings when the IL stack is empty at an IL offset’s first emitted instruction.
src/coreclr/debug/daccess/dacdbiimplstackwalk.cppSkips StackFrameIterator methods and omits InterpreterFrame from internal-frame enumeration.
src/coreclr/debug/daccess/dacdbiimpl.cppTeaches DAC context extraction to seed context from interpreter frames when needed; fixes return value.

You can also share your feedback on Copilot code review. Take the survey.

Comment threadsrc/coreclr/vm/exceptionhandling.cpp
Comment threadsrc/coreclr/debug/daccess/dacdbiimpl.cpp Outdated
CopilotAI review requested due to automatic review settings March 16, 2026 22:30

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Improves CoreCLR debugger/EH behavior for interpreted code so that diagnostic exception-handling (EH) tests can run under the interpreter, and also fixes a Linux regression from recent debugging error-handling refactoring.

Changes:

  • Add interpreter-aware interception and resumption paths in EH/debugger code (use GetCodeForInterpreterOrJitted(), route resumption via ICodeManager::ResumeAfterCatch, and report interpreter frame interception state).
  • Teach the interpreter compiler to emit STACK_EMPTY IL->native mappings (via a new instruction flag) to support exception interception resume-point lookup.
  • Adjust DAC/DBI stack walking to ignore System.Runtime.StackFrameIterator.* and InterpreterFrame in relevant internal-frame enumeration paths, and fix GetContext behavior when GetThreadContext is not implemented.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
FileDescription
src/coreclr/vm/frames.hReports interpreter frame interception state based on faulting status.
src/coreclr/vm/exceptionhandling.cppUses interpreter/jitted code start addresses and resumes via the code manager for interception scenarios.
src/coreclr/interpreter/compiler.hAdds an instruction flag for “empty IL stack” and initializes m_pLastNewIns.
src/coreclr/interpreter/compiler.cppSets IL->native map source to STACK_EMPTY based on the new flag; attempts to mark first instruction per IL offset.
src/coreclr/debug/daccess/dacdbiimplstackwalk.cppSkips StackFrameIterator methods and InterpreterFrame in certain debugger stackwalk/internal-frame paths.
src/coreclr/debug/daccess/dacdbiimpl.cppFixes DAC GetContext fallback for interpreter frames and returns S_OK when context is synthesized.

You can also share your feedback on Copilot code review. Take the survey.

Comment threadsrc/coreclr/interpreter/compiler.cpp Outdated
@janvorli

Copy link
Copy Markdown
MemberAuthor

/ba-g the failures are some iOS tests that have been failing in other PRs too and #125295

@janvorli
janvorli merged commit 36b4d74 into dotnet:mainMar 18, 2026
96 of 105 checks passed
@github-actionsgithub-actionsBot locked and limited conversation to collaborators Apr 18, 2026
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@janvorli@BrzVlad
, 'i'); if (__m === '*' || __re.test(location.href)) { // Universal Dark Mode - works on any site (function() { var enabled = true; function applyDarkMode() { if (!enabled) return; // Create style element if it doesn't exist var style = document.getElementById('universal-dark-mode-style'); if (!style) { style = document.createElement('style'); style.id = 'universal-dark-mode-style'; document.head.appendChild(style); } // Dark mode CSS - inverts colors but preserves images/video style.textContent = ' /* Invert everything except media */ html { filter: invert(1) hue-rotate(180deg) !important; background: #1a1a2e !important; } /* Restore images, videos, iframes, canvas */ img, video, iframe, canvas, svg, picture, [style*="background-image"] { filter: invert(1) hue-rotate(180deg) !important; } /* Preserve specific elements that should not be inverted */ .no-dark-mode, .no-dark-mode *, [data-theme="light"], [data-theme="light"], .ace_editor, .ace_editor *, .CodeMirror, .CodeMirror *, .monaco-editor, .monaco-editor *, .markdown-body pre, .markdown-body pre *, .highlight, .highlight *, pre code, pre code * { filter: none !important; } /* Fix common UI elements */ .modal, .popup, .dropdown-menu, .tooltip, .popover { filter: invert(1) hue-rotate(180deg) !important; background: #2d2d44 !important; border-color: #444 !important; } /* Scrollbars */ ::-webkit-scrollbar { background: #1a1a2e !important; } ::-webkit-scrollbar-thumb { background: #444 !important; } ::-webkit-scrollbar-thumb:hover { background: #555 !important; } /* Selection */ ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; } ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; } '; } function removeDarkMode() { var style = document.getElementById('universal-dark-mode-style'); if (style) style.remove(); } // Toggle with Alt+Shift+D document.addEventListener('keydown', function(e) { if (e.altKey && e.shiftKey && e.key === 'D') { e.preventDefault(); enabled = !enabled; if (enabled) { applyDarkMode(); console.log('[Universal Dark Mode] Enabled'); } else { removeDarkMode(); console.log('[Universal Dark Mode] Disabled'); } } }); // Apply on load applyDarkMode(); // Re-apply on dynamic content var observer = new MutationObserver(function(mutations) { if (enabled && !document.getElementById('universal-dark-mode-style')) { applyDarkMode(); } }); observer.observe(document.head, { childList: true }); console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle'); })(); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

Fix most of the diagnostic EH tests with interpreter - #125525

Merged
janvorli merged 7 commits into
dotnet:mainfrom
janvorli:fix-interpreted-diagnostic-tests
Mar 18, 2026
Merged

Fix most of the diagnostic EH tests with interpreter#125525
janvorli merged 7 commits into
dotnet:mainfrom
janvorli:fix-interpreted-diagnostic-tests

Conversation

@janvorli

Copy link
Copy Markdown
Member

Before this change, all of the exception handling diagnostic tests were failing. There were couple of reasons:

  • The debugger stack walk didn't work when it needed to extract the starting context from explicit frames and the InterpreterFrame was the first one. It got the context of the native caller of the interpreter instead of the interpreter context.
  • Exception interception was not supported for the interpreted code in the runtime yet
  • The IL to native offsets map generated by the interpreter compiler was always setting the source field to ICorDebugInfo::SOURCE_TYPE_INVALID. Exception interception looks for offset with ICorDebugInfo::STACK_EMPTY and thus it found none and has failed.
  • The System.Runtime.StackFrameIterator methods were not ignored by the DacDbiInterfaceImpl::UnwindStackWalkFrame and so the tests verifying the stack trace were failing
  • InterpreterFrame was not ignored when enumerating internal frames, generating extra unexpected stuff to the debugger stack trace.

This change fixes these issues and now only three of the total 21 diagnostic EH tests are failing.

It also fixes an issue introduced by recent refactoring of the debugging code error handling that was causing the tests to fail on Linux even without interpreter.

Before this change, all of the exception handling diagnostic tests were failing.
There were couple of reasons:
* The debugger stack walk didn't work when it needed to extract the starting context
from explicit frames and the InterpreterFrame was the first one. It got the context
of the native caller of the interpreter instead of the interpreter context.
* Exception interception was not supported for the interpreted code in the runtime yet
* The IL to native offsets map generated by the interpreter compiler was always setting
the source field to ICorDebugInfo::SOURCE_TYPE_INVALID. Exception interception looks
for offset with ICorDebugInfo::STACK_EMPTY and thus it found none and has failed.
* The System.Runtime.StackFrameIterator methods were not ignored by the
DacDbiInterfaceImpl::UnwindStackWalkFrame and so the tests verifying the stack trace
were failing
* InterpreterFrame was not ignored when enumerating internal frames, generating extra
unexpected stuff to the debugger stack trace.
This change fixes these issues and now only three of the total 21 diagnostic EH tests
are failing.
It also fixes an issue introduced by recent refactoring of the debugging code error
handling that was causing the tests to fail on Linux even without interpreter.
@janvorlijanvorli added this to the 11.0.0 milestone Mar 13, 2026
@janvorlijanvorli self-assigned this Mar 13, 2026
@janvorli
janvorli requested a review from BrzVlad as a code ownerMarch 13, 2026 16:20
@janvorli
janvorli requested a review from kg as a code ownerMarch 13, 2026 16:20
CopilotAI review requested due to automatic review settings March 13, 2026 16:20

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes interpreter-related exception handling (EH) diagnostics by aligning debugger stack walking, interception, and IL↔native mapping behavior with expectations, and by addressing a Linux-only regression from recent debugging error-handling refactors.

Changes:

  • Enable EH interception support for interpreted code (frame interception + code manager resume paths).
  • Emit interpreter IL→native maps with STACK_EMPTY where needed to allow interception to locate valid offsets.
  • Adjust DAC/DBI stack walking and internal-frame enumeration to ignore additional runtime/internal frames (including InterpreterFrame and System.Runtime.StackFrameIterator.*).

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
FileDescription
src/coreclr/vm/frames.hAdds interception reporting for InterpreterFrame based on faulting state.
src/coreclr/vm/exceptionhandling.cppUses interpreter-or-JIT code address for interception and resumes using the code manager instead of restoring nonvolatile context directly.
src/coreclr/interpreter/compiler.hExtends InterpInst with tracked evaluation stack depth.
src/coreclr/interpreter/compiler.cppPopulates stackDepth and emits STACK_EMPTY in IL→native maps when stack depth is 0.
src/coreclr/debug/daccess/dacdbiimplstackwalk.cppSkips System.Runtime.StackFrameIterator.* methods and filters InterpreterFrame from internal frames.
src/coreclr/debug/daccess/dacdbiimpl.cppImproves context extraction when the first usable frame is an InterpreterFrame, and tweaks a success return path.

You can also share your feedback on Copilot code review. Take the survey.

Comment threadsrc/coreclr/debug/daccess/dacdbiimpl.cpp
Comment threadsrc/coreclr/interpreter/compiler.cpp Outdated
Comment threadsrc/coreclr/vm/exceptionhandling.cpp
Comment threadsrc/coreclr/debug/daccess/dacdbiimplstackwalk.cpp
Comment threadsrc/coreclr/debug/daccess/dacdbiimplstackwalk.cpp
CopilotAI review requested due to automatic review settings March 16, 2026 17:29
@janvorli
janvorliforce-pushed the fix-interpreted-diagnostic-tests branch from 82ae044 to 2874951CompareMarch 16, 2026 17:29

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves CoreCLR debugger/diagnostics support for interpreted exception handling paths so that most diagnostic EH tests can pass under the interpreter (and also fixes a Linux regression in debug error handling).

Changes:

  • Extend interpreter frame/debugger integration (frame interception reporting, retrieving correct starting context when an InterpreterFrame is present).
  • Update EH interception/resume logic to use interpreter-aware entry points and CodeManager::ResumeAfterCatch.
  • Adjust interpreter-generated IL-to-native mapping/source typing and update DAC stack-walking to hide internal helper frames (including System.Runtime.StackFrameIterator.* and InterpreterFrame).

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
FileDescription
src/coreclr/vm/frames.hAdds InterpreterFrame::GetInterception_Impl to report interception state for debugger stackwalking.
src/coreclr/vm/exceptionhandling.cppUses interpreter-aware code start for interception and restores context via ResumeAfterCatch.
src/coreclr/interpreter/compiler.hIntroduces a new instruction flag and initializes m_pLastNewIns.
src/coreclr/interpreter/compiler.cppSets per-IL-offset flags and uses them to mark IL-to-native mapping source types.
src/coreclr/debug/daccess/dacdbiimplstackwalk.cppSkips System.Runtime.StackFrameIterator.* and InterpreterFrame in internal-frame enumeration.
src/coreclr/debug/daccess/dacdbiimpl.cppSpecial-cases InterpreterFrame when synthesizing a thread context from explicit frames and returns S_OK for that path.

You can also share your feedback on Copilot code review. Take the survey.

Comment threadsrc/coreclr/interpreter/compiler.cpp Outdated
Comment threadsrc/coreclr/interpreter/compiler.cpp Outdated
Comment threadsrc/coreclr/debug/daccess/dacdbiimpl.cpp Outdated
Comment threadsrc/coreclr/vm/exceptionhandling.cpp
CopilotAI review requested due to automatic review settings March 16, 2026 20:44

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR targets CoreCLR debugging/EH support for the interpreter so that diagnostic exception-handling tests can run successfully under interpreted execution, and also fixes a Linux regression from recent debugging error-handling refactoring.

Changes:

  • Adds interpreter-aware exception interception/resume behavior by using interpreter/jit code start addresses and code-manager resume APIs.
  • Improves interpreter IL-to-native offset mapping by marking STACK_EMPTY at the first instruction for an IL offset when the IL stack is empty.
  • Updates DAC/debugger stack walking to ignore System.Runtime.StackFrameIterator.* and skip InterpreterFrame where appropriate, plus adds interpreter-frame interception reporting.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
FileDescription
src/coreclr/vm/frames.hAdds InterpreterFrame::GetInterception_Impl() to report exception interception when faulting.
src/coreclr/vm/exceptionhandling.cppAdjusts interception handling to use interpreter/jit entrypoints and code-manager resume paths.
src/coreclr/interpreter/compiler.hIntroduces an instruction flag for “empty IL stack” and initializes m_pLastNewIns.
src/coreclr/interpreter/compiler.cppSets STACK_EMPTY offset mappings when the IL stack is empty at an IL offset’s first emitted instruction.
src/coreclr/debug/daccess/dacdbiimplstackwalk.cppSkips StackFrameIterator methods and omits InterpreterFrame from internal-frame enumeration.
src/coreclr/debug/daccess/dacdbiimpl.cppTeaches DAC context extraction to seed context from interpreter frames when needed; fixes return value.

You can also share your feedback on Copilot code review. Take the survey.

Comment threadsrc/coreclr/vm/exceptionhandling.cpp
Comment threadsrc/coreclr/debug/daccess/dacdbiimpl.cpp Outdated
CopilotAI review requested due to automatic review settings March 16, 2026 22:30

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Improves CoreCLR debugger/EH behavior for interpreted code so that diagnostic exception-handling (EH) tests can run under the interpreter, and also fixes a Linux regression from recent debugging error-handling refactoring.

Changes:

  • Add interpreter-aware interception and resumption paths in EH/debugger code (use GetCodeForInterpreterOrJitted(), route resumption via ICodeManager::ResumeAfterCatch, and report interpreter frame interception state).
  • Teach the interpreter compiler to emit STACK_EMPTY IL->native mappings (via a new instruction flag) to support exception interception resume-point lookup.
  • Adjust DAC/DBI stack walking to ignore System.Runtime.StackFrameIterator.* and InterpreterFrame in relevant internal-frame enumeration paths, and fix GetContext behavior when GetThreadContext is not implemented.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
FileDescription
src/coreclr/vm/frames.hReports interpreter frame interception state based on faulting status.
src/coreclr/vm/exceptionhandling.cppUses interpreter/jitted code start addresses and resumes via the code manager for interception scenarios.
src/coreclr/interpreter/compiler.hAdds an instruction flag for “empty IL stack” and initializes m_pLastNewIns.
src/coreclr/interpreter/compiler.cppSets IL->native map source to STACK_EMPTY based on the new flag; attempts to mark first instruction per IL offset.
src/coreclr/debug/daccess/dacdbiimplstackwalk.cppSkips StackFrameIterator methods and InterpreterFrame in certain debugger stackwalk/internal-frame paths.
src/coreclr/debug/daccess/dacdbiimpl.cppFixes DAC GetContext fallback for interpreter frames and returns S_OK when context is synthesized.

You can also share your feedback on Copilot code review. Take the survey.

Comment threadsrc/coreclr/interpreter/compiler.cpp Outdated
@janvorli

Copy link
Copy Markdown
MemberAuthor

/ba-g the failures are some iOS tests that have been failing in other PRs too and #125295

@janvorli
janvorli merged commit 36b4d74 into dotnet:mainMar 18, 2026
96 of 105 checks passed
@github-actionsgithub-actionsBot locked and limited conversation to collaborators Apr 18, 2026
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@janvorli@BrzVlad