[Lldb-commits] [PATCH] D84815: [LLDB] Improve PDB discovery

Adrian McCarthy via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Jul 28 18:32:58 PDT 2020


amccarth updated this revision to Diff 281445.
amccarth added a comment.

Fixed typos in comments.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84815/new/

https://reviews.llvm.org/D84815

Files:
  lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp


Index: lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
===================================================================
--- lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
+++ lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
@@ -134,8 +134,16 @@
     return nullptr;
   }
 
-  // if the file doesn't exist, is not a pdb, or doesn't have a matching guid,
-  // fail.
+  // If the file doesn't exist, perhaps the path specified at build time
+  // doesn't match the PDB's current location, so check the location of the
+  // executable.
+  if (!FileSystem::Instance().Exists(pdb_file)) {
+    const auto exe_dir = FileSpec(exe_path).CopyByRemovingLastPathComponent();
+    const auto pdb_name = FileSpec(pdb_file).GetFilename().GetCString();
+    pdb_file = exe_dir.CopyByAppendingPathComponent(pdb_name).GetCString();
+  }
+
+  // If the file is not a PDB or if it doesn't have a matching GUID, fail.
   llvm::file_magic magic;
   auto ec = llvm::identify_magic(pdb_file, magic);
   if (ec || magic != llvm::file_magic::pdb)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D84815.281445.patch
Type: text/x-patch
Size: 1077 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200729/0e2638bf/attachment-0001.bin>


More information about the lldb-commits mailing list