Skip to content

Commit

Permalink
Avoid overwriting frame context in JIT_Patchpoint
Browse files Browse the repository at this point in the history
Hopefully will help with diagnosing dotnet#101060 once we get a new dump.
  • Loading branch information
jakobbotsch committed Apr 25, 2024
1 parent 127844c commit 738b8c7
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/coreclr/vm/jithelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5144,7 +5144,7 @@ void JIT_Patchpoint(int* counter, int ilOffset)
const int counterBump = g_pConfig->OSR_CounterBump();
*counter = counterBump;

#if _DEBUG
#ifdef _DEBUG
const int ppId = ppInfo->m_patchpointId;
#endif

Expand Down Expand Up @@ -5316,9 +5316,18 @@ void JIT_Patchpoint(int* counter, int ilOffset)
InitializeContext(pBuffer, contextFlags, &pFrameContext, &contextSize);
_ASSERTE(success);
#else // TARGET_WINDOWS && TARGET_AMD64

#ifdef _DEBUG
// Temporary change to avoid the frame context being overwritten after
// a crash after transition
pFrameContext = (CONTEXT*)_alloca(sizeof(CONTEXT) + 0x40000);
#else
CONTEXT frameContext;
frameContext.ContextFlags = CONTEXT_FULL;
pFrameContext = &frameContext;
#endif

pFrameContext->ContextFlags = CONTEXT_FULL;

#endif // TARGET_WINDOWS && TARGET_AMD64

// Find context for the original method
Expand Down

0 comments on commit 738b8c7

Please sign in to comment.