[PATCH] D31224: [COFF] Put the PDB next to the image if the user doesn't pass /PDB:

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 21 18:09:32 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL298467: [COFF] Put the PDB next to the image if the user doesn't pass /PDB: (authored by rnk).

Changed prior to commit:
  https://reviews.llvm.org/D31224?vs=92573&id=92579#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D31224

Files:
  lld/trunk/COFF/Config.h
  lld/trunk/COFF/Driver.cpp
  lld/trunk/test/COFF/rsds.test


Index: lld/trunk/test/COFF/rsds.test
===================================================================
--- lld/trunk/test/COFF/rsds.test
+++ lld/trunk/test/COFF/rsds.test
@@ -4,46 +4,27 @@
 # RUN: llvm-readobj -coff-debug-directory %t.dll | FileCheck %s
 
 # RUN: lld-link /debug /pdb:%t.pdb /dll /out:%t.dll /entry:DllMain %t.obj
-# RUN: llvm-readobj -coff-debug-directory %t.dll | FileCheck %s -check-prefix CHECK-PDB
+# RUN: llvm-readobj -coff-debug-directory %t.dll | FileCheck %s
 
 # CHECK: DebugDirectory [
 # CHECK:   DebugEntry {
 # CHECK:     Characteristics: 0x0
 # CHECK:     TimeDateStamp: 1970-01-01 00:00:00 (0x0)
 # CHECK:     MajorVersion: 0x0
 # CHECK:     MinorVersion: 0x0
 # CHECK:     Type: CodeView (0x2)
-# CHECK:     SizeOfData: 0x19
+# CHECK:     SizeOfData:
 # CHECK:     AddressOfRawData:
 # CHECK:     PointerToRawData:
 # CHECK:     PDBInfo {
 # CHECK:       PDBSignature: 0x53445352
 # CHECK:       PDBGUID:
 # CHECK:       PDBAge: 1
-# CHECK:       PDBFileName: {{$}}
+# CHECK:       PDBFileName: {{.*}}.pdb
 # CHECK:     }
 # CHECK:   }
 # CHECK: ]
 
-# CHECK-PDB: DebugDirectory [
-# CHECK-PDB:   DebugEntry {
-# CHECK-PDB:     Characteristics: 0x0
-# CHECK-PDB:     TimeDateStamp: 1970-01-01 00:00:00 (0x0)
-# CHECK-PDB:     MajorVersion: 0x0
-# CHECK-PDB:     MinorVersion: 0x0
-# CHECK-PDB:     Type: CodeView (0x2)
-# CHECK-PDB:     SizeOfData:
-# CHECK-PDB:     AddressOfRawData:
-# CHECK-PDB:     PointerToRawData:
-# CHECK-PDB:     PDBInfo {
-# CHECK-PDB:       PDBSignature: 0x53445352
-# CHECK-PDB:       PDBGUID:
-# CHECK-PDB:       PDBAge: 1
-# CHECK-PDB:       PDBFileName: {{.*}}.pdb
-# CHECK-PDB:     }
-# CHECK-PDB:   }
-# CHECK-PDB: ]
-
 --- !COFF
 header:
   Machine:         IMAGE_FILE_MACHINE_I386
Index: lld/trunk/COFF/Driver.cpp
===================================================================
--- lld/trunk/COFF/Driver.cpp
+++ lld/trunk/COFF/Driver.cpp
@@ -890,6 +890,12 @@
         getOutputPath((*Args.filtered_begin(OPT_INPUT))->getValue());
   }
 
+  // Put the PDB next to the image if no /pdb flag was passed.
+  if (Config->Debug && Config->PDBPath.empty()) {
+    Config->PDBPath = Config->OutputFile;
+    sys::path::replace_extension(Config->PDBPath, ".pdb");
+  }
+
   // Set default image base if /base is not given.
   if (Config->ImageBase == uint64_t(-1))
     Config->ImageBase = getDefaultImageBase();
Index: lld/trunk/COFF/Config.h
===================================================================
--- lld/trunk/COFF/Config.h
+++ lld/trunk/COFF/Config.h
@@ -89,7 +89,7 @@
   bool Debug = false;
   bool WriteSymtab = true;
   unsigned DebugTypes = static_cast<unsigned>(DebugType::None);
-  StringRef PDBPath;
+  llvm::SmallString<128> PDBPath;
 
   // Symbols in this set are considered as live by the garbage collector.
   std::set<SymbolBody *> GCRoot;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31224.92579.patch
Type: text/x-patch
Size: 2837 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170322/4632d0b3/attachment.bin>


More information about the llvm-commits mailing list