Author: zturner Date: Thu Oct 11 11:01:55 2018 New Revision: 344269 URL: http://llvm.org/viewvc/llvm-project?rev=344269&view=rev Log: Better support for POSIX paths in PDBs.
While it doesn't make a *ton* of sense for POSIX paths to be in PDBs, it's possible to occur in real scenarios involving cross compilation. The tools need to be able to handle this, because certain types of debugging scenarios are possible without a running process and so don't necessarily require you to be on a Windows system. These include post-mortem debugging and binary forensics (e.g. using a debugger to disassemble functions and examine symbols without running the process). There's changes in clang, LLD, and lldb in this patch. After this the cross-platform disassembly and source-list tests pass on Linux. Furthermore, the behavior of LLD can now be summarized by a much simpler rule than before: Unless you specify /pdbsourcepath and /pdbaltpath, the PDB ends up with paths that are valid within the context of the machine that the link is performed on. Differential Revision: https://reviews.llvm.org/D53149 Modified: lldb/trunk/lit/SymbolFile/NativePDB/source-list.cpp lldb/trunk/source/Plugins/SymbolFile/NativePDB/CompileUnitIndex.cpp lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp Modified: lldb/trunk/lit/SymbolFile/NativePDB/source-list.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/source-list.cpp?rev=344269&r1=344268&r2=344269&view=diff ============================================================================== --- lldb/trunk/lit/SymbolFile/NativePDB/source-list.cpp (original) +++ lldb/trunk/lit/SymbolFile/NativePDB/source-list.cpp Thu Oct 11 11:01:55 2018 @@ -25,7 +25,7 @@ int main(int argc, char **argv) { // changing this file. // CHECK: (lldb) source list -n main -// CHECK: File: D:\src\llvm-mono\lldb\lit\SymbolFile\NativePDB\source-list.cpp +// CHECK: File: {{.*}}source-list.cpp // CHECK: 10 // CHECK: 11 // Some context lines before // CHECK: 12 // the function. Modified: lldb/trunk/source/Plugins/SymbolFile/NativePDB/CompileUnitIndex.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/NativePDB/CompileUnitIndex.cpp?rev=344269&r1=344268&r2=344269&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/NativePDB/CompileUnitIndex.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/NativePDB/CompileUnitIndex.cpp Thu Oct 11 11:01:55 2018 @@ -42,11 +42,8 @@ static bool IsMainFile(llvm::StringRef m if (llvm::sys::fs::equivalent(main, other)) return true; - // FIXME: If we ever want to support PDB debug info for non-Windows systems - // the following check will be wrong, but we need a way to store the host - // information in the PDB. llvm::SmallString<64> normalized(other); - llvm::sys::path::native(normalized, llvm::sys::path::Style::windows); + llvm::sys::path::native(normalized); return main.equals_lower(normalized); } @@ -156,7 +153,8 @@ CompileUnitIndex::GetOrCreateCompiland(P // name until we find it, and we can cache that one since the memory is backed // by a contiguous chunk inside the mapped PDB. llvm::SmallString<64> main_file = GetMainSourceFile(*cci); - llvm::sys::path::native(main_file, llvm::sys::path::Style::windows); + std::string s = main_file.str(); + llvm::sys::path::native(main_file); uint32_t file_count = modules.getSourceFileCount(modi); cci->m_file_list.reserve(file_count); Modified: lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp?rev=344269&r1=344268&r2=344269&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp Thu Oct 11 11:01:55 2018 @@ -530,7 +530,9 @@ bool SymbolFileNativePDB::ParseCompileUn lldbassert(cci); for (llvm::StringRef f : cci->m_file_list) { - FileSpec spec(f, false, FileSpec::Style::windows); + FileSpec::Style style = + f.startswith("/") ? FileSpec::Style::posix : FileSpec::Style::windows; + FileSpec spec(f, false, style); support_files.Append(spec); } _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits