diff options
author | Mike McLaughlin <mikem@microsoft.com> | 2018-01-24 12:31:44 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-24 12:31:44 -0800 |
commit | 7b551b61bbf1a681fee67ae63dea022ad00d778d (patch) | |
tree | bb6b76b11721b1b37725ac1935c83984a832e942 | |
parent | 9b947ca3059da9416168b39bebb2717433ffd4d3 (diff) | |
download | coreclr-7b551b61bbf1a681fee67ae63dea022ad00d778d.tar.gz coreclr-7b551b61bbf1a681fee67ae63dea022ad00d778d.tar.bz2 coreclr-7b551b61bbf1a681fee67ae63dea022ad00d778d.zip |
Add "CLRJitAttachState" global export from coreclr.dll that contains the CLR_DEBUGGING_PROCESS_FLAGS for VS. (#15973)
-rw-r--r-- | src/debug/ee/debugger.cpp | 18 | ||||
-rw-r--r-- | src/debug/ee/debugger.h | 7 | ||||
-rw-r--r-- | src/dlls/mscoree/mscorwks_ntdef.src | 3 | ||||
-rw-r--r-- | src/inc/dacvars.h | 4 |
4 files changed, 14 insertions, 18 deletions
diff --git a/src/debug/ee/debugger.cpp b/src/debug/ee/debugger.cpp index bd5ba80243..baefbb5bd8 100644 --- a/src/debug/ee/debugger.cpp +++ b/src/debug/ee/debugger.cpp @@ -67,6 +67,10 @@ GPTR_IMPL(Debugger, g_pDebugger); GPTR_IMPL(EEDebugInterface, g_pEEInterface); SVAL_IMPL_INIT(BOOL, Debugger, s_fCanChangeNgenFlags, TRUE); +// This is a public export so debuggers can read and determine if the coreclr +// process is waiting for JIT debugging attach. +GVAL_IMPL_INIT(ULONG, CLRJitAttachState, 0); + bool g_EnableSIS = false; // The following instances are used for invoking overloaded new/delete @@ -941,9 +945,7 @@ Debugger::Debugger() #endif //_DEBUG m_threadsAtUnsafePlaces(0), m_jitAttachInProgress(FALSE), - m_attachingForManagedEvent(FALSE), m_launchingDebugger(FALSE), - m_userRequestedDebuggerLaunch(FALSE), m_LoggingEnabled(TRUE), m_pAppDomainCB(NULL), m_dClassLoadCallbackCount(0), @@ -6738,9 +6740,8 @@ DebuggerLaunchSetting Debugger::GetDbgJITDebugLaunchSetting() CLR_DEBUGGING_PROCESS_FLAGS Debugger::GetAttachStateFlags() { LIMITED_METHOD_DAC_CONTRACT; - return (CLR_DEBUGGING_PROCESS_FLAGS) - ((m_attachingForManagedEvent ? CLR_DEBUGGING_MANAGED_EVENT_PENDING : 0) - | (m_userRequestedDebuggerLaunch ? CLR_DEBUGGING_MANAGED_EVENT_DEBUGGER_LAUNCH : 0)); + ULONG flags = CLRJitAttachState; + return (CLR_DEBUGGING_PROCESS_FLAGS)flags; } #ifndef DACCESS_COMPILE @@ -6965,9 +6966,8 @@ BOOL Debugger::PreJitAttach(BOOL willSendManagedEvent, BOOL willLaunchDebugger, if (!m_jitAttachInProgress) { m_jitAttachInProgress = TRUE; - m_attachingForManagedEvent = willSendManagedEvent; m_launchingDebugger = willLaunchDebugger; - m_userRequestedDebuggerLaunch = explicitUserRequest; + CLRJitAttachState = (willSendManagedEvent ? CLR_DEBUGGING_MANAGED_EVENT_PENDING : 0) | (explicitUserRequest ? CLR_DEBUGGING_MANAGED_EVENT_DEBUGGER_LAUNCH : 0); ResetEvent(GetUnmanagedAttachEvent()); ResetEvent(GetAttachEvent()); LOG( (LF_CORDB, LL_INFO10000, "D::PreJA: Leaving - first thread\n") ); @@ -7139,9 +7139,9 @@ void Debugger::PostJitAttach() // clear the attaching flags which allows other threads to initiate jit attach if needed m_jitAttachInProgress = FALSE; - m_attachingForManagedEvent = FALSE; m_launchingDebugger = FALSE; - m_userRequestedDebuggerLaunch = FALSE; + CLRJitAttachState = 0; + // set the attaching events to unblock other threads waiting on this attach // regardless of whether or not it completed SetEvent(GetUnmanagedAttachEvent()); diff --git a/src/debug/ee/debugger.h b/src/debug/ee/debugger.h index b8766d8a19..5eec66cefd 100644 --- a/src/debug/ee/debugger.h +++ b/src/debug/ee/debugger.h @@ -110,6 +110,7 @@ typedef DPTR(struct DebuggerIPCControlBlock) PTR_DebuggerIPCControlBlock; GPTR_DECL(Debugger, g_pDebugger); GPTR_DECL(EEDebugInterface, g_pEEInterface); +GVAL_DECL(ULONG, CLRJitAttachState); #ifndef FEATURE_PAL GVAL_DECL(HANDLE, g_hContinueStartupEvent); #endif @@ -2849,13 +2850,7 @@ private: #endif LONG m_threadsAtUnsafePlaces; Volatile<BOOL> m_jitAttachInProgress; - - // True if after the jit attach we plan to send a managed non-catchup - // debug event - BOOL m_attachingForManagedEvent; BOOL m_launchingDebugger; - BOOL m_userRequestedDebuggerLaunch; - BOOL m_LoggingEnabled; AppDomainEnumerationIPCBlock *m_pAppDomainCB; diff --git a/src/dlls/mscoree/mscorwks_ntdef.src b/src/dlls/mscoree/mscorwks_ntdef.src index d7e6a2dcf4..8917836d72 100644 --- a/src/dlls/mscoree/mscorwks_ntdef.src +++ b/src/dlls/mscoree/mscorwks_ntdef.src @@ -15,6 +15,9 @@ EXPORTS ; This cannot change, or else CoreCLR debugging will not work. ; See clr\src\DLLS\dbgshim\dbgshim.cpp. g_CLREngineMetrics @2 data + + ; VS depends on CLRJitAttachState having a ordinal of 3. This cannot change. + CLRJitAttachState @3 data ; Unix hosting API coreclr_create_delegate diff --git a/src/inc/dacvars.h b/src/inc/dacvars.h index f0f156dc62..8cc3f0249e 100644 --- a/src/inc/dacvars.h +++ b/src/inc/dacvars.h @@ -212,13 +212,13 @@ DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE, dac__g_pDebugger, ::g_pDebugger) DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE, dac__g_pDebugInterface, ::g_pDebugInterface) DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE, dac__g_pEEDbgInterfaceImpl, ::g_pEEDbgInterfaceImpl) DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE, dac__g_pEEInterface, ::g_pEEInterface) +DEFINE_DACVAR(ULONG, ULONG, dac__CLRJitAttachState, ::CLRJitAttachState) DEFINE_DACVAR(ULONG, BOOL, Debugger__s_fCanChangeNgenFlags, Debugger::s_fCanChangeNgenFlags) DEFINE_DACVAR(ULONG, PTR_DebuggerPatchTable, DebuggerController__g_patches, DebuggerController::g_patches) DEFINE_DACVAR(ULONG, BOOL, DebuggerController__g_patchTableValid, DebuggerController::g_patchTableValid) - DEFINE_DACVAR(ULONG, SIZE_T, dac__gLowestFCall, ::gLowestFCall) DEFINE_DACVAR(ULONG, SIZE_T, dac__gHighestFCall, ::gHighestFCall) DEFINE_DACVAR(ULONG, SIZE_T, dac__gFCallMethods, ::gFCallMethods) @@ -257,8 +257,6 @@ DEFINE_DACVAR(ULONG, HRESULT, dac__g_hrFatalError, ::g_hrFatalError) DEFINE_DACVAR(ULONG, DWORD, PEFile__s_NGENDebugFlags, PEFile::s_NGENDebugFlags) #endif //defined(DEBUGGING_SUPPORTED) && defined (FEATURE_PREJIT) - - #ifdef FEATURE_MINIMETADATA_IN_TRIAGEDUMPS DEFINE_DACVAR(ULONG, DWORD, dac__g_MiniMetaDataBuffMaxSize, ::g_MiniMetaDataBuffMaxSize) DEFINE_DACVAR(ULONG, TADDR, dac__g_MiniMetaDataBuffAddress, ::g_MiniMetaDataBuffAddress) |