summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike McLaughlin <mikem@microsoft.com>2015-12-08 18:58:30 -0800
committerMike McLaughlin <mikem@microsoft.com>2015-12-09 16:02:28 -0800
commit44f43e5d4ece85d05376c690263eea05e11e4174 (patch)
tree4af0dec0636fa6d5e737e43fbec0cf61ecd17b75
parentc27ae7b93c527b2f2865d530f5b4286b09c245cb (diff)
downloadcoreclr-44f43e5d4ece85d05376c690263eea05e11e4174.tar.gz
coreclr-44f43e5d4ece85d05376c690263eea05e11e4174.tar.bz2
coreclr-44f43e5d4ece85d05376c690263eea05e11e4174.zip
Disable h/w exceptions for coreclr (non-DAC) builds.
Fixes the recursive GC crash. Added FEATURE_ENABLE_HARDWARE_EXCEPTIONS to the PAL sxs exception tests so the h/w exceptions generated by the test dlls are caught. Also added to SOS/strike project. Also fixed sos "clrstack -i". The sos data target needed to implement ICorDebugDataTarget4::VirtualUnwind too.
-rw-r--r--src/ToolBox/SOS/Strike/CMakeLists.txt1
-rw-r--r--src/ToolBox/SOS/Strike/util.cpp39
-rw-r--r--src/inc/ex.h1
-rw-r--r--src/pal/inc/pal.h8
-rw-r--r--src/pal/src/exception/seh.cpp1
-rw-r--r--src/pal/tests/palsuite/exception_handling/pal_sxs/test1/CMakeLists.txt3
6 files changed, 48 insertions, 5 deletions
diff --git a/src/ToolBox/SOS/Strike/CMakeLists.txt b/src/ToolBox/SOS/Strike/CMakeLists.txt
index edb046e99e..21272082bc 100644
--- a/src/ToolBox/SOS/Strike/CMakeLists.txt
+++ b/src/ToolBox/SOS/Strike/CMakeLists.txt
@@ -84,6 +84,7 @@ if(WIN32)
ntdll.lib
)
else(WIN32)
+ add_definitions(-DFEATURE_ENABLE_HARDWARE_EXCEPTIONS)
add_definitions(-DPAL_STDCPP_COMPAT=1)
add_compile_options(-Wno-null-arithmetic)
add_compile_options(-Wno-format)
diff --git a/src/ToolBox/SOS/Strike/util.cpp b/src/ToolBox/SOS/Strike/util.cpp
index 8066a22ce9..ffc51852dc 100644
--- a/src/ToolBox/SOS/Strike/util.cpp
+++ b/src/ToolBox/SOS/Strike/util.cpp
@@ -4464,6 +4464,9 @@ protected:
// get an ICorDebugProcess back
//
class SOSDataTarget : public ICorDebugMutableDataTarget
+#ifdef FEATURE_PAL
+, public ICorDebugDataTarget4
+#endif
{
public:
SOSDataTarget() : m_ref(0)
@@ -4478,7 +4481,7 @@ public:
{
if (InterfaceId == IID_IUnknown)
{
- *pInterface = static_cast<IUnknown *>(this);
+ *pInterface = static_cast<IUnknown *>(static_cast<ICorDebugDataTarget *>(this));
}
else if (InterfaceId == IID_ICorDebugDataTarget)
{
@@ -4488,6 +4491,12 @@ public:
{
*pInterface = static_cast<ICorDebugMutableDataTarget *>(this);
}
+#ifdef FEATURE_PAL
+ else if (InterfaceId == IID_ICorDebugDataTarget4)
+ {
+ *pInterface = static_cast<ICorDebugDataTarget4 *>(this);
+ }
+#endif
else
{
*pInterface = NULL;
@@ -4547,6 +4556,10 @@ public:
ULONG32 request,
ULONG32 * pcbRead)
{
+ if (g_ExtData == NULL)
+ {
+ return E_UNEXPECTED;
+ }
return g_ExtData->ReadVirtual(address, pBuffer, request, (PULONG) pcbRead);
}
@@ -4557,6 +4570,10 @@ public:
BYTE * context)
{
#ifdef FEATURE_PAL
+ if (g_ExtSystem == NULL)
+ {
+ return E_UNEXPECTED;
+ }
return g_ExtSystem->GetThreadContextById(dwThreadOSID, contextFlags, contextSize, context);
#else
ULONG ulThreadIDOrig;
@@ -4604,6 +4621,10 @@ public:
const BYTE * pBuffer,
ULONG32 bytesRequested)
{
+ if (g_ExtData == NULL)
+ {
+ return E_UNEXPECTED;
+ }
return g_ExtData->WriteVirtual(address, (PVOID)pBuffer, bytesRequested, NULL);
}
@@ -4620,6 +4641,20 @@ public:
return E_NOTIMPL;
}
+#ifdef FEATURE_PAL
+ //
+ // ICorDebugDataTarget4
+ //
+ virtual HRESULT STDMETHODCALLTYPE VirtualUnwind(DWORD threadId, ULONG32 contextSize, PBYTE context)
+ {
+ if (g_ExtClient == NULL)
+ {
+ return E_UNEXPECTED;
+ }
+ return g_ExtClient->VirtualUnwind(threadId, contextSize, context);
+
+ }
+#endif // FEATURE_PAL
protected:
LONG m_ref;
@@ -4629,7 +4664,7 @@ HRESULT InitCorDebugInterfaceFromModule(ULONG64 ulBase, ICLRDebugging * pClrDebu
{
HRESULT hr;
- ToRelease<IUnknown> pSOSDataTarget = new SOSDataTarget;
+ ToRelease<ICorDebugMutableDataTarget> pSOSDataTarget = new SOSDataTarget;
pSOSDataTarget->AddRef();
ToRelease<ICLRDebuggingLibraryProvider> pSOSLibraryProvider = new SOSLibraryProvider;
diff --git a/src/inc/ex.h b/src/inc/ex.h
index bf135fc6e1..6837fa8519 100644
--- a/src/inc/ex.h
+++ b/src/inc/ex.h
@@ -11,6 +11,7 @@ void RetailAssertIfExpectedClean(); // Defined in src/utilcode/debug
#ifdef FEATURE_PAL
#define EX_TRY_HOLDER \
+ HardwareExceptionHolder \
NativeExceptionHolderCatchAll __exceptionHolder; \
__exceptionHolder.Push(); \
diff --git a/src/pal/inc/pal.h b/src/pal/inc/pal.h
index 0bf1fb6de5..c0c9ba70bc 100644
--- a/src/pal/inc/pal.h
+++ b/src/pal/inc/pal.h
@@ -6744,6 +6744,11 @@ public:
static bool IsEnabled();
};
+//
+// NOTE: Catching hardware exceptions are only enabled in the DAC and SOS
+// builds. A hardware exception in coreclr code will fail fast/terminate
+// the process.
+//
#ifdef FEATURE_ENABLE_HARDWARE_EXCEPTIONS
#define HardwareExceptionHolder CatchHardwareExceptionHolder __catchHardwareException;
#else
@@ -6760,7 +6765,7 @@ extern "C++" {
// filter to be called during the first pass to better emulate SEH
// the xplat platforms that only have C++ exception support.
//
-class NativeExceptionHolderBase : CatchHardwareExceptionHolder
+class NativeExceptionHolderBase
{
// Save the address of the holder head so the destructor
// doesn't have access the slow (on Linux) TLS value again.
@@ -6870,6 +6875,7 @@ public:
}; \
try \
{ \
+ HardwareExceptionHolder \
auto __exceptionHolder = NativeExceptionHolderFactory::CreateHolder(&exceptionFilter); \
__exceptionHolder.Push(); \
tryBlock(__param); \
diff --git a/src/pal/src/exception/seh.cpp b/src/pal/src/exception/seh.cpp
index 22f8aef499..87bc677296 100644
--- a/src/pal/src/exception/seh.cpp
+++ b/src/pal/src/exception/seh.cpp
@@ -263,7 +263,6 @@ __declspec(thread)
static NativeExceptionHolderBase *t_nativeExceptionHolderHead = nullptr;
NativeExceptionHolderBase::NativeExceptionHolderBase()
- : CatchHardwareExceptionHolder()
{
m_head = nullptr;
m_next = nullptr;
diff --git a/src/pal/tests/palsuite/exception_handling/pal_sxs/test1/CMakeLists.txt b/src/pal/tests/palsuite/exception_handling/pal_sxs/test1/CMakeLists.txt
index 949fe9294a..fd9af67414 100644
--- a/src/pal/tests/palsuite/exception_handling/pal_sxs/test1/CMakeLists.txt
+++ b/src/pal/tests/palsuite/exception_handling/pal_sxs/test1/CMakeLists.txt
@@ -3,7 +3,8 @@ cmake_minimum_required(VERSION 2.8.12.2)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
if(CLR_CMAKE_PLATFORM_UNIX)
- add_compile_options(-fPIC)
+ add_compile_options(-fPIC)
+ add_definitions(-DFEATURE_ENABLE_HARDWARE_EXCEPTIONS)
endif(CLR_CMAKE_PLATFORM_UNIX)
# Test DLL1