diff options
Diffstat (limited to 'llvm/lib/Support/Unix/Signals.inc')
-rw-r--r-- | llvm/lib/Support/Unix/Signals.inc | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/llvm/lib/Support/Unix/Signals.inc b/llvm/lib/Support/Unix/Signals.inc index 6668a29..a4525a5 100644 --- a/llvm/lib/Support/Unix/Signals.inc +++ b/llvm/lib/Support/Unix/Signals.inc @@ -507,6 +507,21 @@ static int dl_iterate_phdr_cb(dl_phdr_info *info, size_t size, void *arg) { return 0; } +#if LLVM_ENABLE_DEBUGLOC_TRACKING_ORIGIN +#if !defined(HAVE_BACKTRACE) +#error DebugLoc origin-tracking currently requires `backtrace()`. +#endif +namespace llvm { +namespace sys { +template <unsigned long MaxDepth> +int getStackTrace(std::array<void *, MaxDepth> &StackTrace) { + return backtrace(StackTrace.data(), MaxDepth); +} +template int getStackTrace<16ul>(std::array<void *, 16ul> &); +} // namespace sys +} // namespace llvm +#endif + /// 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, |