summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/SymbolFile/DWARF
diff options
context:
space:
mode:
authorPavel Labath <pavel@labath.sk>2019-12-23 14:33:00 +0100
committerPavel Labath <pavel@labath.sk>2019-12-23 14:54:22 +0100
commit46f02fc922e053006e34d860e9efaf29c88d8ba3 (patch)
tree25a00a46f03a9d90390855f6f950f635eccf771f /lldb/source/Plugins/SymbolFile/DWARF
parent8d6f59b78a83489d3dacdd4db0dbf1d4213c92b7 (diff)
downloadbcm5719-llvm-46f02fc922e053006e34d860e9efaf29c88d8ba3.tar.gz
bcm5719-llvm-46f02fc922e053006e34d860e9efaf29c88d8ba3.zip
[lldb/DWARF] Fix hostname-stripping logic
This bit of code is trying to strip everything up to the first colon from all debug info paths, as dwarf2 recommends this syntax for storing the compilation host name. However, this code was too eager, and it ended up stripping the entire compilation directory, if it did not contain a forward slash (or a "x:\"). Normally this does not matter, as all absolute paths will contain one of these patterns, but this does not have to be the case in case the debug info is produced by "clang -fdebug-compilation-dir", which can end up producing a relative compilation directory with no slashes (this is one of the techniques for producing "relocatable" debug info).
Diffstat (limited to 'lldb/source/Plugins/SymbolFile/DWARF')
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
index fde6459b2c6..3ced8d7f89b 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
@@ -718,6 +718,8 @@ FileSpec DWARFUnit::GetFile(size_t file_idx) {
// Remove the host part if present.
static llvm::StringRef
removeHostnameFromPathname(llvm::StringRef path_from_dwarf) {
+ if (!path_from_dwarf.contains(':'))
+ return path_from_dwarf;
llvm::StringRef host, path;
std::tie(host, path) = path_from_dwarf.split(':');
OpenPOWER on IntegriCloud