Skip to content

Commit 2aba648

Browse files
tommcdonCopilot
andauthored
Fix x64 data breakpoint handling after CORINFO_HELP_ARRADDR_ST inlining (#127251)
After #126547, the WriteBarrier FCall was converted from native (FCall) to managed. This affected the debugger's unwind logic for data breakpoint handling (AdjustContextForJITHelpersForDebugger) resulting in the debugger to unwind into the JIT helper (CastHelpers.StelemRef) rather than user code. The fix adds a loop after the initial unwind that checks whether the landed-on frame belongs to the CastHelpers class and continues unwinding until it reaches user code. This only affects x64 data breakpoints, as x86 does a raw single-frame stack pop (restores EIP from ESP) rather than VirtualUnwindToFirstManagedCallFrame, so it was unaffected. ARM64 does not support data breakpoints. --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 2b16e8b commit 2aba648

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/coreclr/debug/ee/controller.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9709,7 +9709,8 @@ bool DebuggerContinuableExceptionBreakpoint::SendEvent(Thread *thread, bool fIpC
97099709
{
97109710
LOG((LF_CORDB, LL_INFO10000, "D::DDBP: HIT DATA BREAKPOINT INSIDE WRITE BARRIER...\n"));
97119711
DebuggerDataBreakpoint *pDataBreakpoint = new (interopsafe) DebuggerDataBreakpoint(thread);
9712-
pDataBreakpoint->AddAndActivateNativePatchForAddress((CORDB_ADDRESS_TYPE*)GetIP(&contextToAdjust), FramePointer::MakeFramePointer(GetFP(&contextToAdjust)), true, DPT_DEFAULT_TRACE_TYPE);
9712+
// Use LEAF_MOST_FRAME to bypass the frame pointer check in MatchPatch.
9713+
pDataBreakpoint->AddAndActivateNativePatchForAddress((CORDB_ADDRESS_TYPE*)GetIP(&contextToAdjust), LEAF_MOST_FRAME, true, DPT_DEFAULT_TRACE_TYPE);
97139714
}
97149715
else
97159716
{

0 commit comments

Comments
 (0)