From 63c839af6818330682562390215d34afc91b3263 Mon Sep 17 00:00:00 2001 From: Reid Kleckner Date: Thu, 3 Aug 2017 21:15:09 +0000 Subject: [PATCH] [PDB] Fix section contributions 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 --- .../llvm/DebugInfo/PDB/Native/DbiStreamBuilder.h | 5 +++-- lib/DebugInfo/PDB/Native/DbiStreamBuilder.cpp | 13 ------------- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/include/llvm/DebugInfo/PDB/Native/DbiStreamBuilder.h b/include/llvm/DebugInfo/PDB/Native/DbiStreamBuilder.h index 584d531d8d4..01f5978dffc 100644 --- a/include/llvm/DebugInfo/PDB/Native/DbiStreamBuilder.h +++ b/include/llvm/DebugInfo/PDB/Native/DbiStreamBuilder.h @@ -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 diff --git a/lib/DebugInfo/PDB/Native/DbiStreamBuilder.cpp b/lib/DebugInfo/PDB/Native/DbiStreamBuilder.cpp index 0fe583bb038..1d194bdf78d 100644 --- a/lib/DebugInfo/PDB/Native/DbiStreamBuilder.cpp +++ b/lib/DebugInfo/PDB/Native/DbiStreamBuilder.cpp @@ -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. -- 2.50.1