[clr-interp] Add initial CoreCLR interpreter func-eval support#126576
[clr-interp] Add initial CoreCLR interpreter func-eval support#126576matouskozak wants to merge 9 commits intodotnet:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds initial debugger func-eval support when the target thread is stopped in CoreCLR interpreter code, by avoiding native-context hijacking and instead running queued evals from the interpreter breakpoint path.
Changes:
- Adds a pending func-eval slot to the interpreter thread context and triggers execution after the breakpoint debugger callback returns.
- Extends
DebugInterface/Debuggerwith an interpreter-specific hook to execute pending evals. - Adjusts
FuncEvalSetup/DebuggerEvalinitialization to skip native-only setup (e.g., executable breakpoint segment allocation, SP alignment checks) for interpreter evals.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/coreclr/vm/interpexec.h | Adds InterpThreadContext::m_pPendingFuncEval storage for interpreter-thread func-evals. |
| src/coreclr/vm/interpexec.cpp | Executes pending interpreter func-evals from the INTOP_BREAKPOINT handler using a synthetic filter context. |
| src/coreclr/vm/dbginterface.h | Adds ExecutePendingInterpreterFuncEval(Thread*) to the debug interface under FEATURE_INTERPRETER. |
| src/coreclr/debug/ee/debugger.h | Declares the Debugger implementation of ExecutePendingInterpreterFuncEval. |
| src/coreclr/debug/ee/debugger.cpp | Implements pending-eval execution and updates FuncEvalSetup/DebuggerEval to support interpreter eval flow. |
|
Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag |
…ogic for clarity in DebuggerEval handling
…r-funceval # Conflicts: # src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Data/Frames/DebuggerEval.cs
…ec.h include - Restore m_bypassAddress/m_bypassOpcode in EX_CATCH before EX_RETHROW so bypass state is not corrupted if func-eval throws - Remove unused interpexec.h include from debugger.cpp (GetInterpThreadContext is declared on Thread, not in interpexec.h) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
| pThread->SetFilterContext(NULL); | ||
| pThreadContext->m_bypassAddress = savedBypassAddress; | ||
| pThreadContext->m_bypassOpcode = savedBypassOpcode; | ||
| EX_RETHROW; |
There was a problem hiding this comment.
Is this code ever reached ? I would imagine func evals should catch all exceptions and never crash the app.
There was a problem hiding this comment.
Looking at the code for funceval, while all exceptions from the funceval invocation are caught in FuncEvalHijackRealWorker, there are methods called after the funceval itself that are marked as THROWS, e.g. the Debugger::FuncEvalComplete. I am not sure what are all the exception kinds that can stem from there, but one of them is OOM.
There was a problem hiding this comment.
I'm wondering if it makes more sense to assert in checked build here rather than rethrowing, otherwise silently ignore the error. Seems wrong to have a function called from the debugger crash the app.
There was a problem hiding this comment.
It doesn't sound right to ignore OOM exceptions. Those would very likely kick in a bit later again anyways.
Description
This adds initial func-eval support for threads stopped in CoreCLR interpreter code.
Testing
Future Work
#125959