diff options
author | Reid Kleckner <rnk@google.com> | 2015-11-09 23:10:29 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2015-11-09 23:10:29 +0000 |
commit | 40aa9c6d00854e13c75e1c360576039e1c1f35a7 (patch) | |
tree | 608edea183a013efb73039d9046ae17d0aa69af6 /llvm/lib/Support | |
parent | 99448c636759490c72f556ec8792eed868e955ae (diff) | |
download | bcm5719-llvm-40aa9c6d00854e13c75e1c360576039e1c1f35a7.tar.gz bcm5719-llvm-40aa9c6d00854e13c75e1c360576039e1c1f35a7.zip |
Combine ifdefs around dl_iterate_phdr in Unix/Signals.inc
This avoids the need to have two dummy implementations of
findModulesAndOffsets.
llvm-svn: 252531
Diffstat (limited to 'llvm/lib/Support')
-rw-r--r-- | llvm/lib/Support/Unix/Signals.inc | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/llvm/lib/Support/Unix/Signals.inc b/llvm/lib/Support/Unix/Signals.inc index d6d30bf0cb3..de98d4adf99 100644 --- a/llvm/lib/Support/Unix/Signals.inc +++ b/llvm/lib/Support/Unix/Signals.inc @@ -253,10 +253,9 @@ void llvm::sys::AddSignalHandler(void (*FnPtr)(void *), void *Cookie) { RegisterHandlers(); } -#if defined(HAVE_BACKTRACE) && defined(ENABLE_BACKTRACES) - -#if HAVE_LINK_H && (defined(__linux__) || defined(__FreeBSD__) || \ - defined(__FreeBSD_kernel__) || defined(__NetBSD__)) +#if defined(HAVE_BACKTRACE) && defined(ENABLE_BACKTRACES) && HAVE_LINK_H && \ + (defined(__linux__) || defined(__FreeBSD__) || \ + defined(__FreeBSD_kernel__) || defined(__NetBSD__)) struct DlIteratePhdrData { void **StackTrace; int depth; @@ -289,6 +288,8 @@ static int dl_iterate_phdr_cb(dl_phdr_info *info, size_t size, void *arg) { return 0; } +/// If this is an ELF platform, we can find all loaded modules and their virtual +/// addresses with dl_iterate_phdr. static bool findModulesAndOffsets(void **StackTrace, int Depth, const char **Modules, intptr_t *Offsets, const char *MainExecutableName, @@ -299,21 +300,15 @@ static bool findModulesAndOffsets(void **StackTrace, int Depth, return true; } #else +/// This platform does not have dl_iterate_phdr, so we do not yet know how to +/// find all loaded DSOs. static bool findModulesAndOffsets(void **StackTrace, int Depth, const char **Modules, intptr_t *Offsets, const char *MainExecutableName, StringSaver &StrPool) { return false; } -#endif -#else -static bool findModulesAndOffsets(void **StackTrace, int Depth, - const char **Modules, intptr_t *Offsets, - const char *MainExecutableName, - StringSaver &StrPool) { - return false; -} -#endif // defined(HAVE_BACKTRACE) && defined(ENABLE_BACKTRACES) +#endif // defined(HAVE_BACKTRACE) && defined(ENABLE_BACKTRACES) && ... // PrintStackTrace - In the case of a program crash or fault, print out a stack // trace so that the user has an indication of why and where we died. |