diff options
| author | 2019-01-27 16:42:12 +0000 | |
|---|---|---|
| committer | 2019-01-27 16:42:12 +0000 | |
| commit | b773203fb58f3ef282fb69c832d8710cab5bc82d (patch) | |
| tree | e75913f147570fbd75169647b144df85b88a038c /gnu/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp | |
| parent | tweak errno in previous (diff) | |
| download | wireguard-openbsd-b773203fb58f3ef282fb69c832d8710cab5bc82d.tar.xz wireguard-openbsd-b773203fb58f3ef282fb69c832d8710cab5bc82d.zip | |
Import LLVM 7.0.1 release including clang, lld and lldb.
Diffstat (limited to 'gnu/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp')
| -rw-r--r-- | gnu/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/gnu/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp b/gnu/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp index e997ef5b606..f760a0ef65c 100644 --- a/gnu/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp +++ b/gnu/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp @@ -21,6 +21,7 @@ #include "llvm/DebugInfo/DWARF/DWARFContext.h" #include "llvm/DebugInfo/PDB/PDB.h" #include "llvm/DebugInfo/PDB/PDBContext.h" +#include "llvm/Demangle/Demangle.h" #include "llvm/Object/COFF.h" #include "llvm/Object/MachO.h" #include "llvm/Object/MachOUniversal.h" @@ -185,14 +186,19 @@ bool findDebugBinary(const std::string &OrigPath, return true; } // Try /path/to/original_binary/.debug/debuglink_name - DebugPath = OrigRealPath; + DebugPath = OrigDir; llvm::sys::path::append(DebugPath, ".debug", DebuglinkName); if (checkFileCRC(DebugPath, CRCHash)) { Result = DebugPath.str(); return true; } +#if defined(__NetBSD__) + // Try /usr/libdata/debug/path/to/original_binary/debuglink_name + DebugPath = "/usr/libdata/debug"; +#else // Try /usr/lib/debug/path/to/original_binary/debuglink_name DebugPath = "/usr/lib/debug"; +#endif llvm::sys::path::append(DebugPath, llvm::sys::path::relative_path(OrigDir), DebuglinkName); if (checkFileCRC(DebugPath, CRCHash)) { @@ -459,28 +465,22 @@ StringRef demanglePE32ExternCFunc(StringRef SymbolName) { } // end anonymous namespace -#if !defined(_MSC_VER) -// Assume that __cxa_demangle is provided by libcxxabi (except for Windows). -extern "C" char *__cxa_demangle(const char *mangled_name, char *output_buffer, - size_t *length, int *status); -#endif - std::string LLVMSymbolizer::DemangleName(const std::string &Name, const SymbolizableModule *DbiModuleDescriptor) { -#if !defined(_MSC_VER) // We can spoil names of symbols with C linkage, so use an heuristic // approach to check if the name should be demangled. if (Name.substr(0, 2) == "_Z") { int status = 0; - char *DemangledName = __cxa_demangle(Name.c_str(), nullptr, nullptr, &status); + char *DemangledName = itaniumDemangle(Name.c_str(), nullptr, nullptr, &status); if (status != 0) return Name; std::string Result = DemangledName; free(DemangledName); return Result; } -#else + +#if defined(_MSC_VER) if (!Name.empty() && Name.front() == '?') { // Only do MSVC C++ demangling on symbols starting with '?'. char DemangledName[1024] = {0}; |
