summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJonghyun Park <parjong@gmail.com>2017-02-22 23:43:30 +0900
committerJan Vorlicek <janvorli@microsoft.com>2017-02-22 15:43:30 +0100
commit1f5cae07e65d646fd57fdca7376d4b2f1dccad00 (patch)
treed89e5551e9c3e781285f33cc4d8c74dfc9d2715c /src
parent0b4e58ac7a455640a5410b6f647ca3044426ea56 (diff)
downloadcoreclr-1f5cae07e65d646fd57fdca7376d4b2f1dccad00.tar.gz
coreclr-1f5cae07e65d646fd57fdca7376d4b2f1dccad00.tar.bz2
coreclr-1f5cae07e65d646fd57fdca7376d4b2f1dccad00.zip
Clean up ClrUnwindEx (#9482)
* Clean up ClrUnwindEx
Diffstat (limited to 'src')
-rw-r--r--src/debug/ee/debugger.cpp4
-rw-r--r--src/vm/excep.cpp2
-rw-r--r--src/vm/excep.h7
-rw-r--r--src/vm/exceptionhandling.cpp15
-rw-r--r--src/vm/exceptionhandling.h2
5 files changed, 17 insertions, 13 deletions
diff --git a/src/debug/ee/debugger.cpp b/src/debug/ee/debugger.cpp
index b19ae9a6a6..0967c56075 100644
--- a/src/debug/ee/debugger.cpp
+++ b/src/debug/ee/debugger.cpp
@@ -8134,8 +8134,7 @@ LONG Debugger::NotifyOfCHFFilter(EXCEPTION_POINTERS* pExceptionPointers, PVOID p
pExState->GetFlags()->SetDebugCatchHandlerFound();
#ifdef DEBUGGING_SUPPORTED
-
-
+#ifdef DEBUGGER_EXCEPTION_INTERCEPTION_SUPPORTED
if ( (pThread != NULL) &&
(pThread->IsExceptionInProgress()) &&
(pThread->GetExceptionState()->GetFlags()->DebuggerInterceptInfo()) )
@@ -8146,6 +8145,7 @@ LONG Debugger::NotifyOfCHFFilter(EXCEPTION_POINTERS* pExceptionPointers, PVOID p
//
ClrDebuggerDoUnwindAndIntercept(X86_FIRST_ARG(EXCEPTION_CHAIN_END) pExceptionPointers->ExceptionRecord);
}
+#endif // DEBUGGER_EXCEPTION_INTERCEPTION_SUPPORTED
#endif // DEBUGGING_SUPPORTED
return EXCEPTION_CONTINUE_SEARCH;
diff --git a/src/vm/excep.cpp b/src/vm/excep.cpp
index a9c38eee2f..6c427399c3 100644
--- a/src/vm/excep.cpp
+++ b/src/vm/excep.cpp
@@ -4003,6 +4003,7 @@ LONG NotifyDebuggerLastChance(Thread *pThread,
UNINSTALL_NESTED_EXCEPTION_HANDLER();
+#ifdef DEBUGGER_EXCEPTION_INTERCEPTION_SUPPORTED
EX_TRY
{
// if the debugger wants to intercept the unhandled exception then we immediately unwind without returning
@@ -4022,6 +4023,7 @@ LONG NotifyDebuggerLastChance(Thread *pThread,
{
}
EX_END_CATCH(SwallowAllExceptions);
+#endif // DEBUGGER_EXCEPTION_INTERCEPTION_SUPPORTED
return retval;
}
diff --git a/src/vm/excep.h b/src/vm/excep.h
index 13d8a3b847..4c752932fd 100644
--- a/src/vm/excep.h
+++ b/src/vm/excep.h
@@ -745,9 +745,16 @@ bool IsInterceptableException(Thread *pThread);
// perform simple checking to see if the current exception is intercepted
bool CheckThreadExceptionStateForInterception();
+#ifndef FEATURE_PAL
+// Currently, only Windows supports ClrUnwindEx (used inside ClrDebuggerDoUnwindAndIntercept)
+#define DEBUGGER_EXCEPTION_INTERCEPTION_SUPPORTED
+#endif // !FEATURE_PAL
+
+#ifdef DEBUGGER_EXCEPTION_INTERCEPTION_SUPPORTED
// Intercept the current exception and start an unwind. This function may never return.
EXCEPTION_DISPOSITION ClrDebuggerDoUnwindAndIntercept(X86_FIRST_ARG(EXCEPTION_REGISTRATION_RECORD *pEstablisherFrame)
EXCEPTION_RECORD *pExceptionRecord);
+#endif // DEBUGGER_EXCEPTION_INTERCEPTION_SUPPORTED
LONG NotifyDebuggerLastChance(Thread *pThread,
EXCEPTION_POINTERS *pExceptionInfo,
diff --git a/src/vm/exceptionhandling.cpp b/src/vm/exceptionhandling.cpp
index 29906c5a90..1e51467789 100644
--- a/src/vm/exceptionhandling.cpp
+++ b/src/vm/exceptionhandling.cpp
@@ -79,12 +79,6 @@ static void DoEHLog(DWORD lvl, __in_z const char *fmt, ...);
TrackerAllocator g_theTrackerAllocator;
-void __declspec(noinline)
-ClrUnwindEx(EXCEPTION_RECORD* pExceptionRecord,
- UINT_PTR ReturnValue,
- UINT_PTR TargetIP,
- UINT_PTR TargetFrameSp);
-
bool FixNonvolatileRegisters(UINT_PTR uOriginalSP,
Thread* pThread,
CONTEXT* pContextRecord,
@@ -4112,6 +4106,7 @@ void ExceptionTracker::MakeCallbacksRelatedToHandler(
}
}
+#ifdef DEBUGGER_EXCEPTION_INTERCEPTION_SUPPORTED
//---------------------------------------------------------------------------------------
//
// This function is called by DefaultCatchHandler() to intercept an exception and start an unwind.
@@ -4148,6 +4143,7 @@ EXCEPTION_DISPOSITION ClrDebuggerDoUnwindAndIntercept(X86_FIRST_ARG(EXCEPTION_RE
UNREACHABLE();
}
+#endif // DEBUGGER_EXCEPTION_INTERCEPTION_SUPPORTED
#endif // DEBUGGING_SUPPORTED
#ifdef _DEBUG
@@ -5116,9 +5112,9 @@ BOOL HandleHardwareException(PAL_SEHException* ex)
#endif // FEATURE_PAL
+#ifndef FEATURE_PAL
void ClrUnwindEx(EXCEPTION_RECORD* pExceptionRecord, UINT_PTR ReturnValue, UINT_PTR TargetIP, UINT_PTR TargetFrameSp)
{
-#ifndef FEATURE_PAL
PVOID TargetFrame = (PVOID)TargetFrameSp;
CONTEXT ctx;
@@ -5129,13 +5125,10 @@ void ClrUnwindEx(EXCEPTION_RECORD* pExceptionRecord, UINT_PTR ReturnValue, UINT_
&ctx,
NULL); // HistoryTable
-#else // !FEATURE_PAL
- PORTABILITY_ASSERT("UNIXTODO: Implement unwinding for PAL");
-#endif // !FEATURE_PAL
-
// doesn't return
UNREACHABLE();
}
+#endif // !FEATURE_PAL
void TrackerAllocator::Init()
{
diff --git a/src/vm/exceptionhandling.h b/src/vm/exceptionhandling.h
index c6fe35ae09..71bcab749f 100644
--- a/src/vm/exceptionhandling.h
+++ b/src/vm/exceptionhandling.h
@@ -26,11 +26,13 @@ ProcessCLRException(IN PEXCEPTION_RECORD pExceptionRecord
IN OUT PT_DISPATCHER_CONTEXT pDispatcherContext);
+#ifndef FEATURE_PAL
void __declspec(noinline)
ClrUnwindEx(EXCEPTION_RECORD* pExceptionRecord,
UINT_PTR ReturnValue,
UINT_PTR TargetIP,
UINT_PTR TargetFrameSp);
+#endif // !FEATURE_PAL
typedef DWORD_PTR (HandlerFn)(UINT_PTR uStackFrame, Object* pExceptionObj);