summaryrefslogtreecommitdiff
path: root/src/pal
diff options
context:
space:
mode:
authorJostein Kjønigsen <jostein@kjonigsen.net>2015-06-15 08:17:01 +0200
committerJostein Kjønigsen <jostein@kjonigsen.net>2015-06-18 21:38:02 +0200
commitf264140379ed264333a81193fd9f02244497b91f (patch)
treec247f2c45e615fcf7d74efb3493903eb45e8b979 /src/pal
parent06e2365c0d27e0d20fa13bfe481bc7d07cae8f8b (diff)
downloadcoreclr-f264140379ed264333a81193fd9f02244497b91f.tar.gz
coreclr-f264140379ed264333a81193fd9f02244497b91f.tar.bz2
coreclr-f264140379ed264333a81193fd9f02244497b91f.zip
Fix stack unwinding for FreeBSD.
Fix error in stack unwinding on FreeBSD as discovered by @saper. This closes #1102 and #1113
Diffstat (limited to 'src/pal')
-rw-r--r--src/pal/src/exception/seh-unwind.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/pal/src/exception/seh-unwind.cpp b/src/pal/src/exception/seh-unwind.cpp
index 22742d1f5d..a6435a42f4 100644
--- a/src/pal/src/exception/seh-unwind.cpp
+++ b/src/pal/src/exception/seh-unwind.cpp
@@ -131,7 +131,7 @@ BOOL PAL_VirtualUnwind(CONTEXT *context, KNONVOLATILE_CONTEXT_POINTERS *contextP
int st;
unw_context_t unwContext;
unw_cursor_t cursor;
-#if defined(__APPLE__)
+#if defined(__APPLE__) || defined(__FreeBSD__)
DWORD64 curPc;
#endif
@@ -156,8 +156,8 @@ BOOL PAL_VirtualUnwind(CONTEXT *context, KNONVOLATILE_CONTEXT_POINTERS *contextP
WinContextToUnwindCursor(context, &cursor);
#endif
-#if defined(__APPLE__)
- // OSX appears to do two different things when unwinding
+#if defined(__APPLE__) || defined(__FreeBSD__)
+ // OSX and FreeBSD appear to do two different things when unwinding
// 1: If it reaches where it cannot unwind anymore, say a
// managed frame. It wil return 0, but also update the $pc
// 2: If it unwinds all the way to _start it will return
@@ -177,7 +177,7 @@ BOOL PAL_VirtualUnwind(CONTEXT *context, KNONVOLATILE_CONTEXT_POINTERS *contextP
// Update the passed in windows context to reflect the unwind
//
UnwindContextToWinContext(&cursor, context);
-#if defined(__APPLE__)
+#if defined(__APPLE__) || defined(__FreeBSD__)
if (st == 0 && context->Rip == curPc)
{
context->Rip = 0;