[PDB] Improve our PDB OMF debug directory entry

In order to get dbghelp to load our pdb, we have to fill in the
PointerToRawData field as well as the AddressOfRawData field. One is the
file offset and the other is the RVA.

llvm-svn: 309900
This commit is contained in:
Reid Kleckner 2017-08-02 23:19:54 +00:00
parent 6f046b4dd7
commit 8d2cbf2e9b
2 changed files with 4 additions and 3 deletions

View File

@ -82,7 +82,7 @@ public:
// An output section has pointers to chunks in the section, and each
// chunk has a back pointer to an output section.
void setOutputSection(OutputSection *O) { Out = O; }
OutputSection *getOutputSection() { return Out; }
OutputSection *getOutputSection() const { return Out; }
// Windows-specific.
// Collect all locations that contain absolute addresses for base relocations.

View File

@ -65,8 +65,9 @@ public:
D->Type = COFF::IMAGE_DEBUG_TYPE_CODEVIEW;
D->SizeOfData = Record->getSize();
D->AddressOfRawData = Record->getRVA();
// TODO(compnerd) get the file offset
D->PointerToRawData = 0;
OutputSection *OS = Record->getOutputSection();
uint64_t Offs = OS->getFileOff() + (Record->getRVA() - OS->getRVA());
D->PointerToRawData = Offs;
++D;
}