Skip to content

Instantly share code, notes, and snippets.

@kangaroo
Created January 22, 2016 19:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kangaroo/4bd035dd5dd05ab5e740 to your computer and use it in GitHub Desktop.
Save kangaroo/4bd035dd5dd05ab5e740 to your computer and use it in GitHub Desktop.
diff --git a/src/pal/src/exception/seh-unwind.cpp b/src/pal/src/exception/seh-unwind.cpp
index 9cc2112..c53e93b 100644
--- a/src/pal/src/exception/seh-unwind.cpp
+++ b/src/pal/src/exception/seh-unwind.cpp
@@ -169,7 +169,7 @@ static void GetContextPointer(unw_cursor_t *cursor, unw_context_t *unwContext, i
{
SIZE_T *pLoc = (SIZE_T *)saveLoc.u.addr;
// Filter out fake save locations that point to unwContext
- if ((pLoc < (SIZE_T *)unwContext) || ((SIZE_T *)(unwContext + 1) <= pLoc))
+ if (unwContext == NULL || (pLoc < (SIZE_T *)unwContext) || ((SIZE_T *)(unwContext + 1) <= pLoc))
*contextPointer = (SIZE_T *)saveLoc.u.addr;
}
#endif
@@ -483,7 +483,6 @@ BOOL PAL_VirtualUnwindOutOfProc(CONTEXT *context,
LockHolder lockHolder(&lock.cs);
int st;
- unw_context_t unwContext;
unw_cursor_t cursor;
unw_addr_space_t addrSpace = 0;
void *libunwindUptPtr = NULL;
@@ -491,16 +490,6 @@ BOOL PAL_VirtualUnwindOutOfProc(CONTEXT *context,
LibunwindCallbacksInfo.Context = context;
LibunwindCallbacksInfo.readMemCallback = readMemCallback;
-#if UNWIND_CONTEXT_IS_UCONTEXT_T
- WinContextToUnwindContext(context, &unwContext);
-#else
- st = unw_getcontext(&unwContext);
- if (st < 0)
- {
- result = FALSE;
- goto Exit;
- }
-#endif
addrSpace = unw_create_addr_space(&unwind_accessors, 0);
#ifdef HAVE_LIBUNWIND_PTRACE
@@ -524,7 +513,7 @@ BOOL PAL_VirtualUnwindOutOfProc(CONTEXT *context,
if (contextPointers != NULL)
{
- GetContextPointers(&cursor, &unwContext, contextPointers);
+ GetContextPointers(&cursor, NULL, contextPointers);
}
result = TRUE;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment