[Lldb-commits] [lldb] r368772 - [DebugLine] Be more robust in geussing the path style

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Tue Aug 13 16:30:11 PDT 2019


Author: jdevlieghere
Date: Tue Aug 13 16:30:11 2019
New Revision: 368772

URL: http://llvm.org/viewvc/llvm-project?rev=368772&view=rev
Log:
[DebugLine] Be more robust in geussing the path style

My previous change didn't fix the Windows bot. This patch is an attempt
to make guessing the path style more robust by first looking at the
compile dir and falling back to the actual file if that's unsuccessful.

Modified:
    lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=368772&r1=368771&r2=368772&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Tue Aug 13 16:30:11 2019
@@ -186,6 +186,8 @@ ParseSupportFilesFromPrologue(const lldb
   FileSpecList support_files;
   support_files.Append(first_file);
 
+  llvm::Optional<FileSpec::Style> compile_dir_style =
+      FileSpec::GuessPathStyle(compile_dir);
   const size_t number_of_files = prologue.FileNames.size();
   for (size_t idx = 1; idx <= number_of_files; ++idx) {
     std::string original_file;
@@ -198,9 +200,13 @@ ParseSupportFilesFromPrologue(const lldb
       continue;
     }
 
-    auto maybe_path_style = FileSpec::GuessPathStyle(original_file);
-    FileSpec::Style style =
-        maybe_path_style ? *maybe_path_style : FileSpec::Style::native;
+    FileSpec::Style style = FileSpec::Style::native;
+    if (compile_dir_style) {
+      style = *compile_dir_style;
+    } else if (llvm::Optional<FileSpec::Style> file_style =
+                   FileSpec::GuessPathStyle(original_file)) {
+      style = *file_style;
+    }
 
     std::string remapped_file;
     if (!prologue.getFileNameByIndex(




More information about the lldb-commits mailing list