diff --git a/src/coreclr/vm/jithelpers.cpp b/src/coreclr/vm/jithelpers.cpp index 7400708001589f..98d6780258a6c6 100644 --- a/src/coreclr/vm/jithelpers.cpp +++ b/src/coreclr/vm/jithelpers.cpp @@ -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 @@ -5389,6 +5389,12 @@ void JIT_Patchpoint(int* counter, int ilOffset) // Install new entry point as IP SetIP(pFrameContext, osrMethodCode); +#ifdef _DEBUG + // Keep this context around to aid in debugging OSR transition problems + static CONTEXT s_lastOSRTransitionContext; + s_lastOSRTransitionContext = *pFrameContext; +#endif + // Restore last error (since call below does not return) // END_PRESERVE_LAST_ERROR; ::SetLastError(dwLastError); @@ -5425,7 +5431,7 @@ HCIMPL1(VOID, JIT_PartialCompilationPatchpoint, int ilOffset) // Patchpoint identity is the helper return address PCODE ip = (PCODE)_ReturnAddress(); -#if _DEBUG +#ifdef _DEBUG // Friendly ID number int ppId = 0; #endif @@ -5439,7 +5445,7 @@ HCIMPL1(VOID, JIT_PartialCompilationPatchpoint, int ilOffset) OnStackReplacementManager* manager = allocator->GetOnStackReplacementManager(); ppInfo = manager->GetPerPatchpointInfo(ip); -#if _DEBUG +#ifdef _DEBUG ppId = ppInfo->m_patchpointId; #endif