Skip to content

Instantly share code, notes, and snippets.

@kangaroo
Created January 22, 2016 19:51

Revisions

  1. kangaroo created this gist Jan 22, 2016.
    47 changes: 47 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,47 @@
    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;