summaryrefslogtreecommitdiff
path: root/tools/llvm-symbolizer
diff options
context:
space:
mode:
authorAlexey Samsonov <samsonov@google.com>2013-08-26 18:12:03 +0000
committerAlexey Samsonov <samsonov@google.com>2013-08-26 18:12:03 +0000
commit8228a8dd91fbc4c1443bc3f15847ca8be24094a2 (patch)
tree401c720d1f9e0cfb291c386d058d720ac9e1cfc7 /tools/llvm-symbolizer
parent19a54725044b8c7338aa86d0edf75dec1bae93a8 (diff)
downloadllvm-8228a8dd91fbc4c1443bc3f15847ca8be24094a2.tar.gz
llvm-8228a8dd91fbc4c1443bc3f15847ca8be24094a2.tar.bz2
llvm-8228a8dd91fbc4c1443bc3f15847ca8be24094a2.tar.xz
llvm-symbolizer: use real path when looking for debug binary location
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189250 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-symbolizer')
-rw-r--r--tools/llvm-symbolizer/LLVMSymbolize.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/tools/llvm-symbolizer/LLVMSymbolize.cpp b/tools/llvm-symbolizer/LLVMSymbolize.cpp
index c8edde7ee2..45c86641d8 100644
--- a/tools/llvm-symbolizer/LLVMSymbolize.cpp
+++ b/tools/llvm-symbolizer/LLVMSymbolize.cpp
@@ -13,6 +13,7 @@
#include "LLVMSymbolize.h"
#include "llvm/ADT/STLExtras.h"
+#include "llvm/Config/config.h"
#include "llvm/Object/MachO.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/Compression.h"
@@ -22,6 +23,7 @@
#include "llvm/Support/Path.h"
#include <sstream>
+#include <stdlib.h>
namespace llvm {
namespace symbolize {
@@ -228,7 +230,14 @@ static bool checkFileCRC(StringRef Path, uint32_t CRCHash) {
static bool findDebugBinary(const std::string &OrigPath,
const std::string &DebuglinkName, uint32_t CRCHash,
std::string &Result) {
- SmallString<16> OrigDir(OrigPath);
+ std::string OrigRealPath = OrigPath;
+#if defined(HAVE_REALPATH)
+ if (char *RP = realpath(OrigPath.c_str(), NULL)) {
+ OrigRealPath = RP;
+ free(RP);
+ }
+#endif
+ SmallString<16> OrigDir(OrigRealPath);
llvm::sys::path::remove_filename(OrigDir);
SmallString<16> DebugPath = OrigDir;
// Try /path/to/original_binary/debuglink_name
@@ -238,7 +247,7 @@ static bool findDebugBinary(const std::string &OrigPath,
return true;
}
// Try /path/to/original_binary/.debug/debuglink_name
- DebugPath = OrigPath;
+ DebugPath = OrigRealPath;
llvm::sys::path::append(DebugPath, ".debug", DebuglinkName);
if (checkFileCRC(DebugPath, CRCHash)) {
Result = DebugPath.str();