[PATCH] D36334: [lld] Write the PDB absolute path to the debug directory header

Zachary Turner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 4 13:03:53 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL310108: [lld] Write the absolute PDB path to the debug directory. (authored by zturner).

Changed prior to commit:
  https://reviews.llvm.org/D36334?vs=109793&id=109809#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D36334

Files:
  lld/trunk/COFF/Writer.cpp


Index: lld/trunk/COFF/Writer.cpp
===================================================================
--- lld/trunk/COFF/Writer.cpp
+++ lld/trunk/COFF/Writer.cpp
@@ -78,8 +78,15 @@
 };
 
 class CVDebugRecordChunk : public Chunk {
+public:
+  CVDebugRecordChunk() {
+    PDBAbsPath = Config->PDBPath;
+    if (!PDBAbsPath.empty())
+      llvm::sys::fs::make_absolute(PDBAbsPath);
+  }
+
   size_t getSize() const override {
-    return sizeof(codeview::DebugInfo) + Config->PDBPath.size() + 1;
+    return sizeof(codeview::DebugInfo) + PDBAbsPath.size() + 1;
   }
 
   void writeTo(uint8_t *B) const override {
@@ -91,12 +98,13 @@
 
     // variable sized field (PDB Path)
     auto *P = reinterpret_cast<char *>(B + OutputSectionOff + sizeof(*DI));
-    if (!Config->PDBPath.empty())
-      memcpy(P, Config->PDBPath.data(), Config->PDBPath.size());
-    P[Config->PDBPath.size()] = '\0';
+    if (!PDBAbsPath.empty())
+      memcpy(P, PDBAbsPath.data(), PDBAbsPath.size());
+    P[PDBAbsPath.size()] = '\0';
   }
 
-public:
+private:
+  SmallString<128> PDBAbsPath;
   mutable codeview::DebugInfo *DI = nullptr;
 };
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36334.109809.patch
Type: text/x-patch
Size: 1118 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170804/bb15819f/attachment.bin>


More information about the llvm-commits mailing list