From 4f86dee3d943568bef119e415ea8576e11108b1a Mon Sep 17 00:00:00 2001 From: Geoff Norton Date: Fri, 20 Feb 2015 08:32:03 -0800 Subject: [PATCH] Check for libunwind in configure, and setup seh-unwind to have possible other future alternatives --- src/pal/src/config.h.in | 1 + src/pal/src/configure.cmake | 1 + src/pal/src/exception/seh-unwind.cpp | 6 ++++++ 3 files changed, 8 insertions(+) diff --git a/src/pal/src/config.h.in b/src/pal/src/config.h.in index 6a32a57..03f31a0 100644 --- a/src/pal/src/config.h.in +++ b/src/pal/src/config.h.in @@ -13,6 +13,7 @@ #cmakedefine01 HAVE_SYS_TIME_H #cmakedefine01 HAVE_PTHREAD_NP_H #cmakedefine01 HAVE_SYS_LWP_H +#cmakedefine01 HAVE_LIBUNWIND_H #cmakedefine01 HAVE_KQUEUE #cmakedefine01 HAVE_GETPWUID_R diff --git a/src/pal/src/configure.cmake b/src/pal/src/configure.cmake index 0da2498..9bfaa62 100644 --- a/src/pal/src/configure.cmake +++ b/src/pal/src/configure.cmake @@ -16,6 +16,7 @@ check_include_files(crt_externs.h HAVE_CRT_EXTERNS_H) check_include_files(sys/time.h HAVE_SYS_TIME_H) check_include_files(pthread_np.h HAVE_PTHREAD_NP_H) check_include_files(sys/lwp.h HAVE_SYS_LWP_H) +check_include_files(libunwind.h HAVE_LIBUNWIND_H) check_function_exists(kqueue HAVE_KQUEUE) check_function_exists(getpwuid_r HAVE_GETPWUID_R) diff --git a/src/pal/src/exception/seh-unwind.cpp b/src/pal/src/exception/seh-unwind.cpp index b3b5d18..da4bed6 100644 --- a/src/pal/src/exception/seh-unwind.cpp +++ b/src/pal/src/exception/seh-unwind.cpp @@ -28,8 +28,10 @@ Abstract: #include "pal/context.h" #include #include +#if HAVE_LIBUNWIND_H #define UNW_LOCAL_ONLY #include +#endif //---------------------------------------------------------------------- // Exception Handling ABI Level I: Base ABI @@ -74,6 +76,7 @@ struct __cxa_exception // Virtual Unwinding //---------------------------------------------------------------------- +#if HAVE_LIBUNWIND_H #if UNWIND_CONTEXT_IS_UCONTEXT_T static void WinContextToUnwindContext(CONTEXT *winContext, unw_context_t *unwContext) { @@ -195,6 +198,9 @@ BOOL PAL_VirtualUnwind(CONTEXT *context, KNONVOLATILE_CONTEXT_POINTERS *contextP return TRUE; } +#else +#error don't know how to unwind on this platform +#endif #if _DEBUG //---------------------------------------------------------------------- -- 2.7.4