diff options
author | Mike McLaughlin <mikem@microsoft.com> | 2016-02-08 17:47:31 -0800 |
---|---|---|
committer | Mike McLaughlin <mikem@microsoft.com> | 2016-02-10 13:38:08 -0800 |
commit | 7d74570d33823d4734fa287bc21a81ff12f7b40a (patch) | |
tree | a5c30abede3ac0679554444651fa1026288ae594 | |
parent | ceb0a800ad650a36a32e543146669e9f3654e948 (diff) | |
download | coreclr-7d74570d33823d4734fa287bc21a81ff12f7b40a.tar.gz coreclr-7d74570d33823d4734fa287bc21a81ff12f7b40a.tar.bz2 coreclr-7d74570d33823d4734fa287bc21a81ff12f7b40a.zip |
Fix SOS managed breakpoints when coreclr symbols are stripped.
Added a SOS DAC interface (ISOSDacInterface4::GetClrNotification) to get the exception
notification arguments instead of using the GetLastExceptionInformation function from the lldb
sosplugin that depends on coreclr symbols being present.
On the coreclr side, the clr notification arguments are saved in a global variable that is DAC
accessible. A critical section was added to protect this global variable while the special
exception is raised.
Setting the internal COMPlus_DebugBreakOnAssert environment variable causes 3 or 4 breaks in
the debugger with no reason. It was breaking in the function that was determining whether it
should break. I was using COMPlus_BreakOnEELoad=2 to break after coreclr was loaded and initialized
to set managed breakpoints and on a debug build it generates an assert (on release just a DebugBreak).
-rw-r--r-- | src/ToolBox/SOS/Strike/strike.cpp | 36 | ||||
-rw-r--r-- | src/debug/daccess/daccess.cpp | 4 | ||||
-rw-r--r-- | src/debug/daccess/dacimpl.h | 6 | ||||
-rw-r--r-- | src/debug/daccess/request.cpp | 23 | ||||
-rw-r--r-- | src/inc/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/inc/CrstTypes.def | 4 | ||||
-rw-r--r-- | src/inc/crsttypes.h | 309 | ||||
-rw-r--r-- | src/inc/dacvars.h | 2 | ||||
-rw-r--r-- | src/inc/sospriv.idl | 10 | ||||
-rw-r--r-- | src/pal/prebuilt/idl/sospriv_i.c | 100 | ||||
-rw-r--r-- | src/pal/prebuilt/inc/sospriv.h | 109 | ||||
-rw-r--r-- | src/utilcode/debug.cpp | 19 | ||||
-rw-r--r-- | src/vm/ceemain.cpp | 13 | ||||
-rw-r--r-- | src/vm/util.cpp | 53 | ||||
-rw-r--r-- | src/vm/util.hpp | 7 |
15 files changed, 498 insertions, 198 deletions
diff --git a/src/ToolBox/SOS/Strike/strike.cpp b/src/ToolBox/SOS/Strike/strike.cpp index 1ee3eabc0b..c78cec5205 100644 --- a/src/ToolBox/SOS/Strike/strike.cpp +++ b/src/ToolBox/SOS/Strike/strike.cpp @@ -6878,9 +6878,43 @@ int CNotification::s_condemnedGen = -1; BOOL CheckCLRNotificationEvent(DEBUG_LAST_EVENT_INFO_EXCEPTION* pdle) { + ISOSDacInterface4 *psos4 = NULL; + CLRDATA_ADDRESS arguments[3]; + HRESULT Status; + + if (SUCCEEDED(Status = g_sos->QueryInterface(__uuidof(ISOSDacInterface4), (void**) &psos4))) + { + int count = _countof(arguments); + int countNeeded = 0; + + Status = psos4->GetClrNotification(arguments, count, &countNeeded); + psos4->Release(); + + if (SUCCEEDED(Status)) + { + memset(&pdle->ExceptionRecord, 0, sizeof(pdle->ExceptionRecord)); + pdle->FirstChance = TRUE; + pdle->ExceptionRecord.ExceptionCode = CLRDATA_NOTIFY_EXCEPTION; + + _ASSERTE(count <= EXCEPTION_MAXIMUM_PARAMETERS); + for (int i = 0; i < count; i++) + { + pdle->ExceptionRecord.ExceptionInformation[i] = arguments[i]; + } + // The rest of the ExceptionRecord isn't used by TranslateExceptionRecordToNotification + return TRUE; + } + // No pending exception notification + return FALSE; + } + + // The new DAC based interface doesn't exists so ask the debugger for the last exception + // information. NOTE: this function doesn't work on xplat version when the coreclr symbols + // have been stripped. + ULONG Type, ProcessId, ThreadId; ULONG ExtraInformationUsed; - HRESULT Status = g_ExtControl->GetLastEventInformation( + Status = g_ExtControl->GetLastEventInformation( &Type, &ProcessId, &ThreadId, diff --git a/src/debug/daccess/daccess.cpp b/src/debug/daccess/daccess.cpp index f96c8e35ba..9e20926863 100644 --- a/src/debug/daccess/daccess.cpp +++ b/src/debug/daccess/daccess.cpp @@ -3270,6 +3270,10 @@ ClrDataAccess::QueryInterface(THIS_ { ifaceRet = static_cast<ISOSDacInterface3*>(this); } + else if (IsEqualIID(interfaceId, __uuidof(ISOSDacInterface4))) + { + ifaceRet = static_cast<ISOSDacInterface4*>(this); + } else { *iface = NULL; diff --git a/src/debug/daccess/dacimpl.h b/src/debug/daccess/dacimpl.h index 1ca012595d..a755391ff6 100644 --- a/src/debug/daccess/dacimpl.h +++ b/src/debug/daccess/dacimpl.h @@ -857,7 +857,8 @@ class ClrDataAccess public ICLRDataEnumMemoryRegions, public ISOSDacInterface, public ISOSDacInterface2, - public ISOSDacInterface3 + public ISOSDacInterface3, + public ISOSDacInterface4 { public: ClrDataAccess(ICorDebugDataTarget * pTarget, ICLRDataTarget * pLegacyTarget=0); @@ -1197,6 +1198,9 @@ public: virtual HRESULT STDMETHODCALLTYPE GetGCInterestingInfoStaticData(struct DacpGCInterestingInfoData *data); virtual HRESULT STDMETHODCALLTYPE GetGCGlobalMechanisms(size_t* globalMechanisms); + // ISOSDacInterface4 + virtual HRESULT STDMETHODCALLTYPE GetClrNotification(CLRDATA_ADDRESS arguments[], int count, int *pNeeded); + // // ClrDataAccess. // diff --git a/src/debug/daccess/request.cpp b/src/debug/daccess/request.cpp index a35741f05b..b49b30283f 100644 --- a/src/debug/daccess/request.cpp +++ b/src/debug/daccess/request.cpp @@ -4352,3 +4352,26 @@ HRESULT ClrDataAccess::IsRCWDCOMProxy(CLRDATA_ADDRESS rcwAddr, BOOL* isDCOMProxy return E_NOTIMPL; #endif // FEATURE_COMINTEROP } + +HRESULT ClrDataAccess::GetClrNotification(CLRDATA_ADDRESS arguments[], int count, int *pNeeded) +{ + SOSDacEnter(); + + *pNeeded = MAX_CLR_NOTIFICATION_ARGS; + + if (g_clrNotificationArguments[0] == NULL) + { + hr = E_FAIL; + } + else + { + for (int i = 0; i < count && i < MAX_CLR_NOTIFICATION_ARGS; i++) + { + arguments[i] = g_clrNotificationArguments[i]; + } + } + + SOSDacLeave(); + + return hr;; +}
\ No newline at end of file diff --git a/src/inc/CMakeLists.txt b/src/inc/CMakeLists.txt index 9a59d48f9d..289ded3314 100644 --- a/src/inc/CMakeLists.txt +++ b/src/inc/CMakeLists.txt @@ -17,6 +17,7 @@ set( CORGUIDS_IDL_SOURCES clrprivhosting.idl clrprivruntimebinders.idl corsym.idl + sospriv.idl ) if(WIN32) diff --git a/src/inc/CrstTypes.def b/src/inc/CrstTypes.def index 5fb8615308..bb6e710647 100644 --- a/src/inc/CrstTypes.def +++ b/src/inc/CrstTypes.def @@ -136,6 +136,10 @@ Crst ClassInit SameLevelAs Jit End +Crst ClrNotification + Unordered +End + Crst CrstCLRPrivBinderLocalWinMDPath End diff --git a/src/inc/crsttypes.h b/src/inc/crsttypes.h index 2b3a3b441d..8c702fa553 100644 --- a/src/inc/crsttypes.h +++ b/src/inc/crsttypes.h @@ -30,159 +30,160 @@ enum CrstType CrstCer = 13, CrstClassFactInfoHash = 14, CrstClassInit = 15, - CrstCLRPrivBinderMaps = 16, - CrstCLRPrivBinderMapsAdd = 17, - CrstCodeFragmentHeap = 18, - CrstCOMWrapperCache = 19, - CrstConnectionNameTable = 20, - CrstContexts = 21, - CrstCoreCLRBinderLog = 22, - CrstCrstCLRPrivBinderLocalWinMDPath = 23, - CrstCSPCache = 24, - CrstDataTest1 = 25, - CrstDataTest2 = 26, - CrstDbgTransport = 27, - CrstDeadlockDetection = 28, - CrstDebuggerController = 29, - CrstDebuggerFavorLock = 30, - CrstDebuggerHeapExecMemLock = 31, - CrstDebuggerHeapLock = 32, - CrstDebuggerJitInfo = 33, - CrstDebuggerMutex = 34, - CrstDelegateToFPtrHash = 35, - CrstDomainLocalBlock = 36, - CrstDynamicIL = 37, - CrstDynamicMT = 38, - CrstDynLinkZapItems = 39, - CrstEtwTypeLogHash = 40, - CrstEventStore = 41, - CrstException = 42, - CrstExecuteManLock = 43, - CrstExecuteManRangeLock = 44, - CrstFCall = 45, - CrstFriendAccessCache = 46, - CrstFuncPtrStubs = 47, - CrstFusionAppCtx = 48, - CrstFusionAssemblyDownload = 49, - CrstFusionBindContext = 50, - CrstFusionBindResult = 51, - CrstFusionClb = 52, - CrstFusionClosure = 53, - CrstFusionClosureGraph = 54, - CrstFusionConfigSettings = 55, - CrstFusionDownload = 56, - CrstFusionIsoLibInit = 57, - CrstFusionLoadContext = 58, - CrstFusionLog = 59, - CrstFusionNgenIndex = 60, - CrstFusionNgenIndexPool = 61, - CrstFusionPcyCache = 62, - CrstFusionPolicyConfigPool = 63, - CrstFusionSingleUse = 64, - CrstFusionWarningLog = 65, - CrstGCMemoryPressure = 66, - CrstGlobalStrLiteralMap = 67, - CrstHandleTable = 68, - CrstHostAssemblyMap = 69, - CrstHostAssemblyMapAdd = 70, - CrstIbcProfile = 71, - CrstIJWFixupData = 72, - CrstIJWHash = 73, - CrstILFingerprintCache = 74, - CrstILStubGen = 75, - CrstInlineTrackingMap = 76, - CrstInstMethodHashTable = 77, - CrstInterfaceVTableMap = 78, - CrstInterop = 79, - CrstInteropData = 80, - CrstIOThreadpoolWorker = 81, - CrstIsJMCMethod = 82, - CrstISymUnmanagedReader = 83, - CrstJit = 84, - CrstJitGenericHandleCache = 85, - CrstJitPerf = 86, - CrstJumpStubCache = 87, - CrstLeafLock = 88, - CrstListLock = 89, - CrstLoaderAllocator = 90, - CrstLoaderAllocatorReferences = 91, - CrstLoaderHeap = 92, - CrstMda = 93, - CrstMetadataTracker = 94, - CrstModIntPairList = 95, - CrstModule = 96, - CrstModuleFixup = 97, - CrstModuleLookupTable = 98, - CrstMulticoreJitHash = 99, - CrstMulticoreJitManager = 100, - CrstMUThunkHash = 101, - CrstNativeBinderInit = 102, - CrstNativeImageCache = 103, - CrstNls = 104, - CrstObjectList = 105, - CrstOnEventManager = 106, - CrstPatchEntryPoint = 107, - CrstPEFileSecurityManager = 108, - CrstPEImage = 109, - CrstPEImagePDBStream = 110, - CrstPendingTypeLoadEntry = 111, - CrstPinHandle = 112, - CrstPinnedByrefValidation = 113, - CrstProfilerGCRefDataFreeList = 114, - CrstProfilingAPIStatus = 115, - CrstPublisherCertificate = 116, - CrstRCWCache = 117, - CrstRCWCleanupList = 118, - CrstRCWRefCache = 119, - CrstReDacl = 120, - CrstReflection = 121, - CrstReJITDomainTable = 122, - CrstReJITGlobalRequest = 123, - CrstReJITSharedDomainTable = 124, - CrstRemoting = 125, - CrstRetThunkCache = 126, - CrstRWLock = 127, - CrstSavedExceptionInfo = 128, - CrstSaveModuleProfileData = 129, - CrstSecurityPolicyCache = 130, - CrstSecurityPolicyInit = 131, - CrstSecurityStackwalkCache = 132, - CrstSharedAssemblyCreate = 133, - CrstSharedBaseDomain = 134, - CrstSigConvert = 135, - CrstSingleUseLock = 136, - CrstSpecialStatics = 137, - CrstSqmManager = 138, - CrstStackSampler = 139, - CrstStressLog = 140, - CrstStrongName = 141, - CrstStubCache = 142, - CrstStubDispatchCache = 143, - CrstStubUnwindInfoHeapSegments = 144, - CrstSyncBlockCache = 145, - CrstSyncHashLock = 146, - CrstSystemBaseDomain = 147, - CrstSystemDomain = 148, - CrstSystemDomainDelayedUnloadList = 149, - CrstThreadIdDispenser = 150, - CrstThreadpoolEventCache = 151, - CrstThreadpoolTimerQueue = 152, - CrstThreadpoolWaitThreads = 153, - CrstThreadpoolWorker = 154, - CrstThreadStaticDataHashTable = 155, - CrstThreadStore = 156, - CrstTPMethodTable = 157, - CrstTypeEquivalenceMap = 158, - CrstTypeIDMap = 159, - CrstUMEntryThunkCache = 160, - CrstUMThunkHash = 161, - CrstUniqueStack = 162, - CrstUnresolvedClassLock = 163, - CrstUnwindInfoTableLock = 164, - CrstVSDIndirectionCellLock = 165, - CrstWinRTFactoryCache = 166, - CrstWrapperTemplate = 167, - kNumberOfCrstTypes = 168 + CrstClrNotification = 16, + CrstCLRPrivBinderMaps = 17, + CrstCLRPrivBinderMapsAdd = 18, + CrstCodeFragmentHeap = 19, + CrstCOMWrapperCache = 20, + CrstConnectionNameTable = 21, + CrstContexts = 22, + CrstCoreCLRBinderLog = 23, + CrstCrstCLRPrivBinderLocalWinMDPath = 24, + CrstCSPCache = 25, + CrstDataTest1 = 26, + CrstDataTest2 = 27, + CrstDbgTransport = 28, + CrstDeadlockDetection = 29, + CrstDebuggerController = 30, + CrstDebuggerFavorLock = 31, + CrstDebuggerHeapExecMemLock = 32, + CrstDebuggerHeapLock = 33, + CrstDebuggerJitInfo = 34, + CrstDebuggerMutex = 35, + CrstDelegateToFPtrHash = 36, + CrstDomainLocalBlock = 37, + CrstDynamicIL = 38, + CrstDynamicMT = 39, + CrstDynLinkZapItems = 40, + CrstEtwTypeLogHash = 41, + CrstEventStore = 42, + CrstException = 43, + CrstExecuteManLock = 44, + CrstExecuteManRangeLock = 45, + CrstFCall = 46, + CrstFriendAccessCache = 47, + CrstFuncPtrStubs = 48, + CrstFusionAppCtx = 49, + CrstFusionAssemblyDownload = 50, + CrstFusionBindContext = 51, + CrstFusionBindResult = 52, + CrstFusionClb = 53, + CrstFusionClosure = 54, + CrstFusionClosureGraph = 55, + CrstFusionConfigSettings = 56, + CrstFusionDownload = 57, + CrstFusionIsoLibInit = 58, + CrstFusionLoadContext = 59, + CrstFusionLog = 60, + CrstFusionNgenIndex = 61, + CrstFusionNgenIndexPool = 62, + CrstFusionPcyCache = 63, + CrstFusionPolicyConfigPool = 64, + CrstFusionSingleUse = 65, + CrstFusionWarningLog = 66, + CrstGCMemoryPressure = 67, + CrstGlobalStrLiteralMap = 68, + CrstHandleTable = 69, + CrstHostAssemblyMap = 70, + CrstHostAssemblyMapAdd = 71, + CrstIbcProfile = 72, + CrstIJWFixupData = 73, + CrstIJWHash = 74, + CrstILFingerprintCache = 75, + CrstILStubGen = 76, + CrstInlineTrackingMap = 77, + CrstInstMethodHashTable = 78, + CrstInterfaceVTableMap = 79, + CrstInterop = 80, + CrstInteropData = 81, + CrstIOThreadpoolWorker = 82, + CrstIsJMCMethod = 83, + CrstISymUnmanagedReader = 84, + CrstJit = 85, + CrstJitGenericHandleCache = 86, + CrstJitPerf = 87, + CrstJumpStubCache = 88, + CrstLeafLock = 89, + CrstListLock = 90, + CrstLoaderAllocator = 91, + CrstLoaderAllocatorReferences = 92, + CrstLoaderHeap = 93, + CrstMda = 94, + CrstMetadataTracker = 95, + CrstModIntPairList = 96, + CrstModule = 97, + CrstModuleFixup = 98, + CrstModuleLookupTable = 99, + CrstMulticoreJitHash = 100, + CrstMulticoreJitManager = 101, + CrstMUThunkHash = 102, + CrstNativeBinderInit = 103, + CrstNativeImageCache = 104, + CrstNls = 105, + CrstObjectList = 106, + CrstOnEventManager = 107, + CrstPatchEntryPoint = 108, + CrstPEFileSecurityManager = 109, + CrstPEImage = 110, + CrstPEImagePDBStream = 111, + CrstPendingTypeLoadEntry = 112, + CrstPinHandle = 113, + CrstPinnedByrefValidation = 114, + CrstProfilerGCRefDataFreeList = 115, + CrstProfilingAPIStatus = 116, + CrstPublisherCertificate = 117, + CrstRCWCache = 118, + CrstRCWCleanupList = 119, + CrstRCWRefCache = 120, + CrstReDacl = 121, + CrstReflection = 122, + CrstReJITDomainTable = 123, + CrstReJITGlobalRequest = 124, + CrstReJITSharedDomainTable = 125, + CrstRemoting = 126, + CrstRetThunkCache = 127, + CrstRWLock = 128, + CrstSavedExceptionInfo = 129, + CrstSaveModuleProfileData = 130, + CrstSecurityPolicyCache = 131, + CrstSecurityPolicyInit = 132, + CrstSecurityStackwalkCache = 133, + CrstSharedAssemblyCreate = 134, + CrstSharedBaseDomain = 135, + CrstSigConvert = 136, + CrstSingleUseLock = 137, + CrstSpecialStatics = 138, + CrstSqmManager = 139, + CrstStackSampler = 140, + CrstStressLog = 141, + CrstStrongName = 142, + CrstStubCache = 143, + CrstStubDispatchCache = 144, + CrstStubUnwindInfoHeapSegments = 145, + CrstSyncBlockCache = 146, + CrstSyncHashLock = 147, + CrstSystemBaseDomain = 148, + CrstSystemDomain = 149, + CrstSystemDomainDelayedUnloadList = 150, + CrstThreadIdDispenser = 151, + CrstThreadpoolEventCache = 152, + CrstThreadpoolTimerQueue = 153, + CrstThreadpoolWaitThreads = 154, + CrstThreadpoolWorker = 155, + CrstThreadStaticDataHashTable = 156, + CrstThreadStore = 157, + CrstTPMethodTable = 158, + CrstTypeEquivalenceMap = 159, + CrstTypeIDMap = 160, + CrstUMEntryThunkCache = 161, + CrstUMThunkHash = 162, + CrstUniqueStack = 163, + CrstUnresolvedClassLock = 164, + CrstUnwindInfoTableLock = 165, + CrstVSDIndirectionCellLock = 166, + CrstWinRTFactoryCache = 167, + CrstWrapperTemplate = 168, + kNumberOfCrstTypes = 169 }; #endif // __CRST_TYPES_INCLUDED @@ -209,6 +210,7 @@ int g_rgCrstLevelMap[] = 9, // CrstCer 11, // CrstClassFactInfoHash 8, // CrstClassInit + -1, // CrstClrNotification 0, // CrstCLRPrivBinderMaps 3, // CrstCLRPrivBinderMapsAdd 6, // CrstCodeFragmentHeap @@ -382,6 +384,7 @@ LPCSTR g_rgCrstNameMap[] = "CrstCer", "CrstClassFactInfoHash", "CrstClassInit", + "CrstClrNotification", "CrstCLRPrivBinderMaps", "CrstCLRPrivBinderMapsAdd", "CrstCodeFragmentHeap", diff --git a/src/inc/dacvars.h b/src/inc/dacvars.h index 310717ba43..05e00d5552 100644 --- a/src/inc/dacvars.h +++ b/src/inc/dacvars.h @@ -333,6 +333,8 @@ DEFINE_DACVAR(ULONG, DWORD, dac__g_MiniMetaDataBuffMaxSize, ::g_MiniMetaDataBuff DEFINE_DACVAR(ULONG, TADDR, dac__g_MiniMetaDataBuffAddress, ::g_MiniMetaDataBuffAddress) #endif // FEATURE_MINIMETADATA_IN_TRIAGEDUMPS +DEFINE_DACVAR(ULONG, SIZE_T, dac__g_clrNotificationArguments, ::g_clrNotificationArguments) + #undef DEFINE_DACVAR #undef DEFINE_DACVAR_SVR #undef DEFINE_DACVAR_NO_DUMP diff --git a/src/inc/sospriv.idl b/src/inc/sospriv.idl index aa61fe617e..1f9028c8e1 100644 --- a/src/inc/sospriv.idl +++ b/src/inc/sospriv.idl @@ -347,3 +347,13 @@ interface ISOSDacInterface3 : IUnknown HRESULT GetGCInterestingInfoStaticData(struct DacpGCInterestingInfoData *data); HRESULT GetGCGlobalMechanisms(size_t* globalMechanisms); }; + +[ + object, + local, + uuid(74B9D34C-A612-4B07-93DD-5462178FCE11) +] +interface ISOSDacInterface4 : IUnknown +{ + HRESULT GetClrNotification(CLRDATA_ADDRESS arguments[], int count, int *pNeeded); +};
\ No newline at end of file diff --git a/src/pal/prebuilt/idl/sospriv_i.c b/src/pal/prebuilt/idl/sospriv_i.c new file mode 100644 index 0000000000..7fee909ca3 --- /dev/null +++ b/src/pal/prebuilt/idl/sospriv_i.c @@ -0,0 +1,100 @@ + + +/* this ALWAYS GENERATED file contains the IIDs and CLSIDs */ + +/* link this file in with the server and any clients */ + + + /* File created by MIDL compiler version 8.00.0613 */ +/* at Mon Jan 18 19:14:07 2038 + */ +/* Compiler settings for C:/ssd/coreclr/src/inc/sospriv.idl: + Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 8.00.0613 + protocol : dce , ms_ext, c_ext, robust + error checks: allocation ref bounds_check enum stub_data + VC __declspec() decoration level: + __declspec(uuid()), __declspec(selectany), __declspec(novtable) + DECLSPEC_UUID(), MIDL_INTERFACE() +*/ +/* @@MIDL_FILE_HEADING( ) */ + +#pragma warning( disable: 4049 ) /* more than 64k source lines */ + + +#ifdef __cplusplus +extern "C"{ +#endif + + +#include <rpc.h> +#include <rpcndr.h> + +#ifdef _MIDL_USE_GUIDDEF_ + +#ifndef INITGUID +#define INITGUID +#include <guiddef.h> +#undef INITGUID +#else +#include <guiddef.h> +#endif + +#define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \ + DEFINE_GUID(name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) + +#else // !_MIDL_USE_GUIDDEF_ + +#ifndef __IID_DEFINED__ +#define __IID_DEFINED__ + +typedef struct _IID +{ + unsigned long x; + unsigned short s1; + unsigned short s2; + unsigned char c[8]; +} IID; + +#endif // __IID_DEFINED__ + +#ifndef CLSID_DEFINED +#define CLSID_DEFINED +typedef IID CLSID; +#endif // CLSID_DEFINED + +#define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \ + const type name = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}} + +#endif !_MIDL_USE_GUIDDEF_ + +MIDL_DEFINE_GUID(IID, IID_ISOSEnum,0x286CA186,0xE763,0x4F61,0x97,0x60,0x48,0x7D,0x43,0xAE,0x43,0x41); + + +MIDL_DEFINE_GUID(IID, IID_ISOSHandleEnum,0x3E269830,0x4A2B,0x4301,0x8E,0xE2,0xD6,0x80,0x5B,0x29,0xB2,0xFA); + + +MIDL_DEFINE_GUID(IID, IID_ISOSStackRefErrorEnum,0x774F4E1B,0xFB7B,0x491B,0x97,0x6D,0xA8,0x13,0x0F,0xE3,0x55,0xE9); + + +MIDL_DEFINE_GUID(IID, IID_ISOSStackRefEnum,0x8FA642BD,0x9F10,0x4799,0x9A,0xA3,0x51,0x2A,0xE7,0x8C,0x77,0xEE); + + +MIDL_DEFINE_GUID(IID, IID_ISOSDacInterface,0x436f00f2,0xb42a,0x4b9f,0x87,0x0c,0xe7,0x3d,0xb6,0x6a,0xe9,0x30); + + +MIDL_DEFINE_GUID(IID, IID_ISOSDacInterface2,0xA16026EC,0x96F4,0x40BA,0x87,0xFB,0x55,0x75,0x98,0x6F,0xB7,0xAF); + + +MIDL_DEFINE_GUID(IID, IID_ISOSDacInterface3,0xB08C5CDC,0xFD8A,0x49C5,0xAB,0x38,0x5F,0xEE,0xF3,0x52,0x35,0xB4); + + +MIDL_DEFINE_GUID(IID, IID_ISOSDacInterface4,0x74B9D34C,0xA612,0x4B07,0x93,0xDD,0x54,0x62,0x17,0x8F,0xCE,0x11); + +#undef MIDL_DEFINE_GUID + +#ifdef __cplusplus +} +#endif + + + diff --git a/src/pal/prebuilt/inc/sospriv.h b/src/pal/prebuilt/inc/sospriv.h index 65e1229d3d..ae881659e5 100644 --- a/src/pal/prebuilt/inc/sospriv.h +++ b/src/pal/prebuilt/inc/sospriv.h @@ -1,13 +1,19 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - /* this ALWAYS GENERATED file contains the definitions for the interfaces */ - /* File created by MIDL compiler version 8.00.0603 */ + /* File created by MIDL compiler version 8.00.0613 */ +/* at Mon Jan 18 19:14:07 2038 + */ +/* Compiler settings for C:/ssd/coreclr/src/inc/sospriv.idl: + Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 8.00.0613 + protocol : dce , ms_ext, c_ext, robust + error checks: allocation ref bounds_check enum stub_data + VC __declspec() decoration level: + __declspec(uuid()), __declspec(selectany), __declspec(novtable) + DECLSPEC_UUID(), MIDL_INTERFACE() +*/ /* @@MIDL_FILE_HEADING( ) */ #pragma warning( disable: 4049 ) /* more than 64k source lines */ @@ -23,7 +29,7 @@ #ifndef __RPCNDR_H_VERSION__ #error this stub requires an updated version of <rpcndr.h> -#endif // __RPCNDR_H_VERSION__ +#endif /* __RPCNDR_H_VERSION__ */ #ifndef COM_NO_WINDOWS_H #include "windows.h" @@ -88,6 +94,13 @@ typedef interface ISOSDacInterface3 ISOSDacInterface3; #endif /* __ISOSDacInterface3_FWD_DEFINED__ */ +#ifndef __ISOSDacInterface4_FWD_DEFINED__ +#define __ISOSDacInterface4_FWD_DEFINED__ +typedef interface ISOSDacInterface4 ISOSDacInterface4; + +#endif /* __ISOSDacInterface4_FWD_DEFINED__ */ + + /* header files for imported files */ #include "unknwn.h" #include "xclrdata.h" @@ -2089,6 +2102,90 @@ EXTERN_C const IID IID_ISOSDacInterface3; #endif /* __ISOSDacInterface3_INTERFACE_DEFINED__ */ +#ifndef __ISOSDacInterface4_INTERFACE_DEFINED__ +#define __ISOSDacInterface4_INTERFACE_DEFINED__ + +/* interface ISOSDacInterface4 */ +/* [uuid][local][object] */ + + +EXTERN_C const IID IID_ISOSDacInterface4; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("74B9D34C-A612-4B07-93DD-5462178FCE11") + ISOSDacInterface4 : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE GetClrNotification( + CLRDATA_ADDRESS arguments[ ], + int count, + int *pNeeded) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ISOSDacInterface4Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISOSDacInterface4 * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISOSDacInterface4 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISOSDacInterface4 * This); + + HRESULT ( STDMETHODCALLTYPE *GetClrNotification )( + ISOSDacInterface4 * This, + CLRDATA_ADDRESS arguments[ ], + int count, + int *pNeeded); + + END_INTERFACE + } ISOSDacInterface4Vtbl; + + interface ISOSDacInterface4 + { + CONST_VTBL struct ISOSDacInterface4Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISOSDacInterface4_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ISOSDacInterface4_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ISOSDacInterface4_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ISOSDacInterface4_GetClrNotification(This,arguments,count,pNeeded) \ + ( (This)->lpVtbl -> GetClrNotification(This,arguments,count,pNeeded) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ISOSDacInterface4_INTERFACE_DEFINED__ */ + + /* Additional Prototypes for ALL interfaces */ /* end of Additional Prototypes */ diff --git a/src/utilcode/debug.cpp b/src/utilcode/debug.cpp index 01963dea7d..b1fb16524b 100644 --- a/src/utilcode/debug.cpp +++ b/src/utilcode/debug.cpp @@ -349,13 +349,6 @@ bool _DbgBreakCheck( STATIC_CONTRACT_FORBID_FAULT; STATIC_CONTRACT_DEBUG_ONLY; - RaiseExceptionOnAssert(rTestAndRaise); - - if (DebugBreakOnAssert()) - { - DebugBreak(); - } - DBGIGNORE* pDBGIFNORE = GetDBGIGNORE(); _DBGIGNOREDATA *psData; int i; @@ -558,13 +551,6 @@ bool _DbgBreakCheckNoThrow( STATIC_CONTRACT_FORBID_FAULT; STATIC_CONTRACT_DEBUG_ONLY; - RaiseExceptionOnAssert(rTestAndRaise); - - if (DebugBreakOnAssert()) - { - DebugBreak(); - } - bool failed = false; bool result = false; EX_TRY @@ -707,11 +693,6 @@ VOID DbgAssertDialog(const char *szFile, int iLine, const char *szExpr) RaiseExceptionOnAssert(rTestAndRaise); - if (DebugBreakOnAssert()) - { - DebugBreak(); - } - BOOL fConstrained = FALSE; DWORD dwAssertStacktrace = CLRConfig::GetConfigValue(CLRConfig::INTERNAL_AssertStacktrace); diff --git a/src/vm/ceemain.cpp b/src/vm/ceemain.cpp index 77299b4f42..d6391056ab 100644 --- a/src/vm/ceemain.cpp +++ b/src/vm/ceemain.cpp @@ -1441,13 +1441,16 @@ HRESULT EEStartup(COINITIEE fFlags) _ASSERTE(!g_fEEStarted && !g_fEEInit && SUCCEEDED (g_EEStartupStatus)); -#if defined(FEATURE_PAL) && !defined(CROSSGEN_COMPILE) - DacGlobals::Initialize(); - InitializeJITNotificationTable(); -#endif - PAL_TRY(COINITIEE *, pfFlags, &fFlags) { +#ifndef CROSSGEN_COMPILE +#ifdef FEATURE_PAL + DacGlobals::Initialize(); + InitializeJITNotificationTable(); +#endif + InitializeClrNotifications(); +#endif // CROSSGEN_COMPILE + EEStartupHelper(*pfFlags); } PAL_EXCEPT_FILTER (FilterStartupException) diff --git a/src/vm/util.cpp b/src/vm/util.cpp index 6728e26a27..36c02128b9 100644 --- a/src/vm/util.cpp +++ b/src/vm/util.cpp @@ -3250,6 +3250,8 @@ BOOL GcNotifications::SetNotification(GcEvtArgs ev) return TRUE; } +GARY_IMPL(size_t, g_clrNotificationArguments, MAX_CLR_NOTIFICATION_ARGS); + #ifdef DACCESS_COMPILE GcNotification *GcNotifications::InitializeNotificationTable(UINT TableSize) @@ -3273,10 +3275,12 @@ BOOL GcNotifications::UpdateOutOfProcTable() { return ::UpdateOutOfProcTable<GcNotification>(g_pGcNotificationTable, m_gcTable - 1, GetTableSize() + 1); } -#endif // DACCESS_COMPILE +#else // DACCESS_COMPILE + +static CrstStatic g_clrNotificationCrst; -void DACNotifyExceptionHelper(TADDR *args,UINT argCount) +void DACRaiseException(TADDR *args, UINT argCount) { struct Param { @@ -3287,18 +3291,40 @@ void DACNotifyExceptionHelper(TADDR *args,UINT argCount) param.argCount = argCount; PAL_TRY(Param *, pParam, ¶m) - { - if (IsDebuggerPresent() && !CORDebuggerAttached()) - { - RaiseException(CLRDATA_NOTIFY_EXCEPTION, 0, pParam->argCount, (ULONG_PTR *) pParam->args); - } + { + RaiseException(CLRDATA_NOTIFY_EXCEPTION, 0, pParam->argCount, (ULONG_PTR *)pParam->args); } PAL_EXCEPT(EXCEPTION_EXECUTE_HANDLER) - { + { } PAL_ENDTRY } +void DACNotifyExceptionHelper(TADDR *args, UINT argCount) +{ + _ASSERTE(argCount <= MAX_CLR_NOTIFICATION_ARGS); + + if (IsDebuggerPresent() && !CORDebuggerAttached()) + { + CrstHolder lh(&g_clrNotificationCrst); + + for (UINT i = 0; i < argCount; i++) + { + g_clrNotificationArguments[i] = args[i]; + } + + DACRaiseException(args, argCount); + + g_clrNotificationArguments[0] = NULL; + } +} + +void InitializeClrNotifications() +{ + g_clrNotificationCrst.Init(CrstClrNotification); + g_clrNotificationArguments[0] = NULL; +} + // <TODO> FIX IN BETA 2 // // g_dacNotificationFlags is only modified by the DAC and therefore the @@ -3318,18 +3344,19 @@ void DACNotifyExceptionHelper(TADDR *args,UINT argCount) #pragma warning(disable: 4748) #pragma optimize("", off) #endif // _MSC_VER - // called from the runtime + +// called from the runtime void DACNotify::DoJITNotification(MethodDesc *MethodDescPtr) { WRAPPER_NO_CONTRACT; TADDR Args[2] = { JIT_NOTIFICATION, (TADDR) MethodDescPtr }; - DACNotifyExceptionHelper(Args,2); + DACNotifyExceptionHelper(Args, 2); } void DACNotify::DoJITDiscardNotification(MethodDesc *MethodDescPtr) { TADDR Args[2] = { JIT_DISCARD_NOTIFICATION, (TADDR) MethodDescPtr }; - DACNotifyExceptionHelper(Args,2); + DACNotifyExceptionHelper(Args, 2); } void DACNotify::DoModuleLoadNotification(Module *ModulePtr) @@ -3387,7 +3414,9 @@ void DACNotify::DoExceptionCatcherEnterNotification(MethodDesc *MethodDescPtr, D #endif // _MSC_VER // </TODO> - // called from the DAC +#endif // DACCESS_COMPILE + +// called from the DAC int DACNotify::GetType(TADDR Args[]) { // Type is an enum, and will thus fit into an int. diff --git a/src/vm/util.hpp b/src/vm/util.hpp index 961870c888..ff5ab888a8 100644 --- a/src/vm/util.hpp +++ b/src/vm/util.hpp @@ -1077,7 +1077,12 @@ struct JITNotification } }; -GPTR_DECL(JITNotification,g_pNotificationTable); +// The maximum number of TADDR sized arguments that the SOS exception notification can use +#define MAX_CLR_NOTIFICATION_ARGS 3 +GARY_DECL(size_t, g_clrNotificationArguments, MAX_CLR_NOTIFICATION_ARGS); +extern void InitializeClrNotifications(); + +GPTR_DECL(JITNotification, g_pNotificationTable); GVAL_DECL(ULONG32, g_dacNotificationFlags); #if defined(FEATURE_PAL) && !defined(DACCESS_COMPILE) |