[lldb/DWARF] Fix hostname-stripping logic
authorPavel Labath <pavel@labath.sk>
Mon, 23 Dec 2019 13:33:00 +0000 (14:33 +0100)
committerPavel Labath <pavel@labath.sk>
Mon, 23 Dec 2019 13:54:22 +0000 (14:54 +0100)
commit46f02fc922e053006e34d860e9efaf29c88d8ba3
tree25a00a46f03a9d90390855f6f950f635eccf771f
parent8d6f59b78a83489d3dacdd4db0dbf1d4213c92b7
[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).
lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
lldb/test/Shell/SymbolFile/DWARF/debug_line-relative_path.s [new file with mode: 0644]