Introduce a separate preprocessor macro, _LIBUNWIND_USE_DLADDR, for directly controll...
authorJordan Rupprecht <rupprecht@google.com>
Fri, 29 Jun 2018 20:41:50 +0000 (20:41 +0000)
committerJordan Rupprecht <rupprecht@google.com>
Fri, 29 Jun 2018 20:41:50 +0000 (20:41 +0000)
Reviewers: saugustine

Subscribers: christof, chrib, cfe-commits, echristo

Differential Revision: https://reviews.llvm.org/D48733

llvm-svn: 336014

libunwind/src/AddressSpace.hpp

index 32ff1f3..e3a7e40 100644 (file)
 #include <stdlib.h>
 #include <string.h>
 
-#if !defined(_LIBUNWIND_IS_BAREMETAL) && !defined(_WIN32)
+#ifndef _LIBUNWIND_USE_DLADDR
+  #if !defined(_LIBUNWIND_IS_BAREMETAL) && !defined(_WIN32)
+    #define _LIBUNWIND_USE_DLADDR 1
+  #else
+    #define _LIBUNWIND_USE_DLADDR 0
+  #endif
+#endif
+
+#if _LIBUNWIND_USE_DLADDR
 #include <dlfcn.h>
 #endif
 
@@ -576,7 +584,7 @@ inline bool LocalAddressSpace::findOtherFDE(pint_t targetAddr, pint_t &fde) {
 inline bool LocalAddressSpace::findFunctionName(pint_t addr, char *buf,
                                                 size_t bufLen,
                                                 unw_word_t *offset) {
-#if !defined(_LIBUNWIND_IS_BAREMETAL) && !defined(_WIN32)
+#if _LIBUNWIND_USE_DLADDR
   Dl_info dyldInfo;
   if (dladdr((void *)addr, &dyldInfo)) {
     if (dyldInfo.dli_sname != NULL) {