Skip to content

Commit 23d6092

Browse files
github-actions[bot]thaystgmikelle-rogers
authored
[release/9.0-staging] [debugger] Fix a step that becomes a go (#110533)
* Fixing step becomes a go * Trying to avoid step that becomes a go * Adding comments and more protections. * fixing comment * Checking if removing this comments, CI failures are gone. * Adding part of the changes to understand the failures on CI * Update src/coreclr/debug/ee/controller.cpp Co-authored-by: mikelle-rogers <[email protected]> * Fixing wrong fix. --------- Co-authored-by: Thays Grazia <[email protected]> Co-authored-by: Thays Grazia <[email protected]> Co-authored-by: mikelle-rogers <[email protected]>
1 parent 83db46b commit 23d6092

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

src/coreclr/debug/ee/controller.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7410,7 +7410,15 @@ bool DebuggerStepper::TriggerSingleStep(Thread *thread, const BYTE *ip)
74107410
if (!g_pEEInterface->IsManagedNativeCode(ip))
74117411
{
74127412
LOG((LF_CORDB,LL_INFO10000, "DS::TSS: not in managed code, Returning false (case 0)!\n"));
7413-
DisableSingleStep();
7413+
// Sometimes we can get here with a callstack that is coming from an APC
7414+
// this will disable the single stepping and incorrectly resume an app that the user
7415+
// is stepping through.
7416+
#ifdef FEATURE_THREAD_ACTIVATION
7417+
if ((thread->m_State & Thread::TS_DebugWillSync) == 0)
7418+
#endif
7419+
{
7420+
DisableSingleStep();
7421+
}
74147422
return false;
74157423
}
74167424

src/coreclr/vm/threadsuspend.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5746,8 +5746,9 @@ BOOL CheckActivationSafePoint(SIZE_T ip)
57465746
Thread *pThread = GetThreadNULLOk();
57475747

57485748
// The criteria for safe activation is to be running managed code.
5749-
// Also we are not interested in handling interruption if we are already in preemptive mode.
5750-
BOOL isActivationSafePoint = pThread != NULL &&
5749+
// Also we are not interested in handling interruption if we are already in preemptive mode nor if we are single stepping
5750+
BOOL isActivationSafePoint = pThread != NULL &&
5751+
(pThread->m_StateNC & Thread::TSNC_DebuggerIsStepping) == 0 &&
57515752
pThread->PreemptiveGCDisabled() &&
57525753
ExecutionManager::IsManagedCode(ip);
57535754

@@ -5932,7 +5933,12 @@ bool Thread::InjectActivation(ActivationReason reason)
59325933
{
59335934
return true;
59345935
}
5935-
5936+
// Avoid APC calls when the thread is in single step state to avoid any
5937+
// wrong resume because it's running a native code.
5938+
if ((m_StateNC & Thread::TSNC_DebuggerIsStepping) != 0)
5939+
{
5940+
return false;
5941+
}
59365942
#ifdef FEATURE_SPECIAL_USER_MODE_APC
59375943
_ASSERTE(UseSpecialUserModeApc());
59385944

0 commit comments

Comments
 (0)