]> granicus.if.org Git - llvm/commitdiff
[PDB] Fix section contributions
authorReid Kleckner <rnk@google.com>
Thu, 3 Aug 2017 21:15:09 +0000 (21:15 +0000)
committerReid Kleckner <rnk@google.com>
Thu, 3 Aug 2017 21:15:09 +0000 (21:15 +0000)
Summary:
PDB section contributions are supposed to use output section indices and
offsets, not input section indices and offsets.

This allows the debugger to look up the index of the module that it
should look up in the modules stream for symbol information. With this
change, windbg can now find line tables, but it still cannot print local
variables.

Fixes PR34048

Reviewers: zturner

Subscribers: hiraditya, ruiu, llvm-commits

Differential Revision: https://reviews.llvm.org/D36285

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309987 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/DebugInfo/PDB/Native/DbiStreamBuilder.h
lib/DebugInfo/PDB/Native/DbiStreamBuilder.cpp

index 584d531d8d43dbdfe90c8bc447a92440d04334a2..01f5978dffc4ab661b5e7d960b39a954ed3caf36 100644 (file)
@@ -72,8 +72,9 @@ public:
 
   Error commit(const msf::MSFLayout &Layout, WritableBinaryStreamRef MsfBuffer);
 
-  void addSectionContrib(DbiModuleDescriptorBuilder *ModuleDbi,
-                         const llvm::object::coff_section *SecHdr);
+  void addSectionContrib(const SectionContrib &SC) {
+    SectionContribs.emplace_back(SC);
+  }
 
   // A helper function to create a Section Map from a COFF section header.
   static std::vector<SecMapEntry>
index 0fe583bb038a489eedd800f540cdb042f7a5621b..1d194bdf78d6c5019a753fe8fba43b17a4784e6f 100644 (file)
@@ -311,19 +311,6 @@ static uint16_t toSecMapFlags(uint32_t Flags) {
   return Ret;
 }
 
-void DbiStreamBuilder::addSectionContrib(DbiModuleDescriptorBuilder *ModuleDbi,
-                                         const object::coff_section *SecHdr) {
-  SectionContrib SC;
-  memset(&SC, 0, sizeof(SC));
-  SC.ISect = (uint16_t)~0U; // This represents nil.
-  SC.Off = SecHdr->PointerToRawData;
-  SC.Size = SecHdr->SizeOfRawData;
-  SC.Characteristics = SecHdr->Characteristics;
-  // Use the module index in the module dbi stream or nil (-1).
-  SC.Imod = ModuleDbi ? ModuleDbi->getModuleIndex() : (uint16_t)~0U;
-  SectionContribs.emplace_back(SC);
-}
-
 // A utility function to create a Section Map for a given list of COFF sections.
 //
 // A Section Map seem to be a copy of a COFF section list in other format.