CodeView: extract the OMF Directory Header

The DebugDirectory contains a pointer to the CodeView info structure which is a
derivative of the OMF debug directory.  The structure has evolved a bit over
time, and PDB 2.0 used a slightly different definition from PDB 7.0.  Both of
these are specific to CodeView and not COFF.  Reflect this by moving the
structure definitions into the DebugInfo/CodeView headers.  Define a generic
DebugInfo union type that can be used to pass around a reference to the
DebugInfo irrespective of the versioning.  NFC.

llvm-svn: 278075
This commit is contained in:
Saleem Abdulrasool
2016-08-09 00:25:12 +00:00
parent 06ba09af67
commit 015280211b
5 changed files with 79 additions and 28 deletions

View File

@@ -670,14 +670,16 @@ void COFFDumper::printCOFFDebugDirectory() {
W.printHex("AddressOfRawData", D.AddressOfRawData);
W.printHex("PointerToRawData", D.PointerToRawData);
if (D.Type == COFF::IMAGE_DEBUG_TYPE_CODEVIEW) {
const debug_pdb_info *PDBInfo;
const codeview::DebugInfo *DebugInfo;
StringRef PDBFileName;
error(Obj->getDebugPDBInfo(&D, PDBInfo, PDBFileName));
error(Obj->getDebugPDBInfo(&D, DebugInfo, PDBFileName));
DictScope PDBScope(W, "PDBInfo");
W.printHex("PDBSignature", PDBInfo->Signature);
W.printBinary("PDBGUID", makeArrayRef(PDBInfo->Guid));
W.printNumber("PDBAge", PDBInfo->Age);
W.printString("PDBFileName", PDBFileName);
W.printHex("PDBSignature", DebugInfo->Signature.CVSignature);
if (DebugInfo->Signature.CVSignature == OMF::Signature::PDB70) {
W.printBinary("PDBGUID", makeArrayRef(DebugInfo->PDB70.Signature));
W.printNumber("PDBAge", DebugInfo->PDB70.Age);
W.printString("PDBFileName", PDBFileName);
}
} else {
// FIXME: Type values of 12 and 13 are commonly observed but are not in
// the documented type enum. Figure out what they mean.