summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene <Eugene.Zemtsov@microsoft.com>2015-09-30 18:09:12 -0700
committerEugene <Eugene.Zemtsov@microsoft.com>2015-09-30 18:09:12 -0700
commitf1d46b8b6a2fd2a47afbcb6cf2e4194b557efdd1 (patch)
tree7bb217104937745e596cc2dd09349fe3a62c0b05
parent6fa92e3cf8f013b5e694a4716f4b752375f38439 (diff)
downloadcoreclr-f1d46b8b6a2fd2a47afbcb6cf2e4194b557efdd1.tar.gz
coreclr-f1d46b8b6a2fd2a47afbcb6cf2e4194b557efdd1.tar.bz2
coreclr-f1d46b8b6a2fd2a47afbcb6cf2e4194b557efdd1.zip
Remove references to libunwind-ptrace to fix build on RPM distros
-rw-r--r--src/pal/src/CMakeLists.txt1
-rw-r--r--src/pal/src/exception/seh-unwind.cpp34
2 files changed, 30 insertions, 5 deletions
diff --git a/src/pal/src/CMakeLists.txt b/src/pal/src/CMakeLists.txt
index 456a8d0270..20393cd17e 100644
--- a/src/pal/src/CMakeLists.txt
+++ b/src/pal/src/CMakeLists.txt
@@ -224,7 +224,6 @@ if(CMAKE_SYSTEM_NAME STREQUAL Linux)
rt
dl
unwind
- unwind-ptrace
unwind-generic
)
endif(CMAKE_SYSTEM_NAME STREQUAL Linux)
diff --git a/src/pal/src/exception/seh-unwind.cpp b/src/pal/src/exception/seh-unwind.cpp
index 7a0a81fa3f..5a8c67160f 100644
--- a/src/pal/src/exception/seh-unwind.cpp
+++ b/src/pal/src/exception/seh-unwind.cpp
@@ -36,7 +36,9 @@ Abstract:
#endif // !__LINUX__
#include <libunwind.h>
#ifdef __LINUX__
+#ifdef HAVE_LIBUNWIND_PTRACE
#include <libunwind-ptrace.h>
+#endif // HAVE_LIBUNWIND_PTRACE
#endif // __LINUX__
#endif // HAVE_LIBUNWIND_H
@@ -327,7 +329,6 @@ BOOL PAL_VirtualUnwind(CONTEXT *context, KNONVOLATILE_CONTEXT_POINTERS *contextP
#ifdef _AMD64_
#ifdef __LINUX__
-
static struct LibunwindCallbacksInfoType
{
CONTEXT *Context;
@@ -435,10 +436,31 @@ static int get_proc_name(unw_addr_space_t as, unw_word_t addr, char *bufp, size_
return -UNW_EINVAL;
}
+int find_proc_info(unw_addr_space_t as,
+ unw_word_t ip, unw_proc_info_t *pip,
+ int need_unwind_info, void *arg)
+{
+#ifdef HAVE_LIBUNWIND_PTRACE
+ // UNIXTODO: libunwind RPM package on Fedora/CentOS/RedHat doesn't have libunwind-ptrace.so
+ // and we can't use it from a shared library like libmscordaccore.so.
+ // That's why all calls to ptrace parts of libunwind ifdeffed out for now.
+ return _UPT_find_proc_info(as, ip, pip, need_unwind_info, arg);
+#else
+ return -UNW_EINVAL;
+#endif
+}
+
+void put_unwind_info(unw_addr_space_t as, unw_proc_info_t *pip, void *arg)
+{
+#ifdef HAVE_LIBUNWIND_PTRACE
+ return _UPT_put_unwind_info(as, pip, arg);
+#endif
+}
+
static unw_accessors_t unwind_accessors =
{
- .find_proc_info = _UPT_find_proc_info,
- .put_unwind_info = _UPT_put_unwind_info,
+ .find_proc_info = find_proc_info,
+ .put_unwind_info = put_unwind_info,
.get_dyn_info_list_addr = get_dyn_info_list_addr,
.access_mem = access_mem,
.access_reg = access_reg,
@@ -494,7 +516,9 @@ BOOL PAL_VirtualUnwindOutOfProc(CONTEXT *context,
LibunwindCallbacksInfo.readMemCallback = readMemCallback;
WinContextToUnwindContext(context, &unwContext);
addrSpace = unw_create_addr_space(&unwind_accessors, 0);
+#ifdef HAVE_LIBUNWIND_PTRACE
libunwindUptPtr = _UPT_create(pid);
+#endif
st = unw_init_remote(&cursor, addrSpace, libunwindUptPtr);
if (st < 0)
{
@@ -518,10 +542,12 @@ BOOL PAL_VirtualUnwindOutOfProc(CONTEXT *context,
result = TRUE;
Exit:
- if (libunwindUptPtr != nullptr)
+#ifdef HAVE_LIBUNWIND_PTRACE
+ if (libunwindUptPtr != NULL)
{
_UPT_destroy(libunwindUptPtr);
}
+#endif
if (addrSpace != 0)
{
unw_destroy_addr_space(addrSpace);