From 34eabea5f29c2d2adf2725268a2f1916febc8a7b Mon Sep 17 00:00:00 2001 From: danmosemsft Date: Wed, 15 Feb 2017 14:55:46 -0800 Subject: [PATCH] Remove never defined FEATURE_UEF_CHAINMANAGER Commit migrated from https://github.com/dotnet/coreclr/commit/147a06fa8a031d57b43c8e7ac2bfd6e9fd8328b3 --- src/coreclr/src/inc/mscoruef.idl | 117 ---------------------------------- src/coreclr/src/vm/ceemain.cpp | 4 -- src/coreclr/src/vm/dwreport.cpp | 57 ----------------- src/coreclr/src/vm/dwreport.h | 2 - src/coreclr/src/vm/excep.cpp | 118 ----------------------------------- src/coreclr/src/vm/gcenv.h | 4 -- src/coreclr/src/vm/mscoruefwrapper.h | 19 ------ src/coreclr/src/vm/threads.cpp | 12 ---- 8 files changed, 333 deletions(-) delete mode 100644 src/coreclr/src/inc/mscoruef.idl delete mode 100644 src/coreclr/src/vm/mscoruefwrapper.h diff --git a/src/coreclr/src/inc/mscoruef.idl b/src/coreclr/src/inc/mscoruef.idl deleted file mode 100644 index 4ed554f..0000000 --- a/src/coreclr/src/inc/mscoruef.idl +++ /dev/null @@ -1,117 +0,0 @@ -// 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. -// - -// -/************************************************************************************** - ** ** - ** Mscoruef.idl - interface definitions for internal UEF chain management. ** - ** ** - **************************************************************************************/ - -// -// Interface descriptions -// -import "unknwn.idl"; - -cpp_quote("#ifdef FEATURE_UEF_CHAINMANAGER") - -// IID IUEFManager : uuid(F4D25DF3-E9B3-439c-8B2B-C814E36F9404) -cpp_quote("EXTERN_GUID(IID_IUEFManager, 0xf4d25df3, 0xe9b3, 0x439c, 0x8b, 0x2b, 0xc8, 0x14, 0xe3, 0x6f, 0x94, 0x4);") - -// IID IWatsonSxSManager :uuid(A269593A-51E2-46bf-B914-8DCC5C39B5A5) -cpp_quote("EXTERN_GUID(IID_IWatsonSxSManager, 0xa269593a, 0x51e2, 0x46bf, 0xb9, 0x14, 0x8d, 0xcc, 0x5c, 0x39, 0xb5, 0xa5);") - -cpp_quote("#ifdef __midl") - -#define EXCEPTION_MAXIMUM_PARAMETERS 15 - -typedef struct _EXCEPTION_RECORD { - DWORD ExceptionCode; - DWORD ExceptionFlags; - struct _EXCEPTION_RECORD *ExceptionRecord; - PVOID ExceptionAddress; - DWORD NumberParameters; - ULONG_PTR ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS]; -} EXCEPTION_RECORD, *PEXCEPTION_RECORD; - -typedef struct _EXCEPTION_POINTERS { - PEXCEPTION_RECORD ExceptionRecord; - PVOID ContextRecord; // not using PCONTEXT here to avoid pulling extra definitions into this file -} EXCEPTION_POINTERS, *PEXCEPTION_POINTERS, *LPEXCEPTION_POINTERS; - -typedef LONG (__stdcall *PTOP_LEVEL_EXCEPTION_FILTER)( - struct _EXCEPTION_POINTERS * pExceptionPointers); - -typedef PTOP_LEVEL_EXCEPTION_FILTER LPTOP_LEVEL_EXCEPTION_FILTER; - -cpp_quote("#endif // __midl") - -typedef BOOL (__stdcall * IsExceptionFromManagedCodeFnPtr)(EXCEPTION_RECORD * pExceptionRecord); - -//***************************************************************************** -// Interface for Watson SxS management to the VM. -//***************************************************************************** -[ - uuid(A269593A-51E2-46bf-B914-8DCC5C39B5A5), - helpstring("CLR Watson SxS Management Interface"), - pointer_default(unique), - local -] -interface IWatsonSxSManager : IUnknown -{ - // Used to register an exception claiming callback - BOOL RegisterExceptionClaimingCallback( - [in] IsExceptionFromManagedCodeFnPtr pCallback); - - // Used to unregister an exception claiming callback - BOOL UnregisterExceptionClaimingCallback( - [in] IsExceptionFromManagedCodeFnPtr pCallback); - - // Used to determine if the exception pointed by pExceptionRecord was thrown by a registered runtime - BOOL IsExceptionClaimed( - [in] EXCEPTION_RECORD * pExceptionRecord); - - // Used to check if Watson has been triggered - BOOL HasWatsonBeenTriggered(void); - - // Used to bestow the permission to report Watson to only one of its callers - BOOL IsCurrentRuntimeAllowedToReportWatson(void); - - // Used to wait for the Watson SxS completion event - BOOL WaitForWatsonSxSCompletionEvent(void); - - // Used to signal Watson SxS completion event - BOOL SignalWatsonSxSCompletionEvent(void); -}; - -//***************************************************************************** -// Interface for UEF chain management to the VM. -//***************************************************************************** -[ - uuid(F4D25DF3-E9B3-439c-8B2B-C814E36F9404), - helpstring("CLR UEF Chain Management Interface"), - pointer_default(unique), - local -] -interface IUEFManager : IUnknown -{ - // Used to register the function to be invoked upon unhandled exception - // notification from the OS - BOOL AddUnhandledExceptionFilter( - [in] LPTOP_LEVEL_EXCEPTION_FILTER uefCallbackFunc, - [in] BOOL firstHandler); - - // Used to unregister a previously registered UEF callback - BOOL RemoveUnhandledExceptionFilter( - [in] LPTOP_LEVEL_EXCEPTION_FILTER uefCallbackFunc); - - // Used to explicitly invoke the registered UEF callbacks - LONG InvokeUEFCallbacks(LPEXCEPTION_POINTERS pExceptionInfo); - - // Used to return the WatsonSxSManager singleton instance - IWatsonSxSManager * GetWastonSxSManagerInstance(void); -}; - -cpp_quote("#endif // FEATURE_UEF_CHAINMANAGER") diff --git a/src/coreclr/src/vm/ceemain.cpp b/src/coreclr/src/vm/ceemain.cpp index 0cf57bf..59ad618 100644 --- a/src/coreclr/src/vm/ceemain.cpp +++ b/src/coreclr/src/vm/ceemain.cpp @@ -238,10 +238,6 @@ #include "../binder/inc/coreclrbindercommon.h" -#ifdef FEATURE_UEF_CHAINMANAGER -// This is required to register our UEF callback with the UEF chain manager -#include -#endif // FEATURE_UEF_CHAINMANAGER #ifdef FEATURE_PERFMAP #include "perfmap.h" diff --git a/src/coreclr/src/vm/dwreport.cpp b/src/coreclr/src/vm/dwreport.cpp index 6414ff5..1ff3dea 100644 --- a/src/coreclr/src/vm/dwreport.cpp +++ b/src/coreclr/src/vm/dwreport.cpp @@ -29,10 +29,6 @@ #include "imagehlp.h" -#ifdef FEATURE_UEF_CHAINMANAGER -// This is required to register our UEF callback with the UEF chain manager -#include -#endif // FEATURE_UEF_CHAINMANAGER EFaultRepRetVal DoReportFault(EXCEPTION_POINTERS * pExceptionInfo); @@ -42,9 +38,7 @@ static BOOL g_watsonErrorReportingEnabled = FALSE; // Variables to control launching Watson only once, but making all threads wait for that single launch to finish. LONG g_watsonAlreadyLaunched = 0; // Used to note that another thread has done Watson. -#if !defined(FEATURE_UEF_CHAINMANAGER) HandleHolder g_hWatsonCompletionEvent = NULL; // Used to signal that Watson has finished. -#endif // FEATURE_UEF_CHAINMANAGER const WCHAR kErrorReportingPoliciesKey[] = W("SOFTWARE\\Policies\\Microsoft\\PCHealth\\ErrorReporting"); const WCHAR kErrorReportingKey[] = W("SOFTWARE\\Microsoft\\PCHealth\\ErrorReporting"); @@ -177,14 +171,10 @@ BOOL InitializeWatson(COINITIEE fFlags) return TRUE; } -#if defined(FEATURE_UEF_CHAINMANAGER) - return TRUE; -#else // Create the event that all-but-the-first threads will wait on (the first thread // will set the event when Watson is done.) g_hWatsonCompletionEvent = WszCreateEvent(NULL, TRUE /*manual reset*/, FALSE /*initial state*/, NULL); return (g_hWatsonCompletionEvent != NULL); -#endif // FEATURE_UEF_CHAINMANAGER } // BOOL InitializeWatson() @@ -2219,7 +2209,6 @@ FaultReportResult DoFaultReportWorker( // Was Watson attempted, successful? return FaultReportResultQuit; } -#if !defined(FEATURE_UEF_CHAINMANAGER) // If we've already tried to report a Watson crash once, we don't really // want to pester the user about this exception. This can occur in certain // pathological programs. @@ -2235,7 +2224,6 @@ FaultReportResult DoFaultReportWorker( // Was Watson attempted, successful? return FaultReportResultQuit; } } -#endif // FEATURE_UEF_CHAINMANAGER // Assume an unmanaged fault until we determine otherwise. BOOL bIsManagedFault = FALSE; @@ -3109,51 +3097,6 @@ FaultReportResult DoFaultReport( // Was Watson attempted, successful? return fri.m_faultReportResult; } -#ifdef FEATURE_UEF_CHAINMANAGER - if (g_pUEFManager && !tore.IsUserBreakpoint()) - { - IWatsonSxSManager * pWatsonSxSManager = g_pUEFManager->GetWastonSxSManagerInstance(); - - // Has Watson report been triggered? - if (pWatsonSxSManager->HasWatsonBeenTriggered()) - { - LOG((LF_EH, LL_INFO100, "DoFaultReport: Watson has been triggered.")); - LeaveRuntimeHolderNoThrow holder(reinterpret_cast< size_t >(WaitForSingleObject)); - pWatsonSxSManager->WaitForWatsonSxSCompletionEvent(); - return FaultReportResultQuit; - } - // The unhandled exception is thrown by the current runtime. - else if (IsExceptionFromManagedCode(pExceptionInfo->ExceptionRecord)) - { - // Is the current runtime allowed to report Watson? - if (!pWatsonSxSManager->IsCurrentRuntimeAllowedToReportWatson()) - { - LOG((LF_EH, LL_INFO100, "DoFaultReport: Watson is reported by another runtime.")); - LeaveRuntimeHolderNoThrow holder(reinterpret_cast< size_t >(WaitForSingleObject)); - pWatsonSxSManager->WaitForWatsonSxSCompletionEvent(); - return FaultReportResultQuit; - } - } - // The unhandled exception is thrown by another runtime in the process. - else if (pWatsonSxSManager->IsExceptionClaimed(pExceptionInfo->ExceptionRecord)) - { - LOG((LF_EH, LL_INFO100, "DoFaultReport: Watson will be reported by another runtime.\n")); - return FaultReportResultQuit; - } - // The unhandled exception is thrown by native code. - else - { - // Is the current runtime allowed to report Watson? - if (!pWatsonSxSManager->IsCurrentRuntimeAllowedToReportWatson()) - { - LOG((LF_EH, LL_INFO100, "DoFaultReport: Watson is reported by another runtime.")); - LeaveRuntimeHolderNoThrow holder(reinterpret_cast< size_t >(WaitForSingleObject)); - pWatsonSxSManager->WaitForWatsonSxSCompletionEvent(); - return FaultReportResultQuit; - } - } - } -#endif // FEATURE_UEF_CHAINMANAGER // Check if the current thread has the permission to open a process handle of the current process. // If not, the current thread may have been impersonated, we have to launch Watson from a new thread as in SO case. diff --git a/src/coreclr/src/vm/dwreport.h b/src/coreclr/src/vm/dwreport.h index 4430668..77ed0fd 100644 --- a/src/coreclr/src/vm/dwreport.h +++ b/src/coreclr/src/vm/dwreport.h @@ -81,9 +81,7 @@ void ResetWatsonBucketsFavorWorker(void * pParam); extern LONG g_watsonAlreadyLaunched; -#if !defined(FEATURE_UEF_CHAINMANAGER) extern HandleHolder g_hWatsonCompletionEvent; -#endif // FEATURE_UEF_CHAINMANAGER //---------------------------------------------------------------------------- // Passes data between DoFaultReport and DoFaultReportCallback diff --git a/src/coreclr/src/vm/excep.cpp b/src/coreclr/src/vm/excep.cpp index f9455d2..7fca6f0 100644 --- a/src/coreclr/src/vm/excep.cpp +++ b/src/coreclr/src/vm/excep.cpp @@ -48,12 +48,6 @@ #include #endif // FEATURE_PAL -#ifdef FEATURE_UEF_CHAINMANAGER -// This is required to register our UEF callback with the UEF chain manager -#include -// The global UEFManager reference for use in the VM -IUEFManager * g_pUEFManager = NULL; -#endif // FEATURE_UEF_CHAINMANAGER // Support for extracting MethodDesc of a delegate. #include "comdelegate.h" @@ -4342,14 +4336,7 @@ LONG WatsonLastChance( // EXCEPTION_CONTINUE_SEARCH, _CONTINUE_ result = DoFaultReport(pExceptionInfo, tore); // Set the event to indicate that Watson processing is completed. Other threads can continue. -#if defined(FEATURE_UEF_CHAINMANAGER) - if (g_pUEFManager) - { - g_pUEFManager->GetWastonSxSManagerInstance()->SignalWatsonSxSCompletionEvent(); - } -#else UnsafeSetEvent(g_hWatsonCompletionEvent); -#endif // FEATURE_UEF_CHAINMANAGER } } @@ -4843,88 +4830,6 @@ BOOL InstallUnhandledExceptionFilter() { STATIC_CONTRACT_FORBID_FAULT; #ifndef FEATURE_PAL -#ifdef FEATURE_UEF_CHAINMANAGER - if (g_pUEFManager == NULL) { - - /*CONTRACTL { - NOTHROW; - GC_NOTRIGGER; - MODE_PREEMPTIVE; - } CONTRACTL_END;*/ - - static HMODULE hMSCorEE; - - if (!hMSCorEE) { - hMSCorEE = WszGetModuleHandle(MSCOREE_SHIM_W); - if (!hMSCorEE) { - - _ASSERTE(!"InstallUnhandledExceptionFilter failed to get MSCorEE instance!"); - STRESS_LOG0(LF_EH, LL_INFO10, "InstallUnhandledExceptionFilter failed to get MSCorEE instance!\n"); - - // Failure to get instance of mscoree.dll is fatal since that would imply - // that we cannot setup our UEF - return FALSE; - } - } - - // Signature of GetCLRUEFManager exported by MSCorEE.dll - typedef HRESULT (*pGetCLRUEFManager)(REFIID riid, - IUnknown **ppUnk); - - static pGetCLRUEFManager pFuncGetCLRUEFManager; - - if (!pFuncGetCLRUEFManager) { - - // Try to get function address via ordinal - pFuncGetCLRUEFManager = (pGetCLRUEFManager)GetProcAddress(hMSCorEE, MAKEINTRESOURCEA(24)); - if (!pFuncGetCLRUEFManager) { - _ASSERTE(!"InstallUnhandledExceptionFilter failed to get UEFManager!"); - STRESS_LOG0(LF_EH, LL_INFO10, "InstallUnhandledExceptionFilter failed to find UEFManager!\n"); - return FALSE; - } - } - - HRESULT hr = (*pFuncGetCLRUEFManager)((REFIID)IID_IUEFManager, (IUnknown **)&g_pUEFManager); - if (FAILED(hr)) - { - _ASSERTE(!"InstallUnhandledExceptionFilter failed to get IUEFManager*!"); - - STRESS_LOG0(LF_EH, LL_INFO10, "InstallUnhandledExceptionFilter failed to get IUEFManager*\n"); - - // Ensure the reference to chain manager is NULL - g_pUEFManager= NULL; - - return FALSE; - } - - // Register our UEF callback with the UEF chain manager - if (!g_pUEFManager->AddUnhandledExceptionFilter(COMUnhandledExceptionFilter, TRUE)) - { - _ASSERTE(!"InstallUnhandledExceptionFilter failed to register the UEF callback!"); - - // Failed to register the UEF callback - STRESS_LOG0(LF_EH, LL_INFO10, "InstallUnhandledExceptionFilter failed to register the UEF callback!\n"); - - g_pUEFManager->Release(); - - // Ensure the reference to chain manager is NULL - g_pUEFManager= NULL; - - return FALSE; - } - - // Register our exception claiming callback with the UEF chain manager on preWin7 - if (!RunningOnWin7() && !g_pUEFManager->GetWastonSxSManagerInstance()->RegisterExceptionClaimingCallback(IsExceptionFromManagedCodeCallback)) - { - _ASSERTE(!"RegisterExceptionClaimingCallback failed to register the exception claiming callback!"); - - // Failed to register the exception claiming callback - STRESS_LOG0(LF_EH, LL_INFO10, "RegisterExceptionClaimingCallback failed to register the exception claiming callback!"); - - return FALSE; - } - } -#else // !FEATURE_UEF_CHAINMANAGER // We will be here only for CoreCLR on WLC since we dont // register UEF for SL. if (g_pOriginalUnhandledExceptionFilter == FILTER_NOT_INSTALLED) { @@ -4938,7 +4843,6 @@ BOOL InstallUnhandledExceptionFilter() { LOG((LF_EH, LL_INFO10, "InstallUnhandledExceptionFilter registered UEF with OS for CoreCLR!\n")); } _ASSERTE(g_pOriginalUnhandledExceptionFilter != FILTER_NOT_INSTALLED); -#endif // FEATURE_UEF_CHAINMANAGER #endif // !FEATURE_PAL // All done - successfully! @@ -4952,19 +4856,6 @@ void UninstallUnhandledExceptionFilter() { STATIC_CONTRACT_FORBID_FAULT; #ifndef FEATURE_PAL -#ifdef FEATURE_UEF_CHAINMANAGER - if (g_pUEFManager) - { - if (!RunningOnWin7()) - { - g_pUEFManager->GetWastonSxSManagerInstance()->UnregisterExceptionClaimingCallback(IsExceptionFromManagedCodeCallback); - } - - g_pUEFManager->RemoveUnhandledExceptionFilter(COMUnhandledExceptionFilter); - g_pUEFManager->Release(); - g_pUEFManager = NULL; - } -#else // !FEATURE_UEF_CHAINMANAGER // We will be here only for CoreCLR on WLC or on Mac SL. if (g_pOriginalUnhandledExceptionFilter != FILTER_NOT_INSTALLED) { @@ -4976,7 +4867,6 @@ void UninstallUnhandledExceptionFilter() { g_pOriginalUnhandledExceptionFilter = FILTER_NOT_INSTALLED; LOG((LF_EH, LL_INFO10, "UninstallUnhandledExceptionFilter unregistered UEF from OS for CoreCLR!\n")); } -#endif // FEATURE_UEF_CHAINMANAGER #endif // !FEATURE_PAL } @@ -5548,14 +5438,6 @@ LONG EntryPointFilter(PEXCEPTION_POINTERS pExceptionInfo, PVOID _pData) pThread->SetThreadStateNC(Thread::TSNC_ProcessedUnhandledException); } -#ifdef FEATURE_UEF_CHAINMANAGER - if (g_pUEFManager && (ret == EXCEPTION_CONTINUE_SEARCH)) - { - // Since the "UEF" of this runtime instance didnt handle the exception, - // invoke the other registered UEF callbacks as well - ret = g_pUEFManager->InvokeUEFCallbacks(pExceptionInfo); - } -#endif // FEATURE_UEF_CHAINMANAGER END_SO_INTOLERANT_CODE; diff --git a/src/coreclr/src/vm/gcenv.h b/src/coreclr/src/vm/gcenv.h index 2e234b1..865eb28 100644 --- a/src/coreclr/src/vm/gcenv.h +++ b/src/coreclr/src/vm/gcenv.h @@ -36,10 +36,6 @@ #endif // FEATURE_COMINTEROP -#ifdef FEATURE_UEF_CHAINMANAGER -// This is required to register our UEF callback with the UEF chain manager -#include -#endif // FEATURE_UEF_CHAINMANAGER #define GCMemoryStatus MEMORYSTATUSEX diff --git a/src/coreclr/src/vm/mscoruefwrapper.h b/src/coreclr/src/vm/mscoruefwrapper.h deleted file mode 100644 index 75b540c..0000000 --- a/src/coreclr/src/vm/mscoruefwrapper.h +++ /dev/null @@ -1,19 +0,0 @@ -// 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. -// - -// -//***************************************************************************** -// MSCorUEFWrapper.h - Wrapper for including the UEF chain manager definition -// and the global that references it for VM usage. -//***************************************************************************** - -#ifdef FEATURE_UEF_CHAINMANAGER - -// This is required to register our UEF callback with the UEF chain manager -#include -// Global reference to IUEFManager that will be used in the VM -extern IUEFManager * g_pUEFManager; - -#endif // FEATURE_UEF_CHAINMANAGER diff --git a/src/coreclr/src/vm/threads.cpp b/src/coreclr/src/vm/threads.cpp index 007b101..83dafd9 100644 --- a/src/coreclr/src/vm/threads.cpp +++ b/src/coreclr/src/vm/threads.cpp @@ -54,10 +54,6 @@ #include "olecontexthelpers.h" #endif // FEATURE_COMINTEROP_APARTMENT_SUPPORT -#ifdef FEATURE_UEF_CHAINMANAGER -// This is required to register our UEF callback with the UEF chain manager -#include -#endif // FEATURE_UEF_CHAINMANAGER SPTR_IMPL(ThreadStore, ThreadStore, s_pThreadStore); @@ -9309,14 +9305,6 @@ static LONG ThreadBaseRedirectingFilter(PEXCEPTION_POINTERS pExceptionInfo, LPVO } } -#ifdef FEATURE_UEF_CHAINMANAGER - if (g_pUEFManager && (ret == EXCEPTION_CONTINUE_SEARCH)) - { - // Since the "UEF" of this runtime instance didnt handle the exception, - // invoke the other registered UEF callbacks as well - ret = g_pUEFManager->InvokeUEFCallbacks(pExceptionInfo); - } -#endif // FEATURE_UEF_CHAINMANAGER END_SO_INTOLERANT_CODE; return ret; -- 2.7.4