1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 03:02:36 +01:00

[CodeView] Hook CodeViewRecordIO for reading/writing symbols.

This is the 3rd of 3 patches to get reading and writing of
CodeView symbol and type records to use a single codepath.

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

llvm-svn: 289978
This commit is contained in:
Zachary Turner 2016-12-16 19:20:35 +00:00
parent d488f45754
commit 526ce01d27
16 changed files with 1318 additions and 1167 deletions

View File

@ -535,7 +535,7 @@ enum class ThunkOrdinal : uint8_t {
BranchIsland BranchIsland
}; };
enum class TrampolineType { TrampIncremental, BranchIsland }; enum class TrampolineType : uint16_t { TrampIncremental, BranchIsland };
// These values correspond to the CV_SourceChksum_t enumeration. // These values correspond to the CV_SourceChksum_t enumeration.
enum class FileChecksumKind : uint8_t { None, MD5, SHA1, SHA256 }; enum class FileChecksumKind : uint8_t { None, MD5, SHA1, SHA256 };

View File

@ -46,6 +46,17 @@ public:
uint32_t maxFieldLength() const; uint32_t maxFieldLength() const;
template <typename T> Error mapObject(T &Value) {
if (isWriting())
return Writer->writeObject(Value);
const T *ValuePtr;
if (auto EC = Reader->readObject(ValuePtr))
return EC;
Value = *ValuePtr;
return Error::success();
}
template <typename T> Error mapInteger(T &Value) { template <typename T> Error mapInteger(T &Value) {
if (isWriting()) if (isWriting())
return Writer->writeInteger(Value); return Writer->writeInteger(Value);
@ -75,6 +86,8 @@ public:
Error mapStringZ(StringRef &Value); Error mapStringZ(StringRef &Value);
Error mapGuid(StringRef &Guid); Error mapGuid(StringRef &Guid);
Error mapStringZVectorZ(std::vector<StringRef> &Value);
template <typename SizeType, typename T, typename ElementMapper> template <typename SizeType, typename T, typename ElementMapper>
Error mapVectorN(T &Items, const ElementMapper &Mapper) { Error mapVectorN(T &Items, const ElementMapper &Mapper) {
SizeType Size; SizeType Size;
@ -121,6 +134,7 @@ public:
} }
Error mapByteVectorTail(ArrayRef<uint8_t> &Bytes); Error mapByteVectorTail(ArrayRef<uint8_t> &Bytes);
Error mapByteVectorTail(std::vector<uint8_t> &Bytes);
Error skipPadding(); Error skipPadding();

View File

@ -12,6 +12,7 @@
#include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/ArrayRef.h"
#include "llvm/DebugInfo/CodeView/SymbolRecord.h" #include "llvm/DebugInfo/CodeView/SymbolRecord.h"
#include "llvm/DebugInfo/CodeView/SymbolRecordMapping.h"
#include "llvm/DebugInfo/CodeView/SymbolVisitorCallbacks.h" #include "llvm/DebugInfo/CodeView/SymbolVisitorCallbacks.h"
#include "llvm/DebugInfo/CodeView/SymbolVisitorDelegate.h" #include "llvm/DebugInfo/CodeView/SymbolVisitorDelegate.h"
#include "llvm/DebugInfo/MSF/ByteStream.h" #include "llvm/DebugInfo/MSF/ByteStream.h"
@ -22,41 +23,50 @@ namespace llvm {
namespace codeview { namespace codeview {
class SymbolVisitorDelegate; class SymbolVisitorDelegate;
class SymbolDeserializer : public SymbolVisitorCallbacks { class SymbolDeserializer : public SymbolVisitorCallbacks {
struct MappingInfo {
explicit MappingInfo(ArrayRef<uint8_t> RecordData)
: Stream(RecordData), Reader(Stream), Mapping(Reader) {}
msf::ByteStream Stream;
msf::StreamReader Reader;
SymbolRecordMapping Mapping;
};
public: public:
explicit SymbolDeserializer(SymbolVisitorDelegate *Delegate) explicit SymbolDeserializer(SymbolVisitorDelegate *Delegate)
: Delegate(Delegate) {} : Delegate(Delegate) {}
Error visitSymbolBegin(CVSymbol &Record) override {
assert(!Mapping && "Already in a symbol mapping!");
Mapping = llvm::make_unique<MappingInfo>(Record.content());
return Mapping->Mapping.visitSymbolBegin(Record);
}
Error visitSymbolEnd(CVSymbol &Record) override {
assert(Mapping && "Not in a symbol mapping!");
auto EC = Mapping->Mapping.visitSymbolEnd(Record);
Mapping.reset();
return EC;
}
#define SYMBOL_RECORD(EnumName, EnumVal, Name) \ #define SYMBOL_RECORD(EnumName, EnumVal, Name) \
Error visitKnownRecord(CVSymbol &CVR, Name &Record) override { \ Error visitKnownRecord(CVSymbol &CVR, Name &Record) override { \
return defaultVisitKnownRecord(CVR, Record); \ return visitKnownRecordImpl(CVR, Record); \
} }
#define SYMBOL_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName) #define SYMBOL_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
#include "CVSymbolTypes.def" #include "CVSymbolTypes.def"
protected:
template <typename T>
Error deserializeRecord(msf::StreamReader &Reader, SymbolKind Kind,
T &Record) const {
uint32_t RecordOffset = Delegate ? Delegate->getRecordOffset(Reader) : 0;
SymbolRecordKind RK = static_cast<SymbolRecordKind>(Kind);
auto ExpectedRecord = T::deserialize(RK, RecordOffset, Reader);
if (!ExpectedRecord)
return ExpectedRecord.takeError();
Record = std::move(*ExpectedRecord);
return Error::success();
}
private: private:
template <typename T> template <typename T> Error visitKnownRecordImpl(CVSymbol &CVR, T &Record) {
Error defaultVisitKnownRecord(CVSymbol &CVR, T &Record) {
msf::ByteStream S(CVR.content()); Record.RecordOffset =
msf::StreamReader SR(S); Delegate ? Delegate->getRecordOffset(Mapping->Reader) : 0;
if (auto EC = deserializeRecord(SR, CVR.Type, Record)) if (auto EC = Mapping->Mapping.visitKnownRecord(CVR, Record))
return EC; return EC;
return Error::success(); return Error::success();
} }
SymbolVisitorDelegate *Delegate; SymbolVisitorDelegate *Delegate;
std::unique_ptr<MappingInfo> Mapping;
}; };
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,44 @@
//===- SymbolRecordMapping.h ------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_DEBUGINFO_CODEVIEW_SYMBOLRECORDMAPPING_H
#define LLVM_DEBUGINFO_CODEVIEW_SYMBOLRECORDMAPPING_H
#include "llvm/DebugInfo/CodeView/CodeViewRecordIO.h"
#include "llvm/DebugInfo/CodeView/SymbolVisitorCallbacks.h"
namespace llvm {
namespace msf {
class StreamReader;
class StreamWriter;
}
namespace codeview {
class SymbolRecordMapping : public SymbolVisitorCallbacks {
public:
explicit SymbolRecordMapping(msf::StreamReader &Reader) : IO(Reader) {}
explicit SymbolRecordMapping(msf::StreamWriter &Writer) : IO(Writer) {}
Error visitSymbolBegin(CVSymbol &Record) override;
Error visitSymbolEnd(CVSymbol &Record) override;
#define SYMBOL_RECORD(EnumName, EnumVal, Name) \
Error visitKnownRecord(CVSymbol &CVR, Name &Record) override;
#define SYMBOL_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
#include "CVSymbolTypes.def"
private:
Optional<SymbolKind> Kind;
CodeViewRecordIO IO;
};
}
}
#endif

View File

@ -0,0 +1,96 @@
//===- symbolSerializer.h ---------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_DEBUGINFO_CODEVIEW_SYMBOLSERIALIZER_H
#define LLVM_DEBUGINFO_CODEVIEW_SYMBOLSERIALIZER_H
#include "llvm/DebugInfo/CodeView/SymbolRecordMapping.h"
#include "llvm/DebugInfo/CodeView/SymbolVisitorCallbacks.h"
#include "llvm/DebugInfo/Msf/ByteStream.h"
#include "llvm/DebugInfo/Msf/StreamWriter.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/iterator_range.h"
#include "llvm/Support/Allocator.h"
#include "llvm/Support/Error.h"
namespace llvm {
namespace codeview {
class SymbolSerializer : public SymbolVisitorCallbacks {
uint32_t RecordStart = 0;
msf::StreamWriter &Writer;
SymbolRecordMapping Mapping;
Optional<SymbolKind> CurrentSymbol;
Error writeRecordPrefix(SymbolKind Kind) {
RecordPrefix Prefix;
Prefix.RecordKind = Kind;
Prefix.RecordLen = 0;
if (auto EC = Writer.writeObject(Prefix))
return EC;
return Error::success();
}
public:
explicit SymbolSerializer(msf::StreamWriter &Writer)
: Writer(Writer), Mapping(Writer) {}
virtual Error visitSymbolBegin(CVSymbol &Record) override {
assert(!CurrentSymbol.hasValue() && "Already in a symbol mapping!");
RecordStart = Writer.getOffset();
if (auto EC = writeRecordPrefix(Record.kind()))
return EC;
CurrentSymbol = Record.kind();
if (auto EC = Mapping.visitSymbolBegin(Record))
return EC;
return Error::success();
}
virtual Error visitSymbolEnd(CVSymbol &Record) override {
assert(CurrentSymbol.hasValue() && "Not in a symbol mapping!");
if (auto EC = Mapping.visitSymbolEnd(Record))
return EC;
uint32_t RecordEnd = Writer.getOffset();
Writer.setOffset(RecordStart);
uint16_t Length = RecordEnd - Writer.getOffset() - 2;
if (auto EC = Writer.writeInteger(Length))
return EC;
Writer.setOffset(RecordEnd);
CurrentSymbol.reset();
return Error::success();
}
#define SYMBOL_RECORD(EnumName, EnumVal, Name) \
virtual Error visitKnownRecord(CVSymbol &CVR, Name &Record) override { \
return visitKnownRecordImpl(CVR, Record); \
}
#define SYMBOL_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
#include "CVSymbolTypes.def"
private:
template <typename RecordKind>
Error visitKnownRecordImpl(CVSymbol &CVR, RecordKind &Record) {
return Mapping.visitKnownRecord(CVR, Record);
}
};
}
}
#endif

View File

@ -2072,35 +2072,39 @@ void CodeViewDebug::emitLocalVariable(const LocalVariable &Var) {
(DefRange.StructOffset (DefRange.StructOffset
<< DefRangeRegisterRelSym::OffsetInParentShift); << DefRangeRegisterRelSym::OffsetInParentShift);
} }
DefRangeRegisterRelSym Sym(DefRange.CVRegister, RegRelFlags, DefRangeRegisterRelSym Sym(S_DEFRANGE_REGISTER_REL);
DefRange.DataOffset, None); Sym.Hdr.Register = DefRange.CVRegister;
Sym.Hdr.Flags = RegRelFlags;
Sym.Hdr.BasePointerOffset = DefRange.DataOffset;
ulittle16_t SymKind = ulittle16_t(S_DEFRANGE_REGISTER_REL); ulittle16_t SymKind = ulittle16_t(S_DEFRANGE_REGISTER_REL);
BytePrefix += BytePrefix +=
StringRef(reinterpret_cast<const char *>(&SymKind), sizeof(SymKind)); StringRef(reinterpret_cast<const char *>(&SymKind), sizeof(SymKind));
BytePrefix += BytePrefix +=
StringRef(reinterpret_cast<const char *>(&Sym.Header), StringRef(reinterpret_cast<const char *>(&Sym.Hdr), sizeof(Sym.Hdr));
sizeof(Sym.Header) - sizeof(LocalVariableAddrRange));
} else { } else {
assert(DefRange.DataOffset == 0 && "unexpected offset into register"); assert(DefRange.DataOffset == 0 && "unexpected offset into register");
if (DefRange.IsSubfield) { if (DefRange.IsSubfield) {
// Unclear what matters here. // Unclear what matters here.
DefRangeSubfieldRegisterSym Sym(DefRange.CVRegister, 0, DefRangeSubfieldRegisterSym Sym(S_DEFRANGE_SUBFIELD_REGISTER);
DefRange.StructOffset, None); Sym.Hdr.Register = DefRange.CVRegister;
Sym.Hdr.MayHaveNoName = 0;
Sym.Hdr.OffsetInParent = DefRange.StructOffset;
ulittle16_t SymKind = ulittle16_t(S_DEFRANGE_SUBFIELD_REGISTER); ulittle16_t SymKind = ulittle16_t(S_DEFRANGE_SUBFIELD_REGISTER);
BytePrefix += StringRef(reinterpret_cast<const char *>(&SymKind), BytePrefix += StringRef(reinterpret_cast<const char *>(&SymKind),
sizeof(SymKind)); sizeof(SymKind));
BytePrefix += BytePrefix += StringRef(reinterpret_cast<const char *>(&Sym.Hdr),
StringRef(reinterpret_cast<const char *>(&Sym.Header), sizeof(Sym.Hdr));
sizeof(Sym.Header) - sizeof(LocalVariableAddrRange));
} else { } else {
// Unclear what matters here. // Unclear what matters here.
DefRangeRegisterSym Sym(DefRange.CVRegister, 0, None); DefRangeRegisterSym Sym(S_DEFRANGE_REGISTER);
Sym.Hdr.Register = DefRange.CVRegister;
Sym.Hdr.MayHaveNoName = 0;
ulittle16_t SymKind = ulittle16_t(S_DEFRANGE_REGISTER); ulittle16_t SymKind = ulittle16_t(S_DEFRANGE_REGISTER);
BytePrefix += StringRef(reinterpret_cast<const char *>(&SymKind), BytePrefix += StringRef(reinterpret_cast<const char *>(&SymKind),
sizeof(SymKind)); sizeof(SymKind));
BytePrefix += BytePrefix += StringRef(reinterpret_cast<const char *>(&Sym.Hdr),
StringRef(reinterpret_cast<const char *>(&Sym.Header), sizeof(Sym.Hdr));
sizeof(Sym.Header) - sizeof(LocalVariableAddrRange));
} }
} }
OS.EmitCVDefRangeDirective(DefRange.Ranges, BytePrefix); OS.EmitCVDefRangeDirective(DefRange.Ranges, BytePrefix);

View File

@ -8,7 +8,9 @@ add_llvm_library(LLVMDebugInfoCodeView
ModuleSubstream.cpp ModuleSubstream.cpp
ModuleSubstreamVisitor.cpp ModuleSubstreamVisitor.cpp
RecordSerialization.cpp RecordSerialization.cpp
SymbolRecordMapping.cpp
SymbolDumper.cpp SymbolDumper.cpp
SymbolSerializer.cpp
TypeDumper.cpp TypeDumper.cpp
TypeRecord.cpp TypeRecord.cpp
TypeRecordMapping.cpp TypeRecordMapping.cpp

View File

@ -75,6 +75,16 @@ Error CodeViewRecordIO::mapByteVectorTail(ArrayRef<uint8_t> &Bytes) {
return Error::success(); return Error::success();
} }
Error CodeViewRecordIO::mapByteVectorTail(std::vector<uint8_t> &Bytes) {
ArrayRef<uint8_t> BytesRef(Bytes);
if (auto EC = mapByteVectorTail(BytesRef))
return EC;
if (!isWriting())
Bytes.assign(BytesRef.begin(), BytesRef.end());
return Error::success();
}
Error CodeViewRecordIO::mapInteger(TypeIndex &TypeInd) { Error CodeViewRecordIO::mapInteger(TypeIndex &TypeInd) {
if (isWriting()) { if (isWriting()) {
if (auto EC = Writer->writeInteger(TypeInd.getIndex())) if (auto EC = Writer->writeInteger(TypeInd.getIndex()))
@ -160,6 +170,27 @@ Error CodeViewRecordIO::mapGuid(StringRef &Guid) {
return Error::success(); return Error::success();
} }
Error CodeViewRecordIO::mapStringZVectorZ(std::vector<StringRef> &Value) {
if (isWriting()) {
for (auto V : Value) {
if (auto EC = mapStringZ(V))
return EC;
}
if (auto EC = Writer->writeInteger(uint8_t(0)))
return EC;
} else {
StringRef S;
if (auto EC = mapStringZ(S))
return EC;
while (!S.empty()) {
Value.push_back(S);
if (auto EC = mapStringZ(S))
return EC;
};
}
return Error::success();
}
Error CodeViewRecordIO::writeEncodedSignedInteger(const int64_t &Value) { Error CodeViewRecordIO::writeEncodedSignedInteger(const int64_t &Value) {
assert(Value < 0 && "Encoded integer is not signed!"); assert(Value < 0 && "Encoded integer is not signed!");
if (Value >= std::numeric_limits<int8_t>::min()) { if (Value >= std::numeric_limits<int8_t>::min()) {

View File

@ -94,14 +94,14 @@ Error CVSymbolDumperImpl::visitKnownRecord(CVSymbol &CVR, BlockSym &Block) {
DictScope S(W, "BlockStart"); DictScope S(W, "BlockStart");
StringRef LinkageName; StringRef LinkageName;
W.printHex("PtrParent", Block.Header.PtrParent); W.printHex("PtrParent", Block.Parent);
W.printHex("PtrEnd", Block.Header.PtrEnd); W.printHex("PtrEnd", Block.End);
W.printHex("CodeSize", Block.Header.CodeSize); W.printHex("CodeSize", Block.CodeSize);
if (ObjDelegate) { if (ObjDelegate) {
ObjDelegate->printRelocatedField("CodeOffset", Block.getRelocationOffset(), ObjDelegate->printRelocatedField("CodeOffset", Block.getRelocationOffset(),
Block.Header.CodeOffset, &LinkageName); Block.CodeOffset, &LinkageName);
} }
W.printHex("Segment", Block.Header.Segment); W.printHex("Segment", Block.Segment);
W.printString("BlockName", Block.Name); W.printString("BlockName", Block.Name);
W.printString("LinkageName", LinkageName); W.printString("LinkageName", LinkageName);
return Error::success(); return Error::success();
@ -109,36 +109,35 @@ Error CVSymbolDumperImpl::visitKnownRecord(CVSymbol &CVR, BlockSym &Block) {
Error CVSymbolDumperImpl::visitKnownRecord(CVSymbol &CVR, Thunk32Sym &Thunk) { Error CVSymbolDumperImpl::visitKnownRecord(CVSymbol &CVR, Thunk32Sym &Thunk) {
DictScope S(W, "Thunk32"); DictScope S(W, "Thunk32");
W.printNumber("Parent", Thunk.Header.Parent); W.printNumber("Parent", Thunk.Parent);
W.printNumber("End", Thunk.Header.End); W.printNumber("End", Thunk.End);
W.printNumber("Next", Thunk.Header.Next); W.printNumber("Next", Thunk.Next);
W.printNumber("Off", Thunk.Header.Off); W.printNumber("Off", Thunk.Offset);
W.printNumber("Seg", Thunk.Header.Seg); W.printNumber("Seg", Thunk.Segment);
W.printNumber("Len", Thunk.Header.Len); W.printNumber("Len", Thunk.Length);
W.printEnum("Ordinal", Thunk.Header.Ord, getThunkOrdinalNames()); W.printEnum("Ordinal", uint8_t(Thunk.Thunk), getThunkOrdinalNames());
return Error::success(); return Error::success();
} }
Error CVSymbolDumperImpl::visitKnownRecord(CVSymbol &CVR, Error CVSymbolDumperImpl::visitKnownRecord(CVSymbol &CVR,
TrampolineSym &Tramp) { TrampolineSym &Tramp) {
DictScope S(W, "Trampoline"); DictScope S(W, "Trampoline");
W.printEnum("Type", Tramp.Header.Type, getTrampolineNames()); W.printEnum("Type", uint16_t(Tramp.Type), getTrampolineNames());
W.printNumber("Size", Tramp.Header.Size); W.printNumber("Size", Tramp.Size);
W.printNumber("ThunkOff", Tramp.Header.ThunkOff); W.printNumber("ThunkOff", Tramp.ThunkOffset);
W.printNumber("TargetOff", Tramp.Header.TargetOff); W.printNumber("TargetOff", Tramp.TargetOffset);
W.printNumber("ThunkSection", Tramp.Header.ThunkSection); W.printNumber("ThunkSection", Tramp.ThunkSection);
W.printNumber("TargetSection", Tramp.Header.TargetSection); W.printNumber("TargetSection", Tramp.TargetSection);
return Error::success(); return Error::success();
} }
Error CVSymbolDumperImpl::visitKnownRecord(CVSymbol &CVR, SectionSym &Section) { Error CVSymbolDumperImpl::visitKnownRecord(CVSymbol &CVR, SectionSym &Section) {
DictScope S(W, "Section"); DictScope S(W, "Section");
W.printNumber("SectionNumber", Section.Header.SectionNumber); W.printNumber("SectionNumber", Section.SectionNumber);
W.printNumber("Alignment", Section.Header.Alignment); W.printNumber("Alignment", Section.Alignment);
W.printNumber("Reserved", Section.Header.Reserved); W.printNumber("Rva", Section.Rva);
W.printNumber("Rva", Section.Header.Rva); W.printNumber("Length", Section.Length);
W.printNumber("Length", Section.Header.Length); W.printFlags("Characteristics", Section.Characteristics,
W.printFlags("Characteristics", Section.Header.Characteristics,
getImageSectionCharacteristicNames(), getImageSectionCharacteristicNames(),
COFF::SectionCharacteristics(0x00F00000)); COFF::SectionCharacteristics(0x00F00000));
@ -149,12 +148,12 @@ Error CVSymbolDumperImpl::visitKnownRecord(CVSymbol &CVR, SectionSym &Section) {
Error CVSymbolDumperImpl::visitKnownRecord(CVSymbol &CVR, Error CVSymbolDumperImpl::visitKnownRecord(CVSymbol &CVR,
CoffGroupSym &CoffGroup) { CoffGroupSym &CoffGroup) {
DictScope S(W, "COFF Group"); DictScope S(W, "COFF Group");
W.printNumber("Size", CoffGroup.Header.Size); W.printNumber("Size", CoffGroup.Size);
W.printFlags("Characteristics", CoffGroup.Header.Characteristics, W.printFlags("Characteristics", CoffGroup.Characteristics,
getImageSectionCharacteristicNames(), getImageSectionCharacteristicNames(),
COFF::SectionCharacteristics(0x00F00000)); COFF::SectionCharacteristics(0x00F00000));
W.printNumber("Offset", CoffGroup.Header.Offset); W.printNumber("Offset", CoffGroup.Offset);
W.printNumber("Segment", CoffGroup.Header.Segment); W.printNumber("Segment", CoffGroup.Segment);
W.printString("Name", CoffGroup.Name); W.printString("Name", CoffGroup.Name);
return Error::success(); return Error::success();
} }
@ -163,8 +162,8 @@ Error CVSymbolDumperImpl::visitKnownRecord(CVSymbol &CVR,
BPRelativeSym &BPRel) { BPRelativeSym &BPRel) {
DictScope S(W, "BPRelativeSym"); DictScope S(W, "BPRelativeSym");
W.printNumber("Offset", BPRel.Header.Offset); W.printNumber("Offset", BPRel.Offset);
CVTD.printTypeIndex("Type", BPRel.Header.Type); CVTD.printTypeIndex("Type", BPRel.Type);
W.printString("VarName", BPRel.Name); W.printString("VarName", BPRel.Name);
return Error::success(); return Error::success();
} }
@ -173,7 +172,7 @@ Error CVSymbolDumperImpl::visitKnownRecord(CVSymbol &CVR,
BuildInfoSym &BuildInfo) { BuildInfoSym &BuildInfo) {
DictScope S(W, "BuildInfo"); DictScope S(W, "BuildInfo");
W.printNumber("BuildId", BuildInfo.Header.BuildId); W.printNumber("BuildId", BuildInfo.BuildId);
return Error::success(); return Error::success();
} }
@ -183,13 +182,12 @@ Error CVSymbolDumperImpl::visitKnownRecord(CVSymbol &CVR,
StringRef LinkageName; StringRef LinkageName;
if (ObjDelegate) { if (ObjDelegate) {
ObjDelegate->printRelocatedField( ObjDelegate->printRelocatedField("CodeOffset",
"CodeOffset", CallSiteInfo.getRelocationOffset(), CallSiteInfo.getRelocationOffset(),
CallSiteInfo.Header.CodeOffset, &LinkageName); CallSiteInfo.CodeOffset, &LinkageName);
} }
W.printHex("Segment", CallSiteInfo.Header.Segment); W.printHex("Segment", CallSiteInfo.Segment);
W.printHex("Reserved", CallSiteInfo.Header.Reserved); CVTD.printTypeIndex("Type", CallSiteInfo.Type);
CVTD.printTypeIndex("Type", CallSiteInfo.Header.Type);
if (!LinkageName.empty()) if (!LinkageName.empty())
W.printString("LinkageName", LinkageName); W.printString("LinkageName", LinkageName);
return Error::success(); return Error::success();
@ -199,7 +197,6 @@ Error CVSymbolDumperImpl::visitKnownRecord(CVSymbol &CVR,
EnvBlockSym &EnvBlock) { EnvBlockSym &EnvBlock) {
DictScope S(W, "EnvBlock"); DictScope S(W, "EnvBlock");
W.printNumber("Reserved", EnvBlock.Header.Reserved);
ListScope L(W, "Entries"); ListScope L(W, "Entries");
for (auto Entry : EnvBlock.Fields) { for (auto Entry : EnvBlock.Fields) {
W.printString(Entry); W.printString(Entry);
@ -210,17 +207,17 @@ Error CVSymbolDumperImpl::visitKnownRecord(CVSymbol &CVR,
Error CVSymbolDumperImpl::visitKnownRecord(CVSymbol &CVR, Error CVSymbolDumperImpl::visitKnownRecord(CVSymbol &CVR,
FileStaticSym &FileStatic) { FileStaticSym &FileStatic) {
DictScope S(W, "FileStatic"); DictScope S(W, "FileStatic");
W.printNumber("Index", FileStatic.Header.Index); W.printNumber("Index", FileStatic.Index);
W.printNumber("ModFilenameOffset", FileStatic.Header.ModFilenameOffset); W.printNumber("ModFilenameOffset", FileStatic.ModFilenameOffset);
W.printFlags("Flags", uint16_t(FileStatic.Header.Flags), getLocalFlagNames()); W.printFlags("Flags", uint16_t(FileStatic.Flags), getLocalFlagNames());
W.printString("Name", FileStatic.Name); W.printString("Name", FileStatic.Name);
return Error::success(); return Error::success();
} }
Error CVSymbolDumperImpl::visitKnownRecord(CVSymbol &CVR, ExportSym &Export) { Error CVSymbolDumperImpl::visitKnownRecord(CVSymbol &CVR, ExportSym &Export) {
DictScope S(W, "Export"); DictScope S(W, "Export");
W.printNumber("Ordinal", Export.Header.Ordinal); W.printNumber("Ordinal", Export.Ordinal);
W.printFlags("Flags", Export.Header.Flags, getExportSymFlagNames()); W.printFlags("Flags", uint16_t(Export.Flags), getExportSymFlagNames());
W.printString("Name", Export.Name); W.printString("Name", Export.Name);
return Error::success(); return Error::success();
} }
@ -229,24 +226,20 @@ Error CVSymbolDumperImpl::visitKnownRecord(CVSymbol &CVR,
Compile2Sym &Compile2) { Compile2Sym &Compile2) {
DictScope S(W, "CompilerFlags2"); DictScope S(W, "CompilerFlags2");
W.printEnum("Language", Compile2.Header.getLanguage(), W.printEnum("Language", Compile2.getLanguage(), getSourceLanguageNames());
getSourceLanguageNames()); W.printFlags("Flags", Compile2.getFlags(), getCompileSym2FlagNames());
W.printFlags("Flags", Compile2.Header.flags & ~0xff, W.printEnum("Machine", unsigned(Compile2.Machine), getCPUTypeNames());
getCompileSym2FlagNames());
W.printEnum("Machine", unsigned(Compile2.Header.Machine), getCPUTypeNames());
std::string FrontendVersion; std::string FrontendVersion;
{ {
raw_string_ostream Out(FrontendVersion); raw_string_ostream Out(FrontendVersion);
Out << Compile2.Header.VersionFrontendMajor << '.' Out << Compile2.VersionFrontendMajor << '.' << Compile2.VersionFrontendMinor
<< Compile2.Header.VersionFrontendMinor << '.' << '.' << Compile2.VersionFrontendBuild;
<< Compile2.Header.VersionFrontendBuild;
} }
std::string BackendVersion; std::string BackendVersion;
{ {
raw_string_ostream Out(BackendVersion); raw_string_ostream Out(BackendVersion);
Out << Compile2.Header.VersionBackendMajor << '.' Out << Compile2.VersionBackendMajor << '.' << Compile2.VersionBackendMinor
<< Compile2.Header.VersionBackendMinor << '.' << '.' << Compile2.VersionBackendBuild;
<< Compile2.Header.VersionBackendBuild;
} }
W.printString("FrontendVersion", FrontendVersion); W.printString("FrontendVersion", FrontendVersion);
W.printString("BackendVersion", BackendVersion); W.printString("BackendVersion", BackendVersion);
@ -258,26 +251,22 @@ Error CVSymbolDumperImpl::visitKnownRecord(CVSymbol &CVR,
Compile3Sym &Compile3) { Compile3Sym &Compile3) {
DictScope S(W, "CompilerFlags3"); DictScope S(W, "CompilerFlags3");
W.printEnum("Language", Compile3.Header.getLanguage(), W.printEnum("Language", Compile3.getLanguage(), getSourceLanguageNames());
getSourceLanguageNames()); W.printFlags("Flags", Compile3.getFlags(), getCompileSym3FlagNames());
W.printFlags("Flags", Compile3.Header.flags & ~0xff, W.printEnum("Machine", unsigned(Compile3.Machine), getCPUTypeNames());
getCompileSym3FlagNames());
W.printEnum("Machine", unsigned(Compile3.Header.Machine), getCPUTypeNames());
std::string FrontendVersion; std::string FrontendVersion;
{ {
raw_string_ostream Out(FrontendVersion); raw_string_ostream Out(FrontendVersion);
Out << Compile3.Header.VersionFrontendMajor << '.' Out << Compile3.VersionFrontendMajor << '.' << Compile3.VersionFrontendMinor
<< Compile3.Header.VersionFrontendMinor << '.' << '.' << Compile3.VersionFrontendBuild << '.'
<< Compile3.Header.VersionFrontendBuild << '.' << Compile3.VersionFrontendQFE;
<< Compile3.Header.VersionFrontendQFE;
} }
std::string BackendVersion; std::string BackendVersion;
{ {
raw_string_ostream Out(BackendVersion); raw_string_ostream Out(BackendVersion);
Out << Compile3.Header.VersionBackendMajor << '.' Out << Compile3.VersionBackendMajor << '.' << Compile3.VersionBackendMinor
<< Compile3.Header.VersionBackendMinor << '.' << '.' << Compile3.VersionBackendBuild << '.'
<< Compile3.Header.VersionBackendBuild << '.' << Compile3.VersionBackendQFE;
<< Compile3.Header.VersionBackendQFE;
} }
W.printString("FrontendVersion", FrontendVersion); W.printString("FrontendVersion", FrontendVersion);
W.printString("BackendVersion", BackendVersion); W.printString("BackendVersion", BackendVersion);
@ -289,7 +278,7 @@ Error CVSymbolDumperImpl::visitKnownRecord(CVSymbol &CVR,
ConstantSym &Constant) { ConstantSym &Constant) {
DictScope S(W, "Constant"); DictScope S(W, "Constant");
CVTD.printTypeIndex("Type", Constant.Header.Type); CVTD.printTypeIndex("Type", Constant.Type);
W.printNumber("Value", Constant.Value); W.printNumber("Value", Constant.Value);
W.printString("Name", Constant.Name); W.printString("Name", Constant.Name);
return Error::success(); return Error::success();
@ -302,9 +291,9 @@ Error CVSymbolDumperImpl::visitKnownRecord(CVSymbol &CVR, DataSym &Data) {
StringRef LinkageName; StringRef LinkageName;
if (ObjDelegate) { if (ObjDelegate) {
ObjDelegate->printRelocatedField("DataOffset", Data.getRelocationOffset(), ObjDelegate->printRelocatedField("DataOffset", Data.getRelocationOffset(),
Data.Header.DataOffset, &LinkageName); Data.DataOffset, &LinkageName);
} }
CVTD.printTypeIndex("Type", Data.Header.Type); CVTD.printTypeIndex("Type", Data.Type);
W.printString("DisplayName", Data.Name); W.printString("DisplayName", Data.Name);
if (!LinkageName.empty()) if (!LinkageName.empty())
W.printString("LinkageName", LinkageName); W.printString("LinkageName", LinkageName);
@ -315,7 +304,7 @@ Error CVSymbolDumperImpl::visitKnownRecord(
CVSymbol &CVR, CVSymbol &CVR,
DefRangeFramePointerRelFullScopeSym &DefRangeFramePointerRelFullScope) { DefRangeFramePointerRelFullScopeSym &DefRangeFramePointerRelFullScope) {
DictScope S(W, "DefRangeFramePointerRelFullScope"); DictScope S(W, "DefRangeFramePointerRelFullScope");
W.printNumber("Offset", DefRangeFramePointerRelFullScope.Header.Offset); W.printNumber("Offset", DefRangeFramePointerRelFullScope.Offset);
return Error::success(); return Error::success();
} }
@ -323,8 +312,8 @@ Error CVSymbolDumperImpl::visitKnownRecord(
CVSymbol &CVR, DefRangeFramePointerRelSym &DefRangeFramePointerRel) { CVSymbol &CVR, DefRangeFramePointerRelSym &DefRangeFramePointerRel) {
DictScope S(W, "DefRangeFramePointerRel"); DictScope S(W, "DefRangeFramePointerRel");
W.printNumber("Offset", DefRangeFramePointerRel.Header.Offset); W.printNumber("Offset", DefRangeFramePointerRel.Offset);
printLocalVariableAddrRange(DefRangeFramePointerRel.Header.Range, printLocalVariableAddrRange(DefRangeFramePointerRel.Range,
DefRangeFramePointerRel.getRelocationOffset()); DefRangeFramePointerRel.getRelocationOffset());
printLocalVariableAddrGap(DefRangeFramePointerRel.Gaps); printLocalVariableAddrGap(DefRangeFramePointerRel.Gaps);
return Error::success(); return Error::success();
@ -334,13 +323,12 @@ Error CVSymbolDumperImpl::visitKnownRecord(
CVSymbol &CVR, DefRangeRegisterRelSym &DefRangeRegisterRel) { CVSymbol &CVR, DefRangeRegisterRelSym &DefRangeRegisterRel) {
DictScope S(W, "DefRangeRegisterRel"); DictScope S(W, "DefRangeRegisterRel");
W.printNumber("BaseRegister", DefRangeRegisterRel.Header.BaseRegister); W.printNumber("BaseRegister", DefRangeRegisterRel.Hdr.Register);
W.printBoolean("HasSpilledUDTMember", W.printBoolean("HasSpilledUDTMember",
DefRangeRegisterRel.hasSpilledUDTMember()); DefRangeRegisterRel.hasSpilledUDTMember());
W.printNumber("OffsetInParent", DefRangeRegisterRel.offsetInParent()); W.printNumber("OffsetInParent", DefRangeRegisterRel.offsetInParent());
W.printNumber("BasePointerOffset", W.printNumber("BasePointerOffset", DefRangeRegisterRel.Hdr.BasePointerOffset);
DefRangeRegisterRel.Header.BasePointerOffset); printLocalVariableAddrRange(DefRangeRegisterRel.Range,
printLocalVariableAddrRange(DefRangeRegisterRel.Header.Range,
DefRangeRegisterRel.getRelocationOffset()); DefRangeRegisterRel.getRelocationOffset());
printLocalVariableAddrGap(DefRangeRegisterRel.Gaps); printLocalVariableAddrGap(DefRangeRegisterRel.Gaps);
return Error::success(); return Error::success();
@ -350,9 +338,9 @@ Error CVSymbolDumperImpl::visitKnownRecord(
CVSymbol &CVR, DefRangeRegisterSym &DefRangeRegister) { CVSymbol &CVR, DefRangeRegisterSym &DefRangeRegister) {
DictScope S(W, "DefRangeRegister"); DictScope S(W, "DefRangeRegister");
W.printNumber("Register", DefRangeRegister.Header.Register); W.printNumber("Register", DefRangeRegister.Hdr.Register);
W.printNumber("MayHaveNoName", DefRangeRegister.Header.MayHaveNoName); W.printNumber("MayHaveNoName", DefRangeRegister.Hdr.MayHaveNoName);
printLocalVariableAddrRange(DefRangeRegister.Header.Range, printLocalVariableAddrRange(DefRangeRegister.Range,
DefRangeRegister.getRelocationOffset()); DefRangeRegister.getRelocationOffset());
printLocalVariableAddrGap(DefRangeRegister.Gaps); printLocalVariableAddrGap(DefRangeRegister.Gaps);
return Error::success(); return Error::success();
@ -362,11 +350,10 @@ Error CVSymbolDumperImpl::visitKnownRecord(
CVSymbol &CVR, DefRangeSubfieldRegisterSym &DefRangeSubfieldRegister) { CVSymbol &CVR, DefRangeSubfieldRegisterSym &DefRangeSubfieldRegister) {
DictScope S(W, "DefRangeSubfieldRegister"); DictScope S(W, "DefRangeSubfieldRegister");
W.printNumber("Register", DefRangeSubfieldRegister.Header.Register); W.printNumber("Register", DefRangeSubfieldRegister.Hdr.Register);
W.printNumber("MayHaveNoName", DefRangeSubfieldRegister.Header.MayHaveNoName); W.printNumber("MayHaveNoName", DefRangeSubfieldRegister.Hdr.MayHaveNoName);
W.printNumber("OffsetInParent", W.printNumber("OffsetInParent", DefRangeSubfieldRegister.Hdr.OffsetInParent);
DefRangeSubfieldRegister.Header.OffsetInParent); printLocalVariableAddrRange(DefRangeSubfieldRegister.Range,
printLocalVariableAddrRange(DefRangeSubfieldRegister.Header.Range,
DefRangeSubfieldRegister.getRelocationOffset()); DefRangeSubfieldRegister.getRelocationOffset());
printLocalVariableAddrGap(DefRangeSubfieldRegister.Gaps); printLocalVariableAddrGap(DefRangeSubfieldRegister.Gaps);
return Error::success(); return Error::success();
@ -378,7 +365,7 @@ Error CVSymbolDumperImpl::visitKnownRecord(
if (ObjDelegate) { if (ObjDelegate) {
StringRef StringTable = ObjDelegate->getStringTable(); StringRef StringTable = ObjDelegate->getStringTable();
auto ProgramStringTableOffset = DefRangeSubfield.Header.Program; auto ProgramStringTableOffset = DefRangeSubfield.Program;
if (ProgramStringTableOffset >= StringTable.size()) if (ProgramStringTableOffset >= StringTable.size())
return llvm::make_error<CodeViewError>( return llvm::make_error<CodeViewError>(
"String table offset outside of bounds of String Table!"); "String table offset outside of bounds of String Table!");
@ -386,8 +373,8 @@ Error CVSymbolDumperImpl::visitKnownRecord(
StringTable.drop_front(ProgramStringTableOffset).split('\0').first; StringTable.drop_front(ProgramStringTableOffset).split('\0').first;
W.printString("Program", Program); W.printString("Program", Program);
} }
W.printNumber("OffsetInParent", DefRangeSubfield.Header.OffsetInParent); W.printNumber("OffsetInParent", DefRangeSubfield.OffsetInParent);
printLocalVariableAddrRange(DefRangeSubfield.Header.Range, printLocalVariableAddrRange(DefRangeSubfield.Range,
DefRangeSubfield.getRelocationOffset()); DefRangeSubfield.getRelocationOffset());
printLocalVariableAddrGap(DefRangeSubfield.Gaps); printLocalVariableAddrGap(DefRangeSubfield.Gaps);
return Error::success(); return Error::success();
@ -399,7 +386,7 @@ Error CVSymbolDumperImpl::visitKnownRecord(CVSymbol &CVR,
if (ObjDelegate) { if (ObjDelegate) {
StringRef StringTable = ObjDelegate->getStringTable(); StringRef StringTable = ObjDelegate->getStringTable();
auto ProgramStringTableOffset = DefRange.Header.Program; auto ProgramStringTableOffset = DefRange.Program;
if (ProgramStringTableOffset >= StringTable.size()) if (ProgramStringTableOffset >= StringTable.size())
return llvm::make_error<CodeViewError>( return llvm::make_error<CodeViewError>(
"String table offset outside of bounds of String Table!"); "String table offset outside of bounds of String Table!");
@ -407,8 +394,7 @@ Error CVSymbolDumperImpl::visitKnownRecord(CVSymbol &CVR,
StringTable.drop_front(ProgramStringTableOffset).split('\0').first; StringTable.drop_front(ProgramStringTableOffset).split('\0').first;
W.printString("Program", Program); W.printString("Program", Program);
} }
printLocalVariableAddrRange(DefRange.Header.Range, printLocalVariableAddrRange(DefRange.Range, DefRange.getRelocationOffset());
DefRange.getRelocationOffset());
printLocalVariableAddrGap(DefRange.Gaps); printLocalVariableAddrGap(DefRange.Gaps);
return Error::success(); return Error::success();
} }
@ -419,14 +405,14 @@ Error CVSymbolDumperImpl::visitKnownRecord(CVSymbol &CVR,
StringRef LinkageName; StringRef LinkageName;
if (ObjDelegate) { if (ObjDelegate) {
ObjDelegate->printRelocatedField( ObjDelegate->printRelocatedField("CodeOffset",
"CodeOffset", FrameCookie.getRelocationOffset(), FrameCookie.getRelocationOffset(),
FrameCookie.Header.CodeOffset, &LinkageName); FrameCookie.CodeOffset, &LinkageName);
} }
W.printHex("Register", FrameCookie.Header.Register); W.printHex("Register", FrameCookie.Register);
W.printEnum("CookieKind", uint16_t(FrameCookie.Header.CookieKind), W.printEnum("CookieKind", uint16_t(FrameCookie.CookieKind),
getFrameCookieKindNames()); getFrameCookieKindNames());
W.printHex("Flags", FrameCookie.Header.Flags); W.printHex("Flags", FrameCookie.Flags);
return Error::success(); return Error::success();
} }
@ -434,16 +420,16 @@ Error CVSymbolDumperImpl::visitKnownRecord(CVSymbol &CVR,
FrameProcSym &FrameProc) { FrameProcSym &FrameProc) {
DictScope S(W, "FrameProc"); DictScope S(W, "FrameProc");
W.printHex("TotalFrameBytes", FrameProc.Header.TotalFrameBytes); W.printHex("TotalFrameBytes", FrameProc.TotalFrameBytes);
W.printHex("PaddingFrameBytes", FrameProc.Header.PaddingFrameBytes); W.printHex("PaddingFrameBytes", FrameProc.PaddingFrameBytes);
W.printHex("OffsetToPadding", FrameProc.Header.OffsetToPadding); W.printHex("OffsetToPadding", FrameProc.OffsetToPadding);
W.printHex("BytesOfCalleeSavedRegisters", W.printHex("BytesOfCalleeSavedRegisters",
FrameProc.Header.BytesOfCalleeSavedRegisters); FrameProc.BytesOfCalleeSavedRegisters);
W.printHex("OffsetOfExceptionHandler", W.printHex("OffsetOfExceptionHandler", FrameProc.OffsetOfExceptionHandler);
FrameProc.Header.OffsetOfExceptionHandler);
W.printHex("SectionIdOfExceptionHandler", W.printHex("SectionIdOfExceptionHandler",
FrameProc.Header.SectionIdOfExceptionHandler); FrameProc.SectionIdOfExceptionHandler);
W.printFlags("Flags", FrameProc.Header.Flags, getFrameProcSymFlagNames()); W.printFlags("Flags", static_cast<uint32_t>(FrameProc.Flags),
getFrameProcSymFlagNames());
return Error::success(); return Error::success();
} }
@ -453,13 +439,13 @@ Error CVSymbolDumperImpl::visitKnownRecord(
StringRef LinkageName; StringRef LinkageName;
if (ObjDelegate) { if (ObjDelegate) {
ObjDelegate->printRelocatedField( ObjDelegate->printRelocatedField("CodeOffset",
"CodeOffset", HeapAllocSite.getRelocationOffset(), HeapAllocSite.getRelocationOffset(),
HeapAllocSite.Header.CodeOffset, &LinkageName); HeapAllocSite.CodeOffset, &LinkageName);
} }
W.printHex("Segment", HeapAllocSite.Header.Segment); W.printHex("Segment", HeapAllocSite.Segment);
W.printHex("CallInstructionSize", HeapAllocSite.Header.CallInstructionSize); W.printHex("CallInstructionSize", HeapAllocSite.CallInstructionSize);
CVTD.printTypeIndex("Type", HeapAllocSite.Header.Type); CVTD.printTypeIndex("Type", HeapAllocSite.Type);
if (!LinkageName.empty()) if (!LinkageName.empty())
W.printString("LinkageName", LinkageName); W.printString("LinkageName", LinkageName);
return Error::success(); return Error::success();
@ -469,9 +455,9 @@ Error CVSymbolDumperImpl::visitKnownRecord(CVSymbol &CVR,
InlineSiteSym &InlineSite) { InlineSiteSym &InlineSite) {
DictScope S(W, "InlineSite"); DictScope S(W, "InlineSite");
W.printHex("PtrParent", InlineSite.Header.PtrParent); W.printHex("PtrParent", InlineSite.Parent);
W.printHex("PtrEnd", InlineSite.Header.PtrEnd); W.printHex("PtrEnd", InlineSite.End);
CVTD.printTypeIndex("Inlinee", InlineSite.Header.Inlinee); CVTD.printTypeIndex("Inlinee", InlineSite.Inlinee);
ListScope BinaryAnnotations(W, "BinaryAnnotations"); ListScope BinaryAnnotations(W, "BinaryAnnotations");
for (auto &Annotation : InlineSite.annotations()) { for (auto &Annotation : InlineSite.annotations()) {
@ -525,26 +511,26 @@ Error CVSymbolDumperImpl::visitKnownRecord(CVSymbol &CVR,
Error CVSymbolDumperImpl::visitKnownRecord(CVSymbol &CVR, Error CVSymbolDumperImpl::visitKnownRecord(CVSymbol &CVR,
RegisterSym &Register) { RegisterSym &Register) {
DictScope S(W, "RegisterSym"); DictScope S(W, "RegisterSym");
W.printNumber("Type", Register.Header.Index); W.printNumber("Type", Register.Index);
W.printEnum("Seg", uint16_t(Register.Header.Register), getRegisterNames()); W.printEnum("Seg", uint16_t(Register.Register), getRegisterNames());
W.printString("Name", Register.Name); W.printString("Name", Register.Name);
return Error::success(); return Error::success();
} }
Error CVSymbolDumperImpl::visitKnownRecord(CVSymbol &CVR, PublicSym32 &Public) { Error CVSymbolDumperImpl::visitKnownRecord(CVSymbol &CVR, PublicSym32 &Public) {
DictScope S(W, "PublicSym"); DictScope S(W, "PublicSym");
W.printNumber("Type", Public.Header.Index); W.printNumber("Type", Public.Index);
W.printNumber("Seg", Public.Header.Seg); W.printNumber("Seg", Public.Segment);
W.printNumber("Off", Public.Header.Off); W.printNumber("Off", Public.Offset);
W.printString("Name", Public.Name); W.printString("Name", Public.Name);
return Error::success(); return Error::success();
} }
Error CVSymbolDumperImpl::visitKnownRecord(CVSymbol &CVR, ProcRefSym &ProcRef) { Error CVSymbolDumperImpl::visitKnownRecord(CVSymbol &CVR, ProcRefSym &ProcRef) {
DictScope S(W, "ProcRef"); DictScope S(W, "ProcRef");
W.printNumber("SumName", ProcRef.Header.SumName); W.printNumber("SumName", ProcRef.SumName);
W.printNumber("SymOffset", ProcRef.Header.SymOffset); W.printNumber("SymOffset", ProcRef.SymOffset);
W.printNumber("Mod", ProcRef.Header.Mod); W.printNumber("Mod", ProcRef.Module);
W.printString("Name", ProcRef.Name); W.printString("Name", ProcRef.Name);
return Error::success(); return Error::success();
} }
@ -555,11 +541,11 @@ Error CVSymbolDumperImpl::visitKnownRecord(CVSymbol &CVR, LabelSym &Label) {
StringRef LinkageName; StringRef LinkageName;
if (ObjDelegate) { if (ObjDelegate) {
ObjDelegate->printRelocatedField("CodeOffset", Label.getRelocationOffset(), ObjDelegate->printRelocatedField("CodeOffset", Label.getRelocationOffset(),
Label.Header.CodeOffset, &LinkageName); Label.CodeOffset, &LinkageName);
} }
W.printHex("Segment", Label.Header.Segment); W.printHex("Segment", Label.Segment);
W.printHex("Flags", Label.Header.Flags); W.printHex("Flags", uint8_t(Label.Flags));
W.printFlags("Flags", Label.Header.Flags, getProcSymFlagNames()); W.printFlags("Flags", uint8_t(Label.Flags), getProcSymFlagNames());
W.printString("DisplayName", Label.Name); W.printString("DisplayName", Label.Name);
if (!LinkageName.empty()) if (!LinkageName.empty())
W.printString("LinkageName", LinkageName); W.printString("LinkageName", LinkageName);
@ -569,8 +555,8 @@ Error CVSymbolDumperImpl::visitKnownRecord(CVSymbol &CVR, LabelSym &Label) {
Error CVSymbolDumperImpl::visitKnownRecord(CVSymbol &CVR, LocalSym &Local) { Error CVSymbolDumperImpl::visitKnownRecord(CVSymbol &CVR, LocalSym &Local) {
DictScope S(W, "Local"); DictScope S(W, "Local");
CVTD.printTypeIndex("Type", Local.Header.Type); CVTD.printTypeIndex("Type", Local.Type);
W.printFlags("Flags", uint16_t(Local.Header.Flags), getLocalFlagNames()); W.printFlags("Flags", uint16_t(Local.Flags), getLocalFlagNames());
W.printString("VarName", Local.Name); W.printString("VarName", Local.Name);
return Error::success(); return Error::success();
} }
@ -578,7 +564,7 @@ Error CVSymbolDumperImpl::visitKnownRecord(CVSymbol &CVR, LocalSym &Local) {
Error CVSymbolDumperImpl::visitKnownRecord(CVSymbol &CVR, ObjNameSym &ObjName) { Error CVSymbolDumperImpl::visitKnownRecord(CVSymbol &CVR, ObjNameSym &ObjName) {
DictScope S(W, "ObjectName"); DictScope S(W, "ObjectName");
W.printHex("Signature", ObjName.Header.Signature); W.printHex("Signature", ObjName.Signature);
W.printString("ObjectName", ObjName.Name); W.printString("ObjectName", ObjName.Name);
return Error::success(); return Error::success();
} }
@ -594,19 +580,19 @@ Error CVSymbolDumperImpl::visitKnownRecord(CVSymbol &CVR, ProcSym &Proc) {
StringRef LinkageName; StringRef LinkageName;
W.printEnum("Kind", uint16_t(CVR.kind()), getSymbolTypeNames()); W.printEnum("Kind", uint16_t(CVR.kind()), getSymbolTypeNames());
W.printHex("PtrParent", Proc.Header.PtrParent); W.printHex("PtrParent", Proc.Parent);
W.printHex("PtrEnd", Proc.Header.PtrEnd); W.printHex("PtrEnd", Proc.End);
W.printHex("PtrNext", Proc.Header.PtrNext); W.printHex("PtrNext", Proc.Next);
W.printHex("CodeSize", Proc.Header.CodeSize); W.printHex("CodeSize", Proc.CodeSize);
W.printHex("DbgStart", Proc.Header.DbgStart); W.printHex("DbgStart", Proc.DbgStart);
W.printHex("DbgEnd", Proc.Header.DbgEnd); W.printHex("DbgEnd", Proc.DbgEnd);
CVTD.printTypeIndex("FunctionType", Proc.Header.FunctionType); CVTD.printTypeIndex("FunctionType", Proc.FunctionType);
if (ObjDelegate) { if (ObjDelegate) {
ObjDelegate->printRelocatedField("CodeOffset", Proc.getRelocationOffset(), ObjDelegate->printRelocatedField("CodeOffset", Proc.getRelocationOffset(),
Proc.Header.CodeOffset, &LinkageName); Proc.CodeOffset, &LinkageName);
} }
W.printHex("Segment", Proc.Header.Segment); W.printHex("Segment", Proc.Segment);
W.printFlags("Flags", static_cast<uint8_t>(Proc.Header.Flags), W.printFlags("Flags", static_cast<uint8_t>(Proc.Flags),
getProcSymFlagNames()); getProcSymFlagNames());
W.printString("DisplayName", Proc.Name); W.printString("DisplayName", Proc.Name);
if (!LinkageName.empty()) if (!LinkageName.empty())
@ -638,9 +624,9 @@ Error CVSymbolDumperImpl::visitKnownRecord(CVSymbol &CVR,
RegRelativeSym &RegRel) { RegRelativeSym &RegRel) {
DictScope S(W, "RegRelativeSym"); DictScope S(W, "RegRelativeSym");
W.printHex("Offset", RegRel.Header.Offset); W.printHex("Offset", RegRel.Offset);
CVTD.printTypeIndex("Type", RegRel.Header.Type); CVTD.printTypeIndex("Type", RegRel.Type);
W.printHex("Register", RegRel.Header.Register); W.printHex("Register", RegRel.Register);
W.printString("VarName", RegRel.Name); W.printString("VarName", RegRel.Name);
return Error::success(); return Error::success();
} }
@ -652,9 +638,9 @@ Error CVSymbolDumperImpl::visitKnownRecord(CVSymbol &CVR,
StringRef LinkageName; StringRef LinkageName;
if (ObjDelegate) { if (ObjDelegate) {
ObjDelegate->printRelocatedField("DataOffset", Data.getRelocationOffset(), ObjDelegate->printRelocatedField("DataOffset", Data.getRelocationOffset(),
Data.Header.DataOffset, &LinkageName); Data.DataOffset, &LinkageName);
} }
CVTD.printTypeIndex("Type", Data.Header.Type); CVTD.printTypeIndex("Type", Data.Type);
W.printString("DisplayName", Data.Name); W.printString("DisplayName", Data.Name);
if (!LinkageName.empty()) if (!LinkageName.empty())
W.printString("LinkageName", LinkageName); W.printString("LinkageName", LinkageName);
@ -663,7 +649,7 @@ Error CVSymbolDumperImpl::visitKnownRecord(CVSymbol &CVR,
Error CVSymbolDumperImpl::visitKnownRecord(CVSymbol &CVR, UDTSym &UDT) { Error CVSymbolDumperImpl::visitKnownRecord(CVSymbol &CVR, UDTSym &UDT) {
DictScope S(W, "UDT"); DictScope S(W, "UDT");
CVTD.printTypeIndex("Type", UDT.Header.Type); CVTD.printTypeIndex("Type", UDT.Type);
W.printString("UDTName", UDT.Name); W.printString("UDTName", UDT.Name);
return Error::success(); return Error::success();
} }

View File

@ -0,0 +1,464 @@
//===- SymbolRecordMapping.cpp -----------------------------------*- C++-*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include "llvm/DebugInfo/CodeView/SymbolRecordMapping.h"
using namespace llvm;
using namespace llvm::codeview;
#define error(X) \
if (auto EC = X) \
return EC;
namespace {
struct MapGap {
Error operator()(CodeViewRecordIO &IO, LocalVariableAddrGap &Gap) const {
error(IO.mapInteger(Gap.GapStartOffset));
error(IO.mapInteger(Gap.Range));
return Error::success();
}
};
}
static Error mapLocalVariableAddrRange(CodeViewRecordIO &IO,
LocalVariableAddrRange &Range) {
error(IO.mapInteger(Range.OffsetStart));
error(IO.mapInteger(Range.ISectStart));
error(IO.mapInteger(Range.Range));
return Error::success();
}
Error SymbolRecordMapping::visitSymbolBegin(CVSymbol &Record) {
error(IO.beginRecord(MaxRecordLength - sizeof(RecordPrefix)));
return Error::success();
}
Error SymbolRecordMapping::visitSymbolEnd(CVSymbol &Record) {
error(IO.endRecord());
return Error::success();
}
Error SymbolRecordMapping::visitKnownRecord(CVSymbol &CVR, BlockSym &Block) {
error(IO.mapInteger(Block.Parent));
error(IO.mapInteger(Block.End));
error(IO.mapInteger(Block.CodeSize));
error(IO.mapInteger(Block.CodeOffset));
error(IO.mapInteger(Block.Segment));
error(IO.mapStringZ(Block.Name));
return Error::success();
}
Error SymbolRecordMapping::visitKnownRecord(CVSymbol &CVR, Thunk32Sym &Thunk) {
error(IO.mapInteger(Thunk.Parent));
error(IO.mapInteger(Thunk.End));
error(IO.mapInteger(Thunk.Next));
error(IO.mapInteger(Thunk.Offset));
error(IO.mapInteger(Thunk.Segment));
error(IO.mapInteger(Thunk.Length));
error(IO.mapEnum(Thunk.Thunk));
error(IO.mapStringZ(Thunk.Name));
error(IO.mapByteVectorTail(Thunk.VariantData));
return Error::success();
}
Error SymbolRecordMapping::visitKnownRecord(CVSymbol &CVR,
TrampolineSym &Tramp) {
error(IO.mapEnum(Tramp.Type));
error(IO.mapInteger(Tramp.Size));
error(IO.mapInteger(Tramp.ThunkOffset));
error(IO.mapInteger(Tramp.TargetOffset));
error(IO.mapInteger(Tramp.ThunkSection));
error(IO.mapInteger(Tramp.TargetSection));
return Error::success();
}
Error SymbolRecordMapping::visitKnownRecord(CVSymbol &CVR,
SectionSym &Section) {
uint8_t Padding = 0;
error(IO.mapInteger(Section.SectionNumber));
error(IO.mapInteger(Section.Alignment));
error(IO.mapInteger(Padding));
error(IO.mapInteger(Section.Rva));
error(IO.mapInteger(Section.Length));
error(IO.mapInteger(Section.Characteristics));
error(IO.mapStringZ(Section.Name));
return Error::success();
}
Error SymbolRecordMapping::visitKnownRecord(CVSymbol &CVR,
CoffGroupSym &CoffGroup) {
error(IO.mapInteger(CoffGroup.Size));
error(IO.mapInteger(CoffGroup.Characteristics));
error(IO.mapInteger(CoffGroup.Offset));
error(IO.mapInteger(CoffGroup.Segment));
error(IO.mapStringZ(CoffGroup.Name));
return Error::success();
}
Error SymbolRecordMapping::visitKnownRecord(CVSymbol &CVR,
BPRelativeSym &BPRel) {
error(IO.mapInteger(BPRel.Offset));
error(IO.mapInteger(BPRel.Type));
error(IO.mapStringZ(BPRel.Name));
return Error::success();
}
Error SymbolRecordMapping::visitKnownRecord(CVSymbol &CVR,
BuildInfoSym &BuildInfo) {
error(IO.mapInteger(BuildInfo.BuildId));
return Error::success();
}
Error SymbolRecordMapping::visitKnownRecord(CVSymbol &CVR,
CallSiteInfoSym &CallSiteInfo) {
uint16_t Padding = 0;
error(IO.mapInteger(CallSiteInfo.CodeOffset));
error(IO.mapInteger(CallSiteInfo.Segment));
error(IO.mapInteger(Padding));
error(IO.mapInteger(CallSiteInfo.Type));
return Error::success();
}
Error SymbolRecordMapping::visitKnownRecord(CVSymbol &CVR,
EnvBlockSym &EnvBlock) {
uint8_t Reserved = 0;
error(IO.mapInteger(Reserved));
error(IO.mapStringZVectorZ(EnvBlock.Fields));
return Error::success();
}
Error SymbolRecordMapping::visitKnownRecord(CVSymbol &CVR,
FileStaticSym &FileStatic) {
error(IO.mapInteger(FileStatic.Index));
error(IO.mapInteger(FileStatic.ModFilenameOffset));
error(IO.mapEnum(FileStatic.Flags));
error(IO.mapStringZ(FileStatic.Name));
return Error::success();
}
Error SymbolRecordMapping::visitKnownRecord(CVSymbol &CVR, ExportSym &Export) {
error(IO.mapInteger(Export.Ordinal));
error(IO.mapEnum(Export.Flags));
error(IO.mapStringZ(Export.Name));
return Error::success();
}
Error SymbolRecordMapping::visitKnownRecord(CVSymbol &CVR,
Compile2Sym &Compile2) {
error(IO.mapEnum(Compile2.Flags));
error(IO.mapEnum(Compile2.Machine));
error(IO.mapInteger(Compile2.VersionFrontendMajor));
error(IO.mapInteger(Compile2.VersionFrontendMinor));
error(IO.mapInteger(Compile2.VersionFrontendBuild));
error(IO.mapInteger(Compile2.VersionBackendMajor));
error(IO.mapInteger(Compile2.VersionBackendMinor));
error(IO.mapInteger(Compile2.VersionBackendBuild));
error(IO.mapStringZ(Compile2.Version));
error(IO.mapStringZVectorZ(Compile2.ExtraStrings));
return Error::success();
}
Error SymbolRecordMapping::visitKnownRecord(CVSymbol &CVR,
Compile3Sym &Compile3) {
error(IO.mapEnum(Compile3.Flags));
error(IO.mapEnum(Compile3.Machine));
error(IO.mapInteger(Compile3.VersionFrontendMajor));
error(IO.mapInteger(Compile3.VersionFrontendMinor));
error(IO.mapInteger(Compile3.VersionFrontendBuild));
error(IO.mapInteger(Compile3.VersionFrontendQFE));
error(IO.mapInteger(Compile3.VersionBackendMajor));
error(IO.mapInteger(Compile3.VersionBackendMinor));
error(IO.mapInteger(Compile3.VersionBackendBuild));
error(IO.mapInteger(Compile3.VersionBackendQFE));
error(IO.mapStringZ(Compile3.Version));
return Error::success();
}
Error SymbolRecordMapping::visitKnownRecord(CVSymbol &CVR,
ConstantSym &Constant) {
error(IO.mapInteger(Constant.Type));
error(IO.mapEncodedInteger(Constant.Value));
error(IO.mapStringZ(Constant.Name));
return Error::success();
}
Error SymbolRecordMapping::visitKnownRecord(CVSymbol &CVR, DataSym &Data) {
error(IO.mapInteger(Data.Type));
error(IO.mapInteger(Data.DataOffset));
error(IO.mapInteger(Data.Segment));
error(IO.mapStringZ(Data.Name));
return Error::success();
}
Error SymbolRecordMapping::visitKnownRecord(
CVSymbol &CVR, DefRangeFramePointerRelSym &DefRangeFramePointerRel) {
error(IO.mapInteger(DefRangeFramePointerRel.Offset));
error(mapLocalVariableAddrRange(IO, DefRangeFramePointerRel.Range));
error(IO.mapVectorTail(DefRangeFramePointerRel.Gaps, MapGap()));
return Error::success();
}
Error SymbolRecordMapping::visitKnownRecord(
CVSymbol &CVR,
DefRangeFramePointerRelFullScopeSym &DefRangeFramePointerRelFullScope) {
error(IO.mapInteger(DefRangeFramePointerRelFullScope.Offset));
return Error::success();
}
Error SymbolRecordMapping::visitKnownRecord(
CVSymbol &CVR, DefRangeRegisterRelSym &DefRangeRegisterRel) {
error(IO.mapObject(DefRangeRegisterRel.Hdr.Register));
error(IO.mapObject(DefRangeRegisterRel.Hdr.Flags));
error(IO.mapObject(DefRangeRegisterRel.Hdr.BasePointerOffset));
error(mapLocalVariableAddrRange(IO, DefRangeRegisterRel.Range));
error(IO.mapVectorTail(DefRangeRegisterRel.Gaps, MapGap()));
return Error::success();
}
Error SymbolRecordMapping::visitKnownRecord(
CVSymbol &CVR, DefRangeRegisterSym &DefRangeRegister) {
error(IO.mapObject(DefRangeRegister.Hdr.Register));
error(IO.mapObject(DefRangeRegister.Hdr.MayHaveNoName));
error(mapLocalVariableAddrRange(IO, DefRangeRegister.Range));
error(IO.mapVectorTail(DefRangeRegister.Gaps, MapGap()));
return Error::success();
}
Error SymbolRecordMapping::visitKnownRecord(
CVSymbol &CVR, DefRangeSubfieldRegisterSym &DefRangeSubfieldRegister) {
error(IO.mapObject(DefRangeSubfieldRegister.Hdr.Register));
error(IO.mapObject(DefRangeSubfieldRegister.Hdr.MayHaveNoName));
error(IO.mapObject(DefRangeSubfieldRegister.Hdr.OffsetInParent));
error(mapLocalVariableAddrRange(IO, DefRangeSubfieldRegister.Range));
error(IO.mapVectorTail(DefRangeSubfieldRegister.Gaps, MapGap()));
return Error::success();
}
Error SymbolRecordMapping::visitKnownRecord(
CVSymbol &CVR, DefRangeSubfieldSym &DefRangeSubfield) {
error(IO.mapInteger(DefRangeSubfield.Program));
error(IO.mapInteger(DefRangeSubfield.OffsetInParent));
error(mapLocalVariableAddrRange(IO, DefRangeSubfield.Range));
error(IO.mapVectorTail(DefRangeSubfield.Gaps, MapGap()));
return Error::success();
}
Error SymbolRecordMapping::visitKnownRecord(CVSymbol &CVR,
DefRangeSym &DefRange) {
error(IO.mapInteger(DefRange.Program));
error(mapLocalVariableAddrRange(IO, DefRange.Range));
error(IO.mapVectorTail(DefRange.Gaps, MapGap()));
return Error::success();
}
Error SymbolRecordMapping::visitKnownRecord(CVSymbol &CVR,
FrameCookieSym &FrameCookie) {
error(IO.mapInteger(FrameCookie.CodeOffset));
error(IO.mapInteger(FrameCookie.Register));
error(IO.mapInteger(FrameCookie.CookieKind));
error(IO.mapInteger(FrameCookie.Flags));
return Error::success();
}
Error SymbolRecordMapping::visitKnownRecord(CVSymbol &CVR,
FrameProcSym &FrameProc) {
error(IO.mapInteger(FrameProc.TotalFrameBytes));
error(IO.mapInteger(FrameProc.PaddingFrameBytes));
error(IO.mapInteger(FrameProc.OffsetToPadding));
error(IO.mapInteger(FrameProc.BytesOfCalleeSavedRegisters));
error(IO.mapInteger(FrameProc.OffsetOfExceptionHandler));
error(IO.mapInteger(FrameProc.SectionIdOfExceptionHandler));
error(IO.mapEnum(FrameProc.Flags));
return Error::success();
}
Error SymbolRecordMapping::visitKnownRecord(
CVSymbol &CVR, HeapAllocationSiteSym &HeapAllocSite) {
error(IO.mapInteger(HeapAllocSite.CodeOffset));
error(IO.mapInteger(HeapAllocSite.Segment));
error(IO.mapInteger(HeapAllocSite.CallInstructionSize));
error(IO.mapInteger(HeapAllocSite.Type));
return Error::success();
}
Error SymbolRecordMapping::visitKnownRecord(CVSymbol &CVR,
InlineSiteSym &InlineSite) {
error(IO.mapInteger(InlineSite.Parent));
error(IO.mapInteger(InlineSite.End));
error(IO.mapInteger(InlineSite.Inlinee));
error(IO.mapByteVectorTail(InlineSite.AnnotationData));
return Error::success();
}
Error SymbolRecordMapping::visitKnownRecord(CVSymbol &CVR,
RegisterSym &Register) {
error(IO.mapInteger(Register.Index));
error(IO.mapEnum(Register.Register));
error(IO.mapStringZ(Register.Name));
return Error::success();
}
Error SymbolRecordMapping::visitKnownRecord(CVSymbol &CVR,
PublicSym32 &Public) {
error(IO.mapInteger(Public.Index));
error(IO.mapInteger(Public.Offset));
error(IO.mapInteger(Public.Segment));
error(IO.mapStringZ(Public.Name));
return Error::success();
}
Error SymbolRecordMapping::visitKnownRecord(CVSymbol &CVR,
ProcRefSym &ProcRef) {
error(IO.mapInteger(ProcRef.SumName));
error(IO.mapInteger(ProcRef.SymOffset));
error(IO.mapInteger(ProcRef.Module));
error(IO.mapStringZ(ProcRef.Name));
return Error::success();
}
Error SymbolRecordMapping::visitKnownRecord(CVSymbol &CVR, LabelSym &Label) {
error(IO.mapInteger(Label.CodeOffset));
error(IO.mapInteger(Label.Segment));
error(IO.mapEnum(Label.Flags));
error(IO.mapStringZ(Label.Name));
return Error::success();
}
Error SymbolRecordMapping::visitKnownRecord(CVSymbol &CVR, LocalSym &Local) {
error(IO.mapInteger(Local.Type));
error(IO.mapEnum(Local.Flags));
error(IO.mapStringZ(Local.Name));
return Error::success();
}
Error SymbolRecordMapping::visitKnownRecord(CVSymbol &CVR,
ObjNameSym &ObjName) {
error(IO.mapInteger(ObjName.Signature));
error(IO.mapStringZ(ObjName.Name));
return Error::success();
}
Error SymbolRecordMapping::visitKnownRecord(CVSymbol &CVR, ProcSym &Proc) {
error(IO.mapInteger(Proc.Parent));
error(IO.mapInteger(Proc.End));
error(IO.mapInteger(Proc.Next));
error(IO.mapInteger(Proc.CodeSize));
error(IO.mapInteger(Proc.DbgStart));
error(IO.mapInteger(Proc.DbgEnd));
error(IO.mapInteger(Proc.FunctionType));
error(IO.mapInteger(Proc.CodeOffset));
error(IO.mapInteger(Proc.Segment));
error(IO.mapEnum(Proc.Flags));
error(IO.mapStringZ(Proc.Name));
return Error::success();
}
Error SymbolRecordMapping::visitKnownRecord(CVSymbol &CVR,
ScopeEndSym &ScopeEnd) {
return Error::success();
}
Error SymbolRecordMapping::visitKnownRecord(CVSymbol &CVR, CallerSym &Caller) {
error(IO.mapVectorN<uint32_t>(
Caller.Indices,
[](CodeViewRecordIO &IO, TypeIndex &N) { return IO.mapInteger(N); }));
return Error::success();
}
Error SymbolRecordMapping::visitKnownRecord(CVSymbol &CVR,
RegRelativeSym &RegRel) {
error(IO.mapInteger(RegRel.Offset));
error(IO.mapInteger(RegRel.Type));
error(IO.mapInteger(RegRel.Register));
error(IO.mapStringZ(RegRel.Name));
return Error::success();
}
Error SymbolRecordMapping::visitKnownRecord(CVSymbol &CVR,
ThreadLocalDataSym &Data) {
error(IO.mapInteger(Data.Type));
error(IO.mapInteger(Data.DataOffset));
error(IO.mapInteger(Data.Segment));
error(IO.mapStringZ(Data.Name));
return Error::success();
}
Error SymbolRecordMapping::visitKnownRecord(CVSymbol &CVR, UDTSym &UDT) {
error(IO.mapInteger(UDT.Type));
error(IO.mapStringZ(UDT.Name));
return Error::success();
}

View File

@ -0,0 +1 @@
#include "llvm/DebugInfo/CodeView/SymbolSerializer.h"

View File

@ -361,7 +361,9 @@ void CodeViewContext::encodeInlineLineTable(MCAsmLayout &Layout,
// Exit early if our line table would produce an oversized InlineSiteSym // Exit early if our line table would produce an oversized InlineSiteSym
// record. Account for the ChangeCodeLength annotation emitted after the // record. Account for the ChangeCodeLength annotation emitted after the
// loop ends. // loop ends.
size_t MaxBufferSize = MaxRecordLength - sizeof(InlineSiteSym::Hdr) - 8; constexpr uint32_t InlineSiteSize = 12;
constexpr uint32_t AnnotationSize = 8;
size_t MaxBufferSize = MaxRecordLength - InlineSiteSize - AnnotationSize;
if (Buffer.size() >= MaxBufferSize) if (Buffer.size() >= MaxBufferSize)
break; break;

View File

@ -35,8 +35,8 @@ YAML: Signature: 0
YAML: ObjectName: 'd:\src\llvm\test\DebugInfo\PDB\Inputs\empty.obj' YAML: ObjectName: 'd:\src\llvm\test\DebugInfo\PDB\Inputs\empty.obj'
YAML: - Kind: S_COMPILE3 YAML: - Kind: S_COMPILE3
YAML: Compile3Sym: YAML: Compile3Sym:
YAML: Flags: 8193 YAML: Flags: [ SecurityChecks ]
YAML: Machine: 7 YAML: Machine: Pentium3
YAML: FrontendMajor: 18 YAML: FrontendMajor: 18
YAML: FrontendMinor: 0 YAML: FrontendMinor: 0
YAML: FrontendBuild: 31101 YAML: FrontendBuild: 31101
@ -56,7 +56,7 @@ YAML: DbgStart: 3
YAML: DbgEnd: 8 YAML: DbgEnd: 8
YAML: FunctionType: 4097 YAML: FunctionType: 4097
YAML: Segment: 1 YAML: Segment: 1
YAML: Flags: 1 YAML: Flags: [ HasFP ]
YAML: DisplayName: main YAML: DisplayName: main
YAML: - Kind: S_FRAMEPROC YAML: - Kind: S_FRAMEPROC
YAML: FrameProcSym: YAML: FrameProcSym:
@ -66,7 +66,7 @@ YAML: OffsetToPadding: 0
YAML: BytesOfCalleeSavedRegisters: 0 YAML: BytesOfCalleeSavedRegisters: 0
YAML: OffsetOfExceptionHandler: 0 YAML: OffsetOfExceptionHandler: 0
YAML: SectionIdOfExceptionHandler: 0 YAML: SectionIdOfExceptionHandler: 0
YAML: Flags: 1212928 YAML: Flags: [ AsynchronousExceptionHandling, OptimizedForSpeed ]
YAML: - Kind: S_END YAML: - Kind: S_END
YAML: ScopeEndSym: YAML: ScopeEndSym:
YAML: - Kind: S_BUILDINFO YAML: - Kind: S_BUILDINFO
@ -83,8 +83,8 @@ YAML: Signature: 0
YAML: ObjectName: '* Linker *' YAML: ObjectName: '* Linker *'
YAML: - Kind: S_COMPILE3 YAML: - Kind: S_COMPILE3
YAML: Compile3Sym: YAML: Compile3Sym:
YAML: Flags: 7 YAML: Flags: [ ]
YAML: Machine: 3 YAML: Machine: Intel80386
YAML: FrontendMajor: 0 YAML: FrontendMajor: 0
YAML: FrontendMinor: 0 YAML: FrontendMinor: 0
YAML: FrontendBuild: 0 YAML: FrontendBuild: 0
@ -96,7 +96,6 @@ YAML: BackendQFE: 0
YAML: Version: 'Microsoft (R) LINK' YAML: Version: 'Microsoft (R) LINK'
YAML: - Kind: S_ENVBLOCK YAML: - Kind: S_ENVBLOCK
YAML: EnvBlockSym: YAML: EnvBlockSym:
YAML: Reserved: 0
YAML: Entries: YAML: Entries:
YAML: - cwd YAML: - cwd
YAML: - 'd:\src\llvm\test\DebugInfo\PDB\Inputs' YAML: - 'd:\src\llvm\test\DebugInfo\PDB\Inputs'
@ -106,7 +105,7 @@ YAML: - pdb
YAML: - 'd:\src\llvm\test\DebugInfo\PDB\Inputs\empty.pdb' YAML: - 'd:\src\llvm\test\DebugInfo\PDB\Inputs\empty.pdb'
YAML: - Kind: S_TRAMPOLINE YAML: - Kind: S_TRAMPOLINE
YAML: TrampolineSym: YAML: TrampolineSym:
YAML: Type: 0 YAML: Type: TrampIncremental
YAML: Size: 5 YAML: Size: 5
YAML: ThunkOff: 5 YAML: ThunkOff: 5
YAML: TargetOff: 16 YAML: TargetOff: 16
@ -116,7 +115,6 @@ YAML: - Kind: S_SECTION
YAML: SectionSym: YAML: SectionSym:
YAML: SectionNumber: 1 YAML: SectionNumber: 1
YAML: Alignment: 12 YAML: Alignment: 12
YAML: Reserved: 0
YAML: Rva: 4096 YAML: Rva: 4096
YAML: Length: 4122 YAML: Length: 4122
YAML: Characteristics: 1610612768 YAML: Characteristics: 1610612768
@ -132,7 +130,6 @@ YAML: - Kind: S_SECTION
YAML: SectionSym: YAML: SectionSym:
YAML: SectionNumber: 2 YAML: SectionNumber: 2
YAML: Alignment: 12 YAML: Alignment: 12
YAML: Reserved: 0
YAML: Rva: 12288 YAML: Rva: 12288
YAML: Length: 690 YAML: Length: 690
YAML: Characteristics: 1073741888 YAML: Characteristics: 1073741888
@ -162,7 +159,6 @@ YAML: - Kind: S_SECTION
YAML: SectionSym: YAML: SectionSym:
YAML: SectionNumber: 3 YAML: SectionNumber: 3
YAML: Alignment: 12 YAML: Alignment: 12
YAML: Reserved: 0
YAML: Rva: 16384 YAML: Rva: 16384
YAML: Length: 4 YAML: Length: 4
YAML: Characteristics: 3221225536 YAML: Characteristics: 3221225536
@ -178,7 +174,6 @@ YAML: - Kind: S_SECTION
YAML: SectionSym: YAML: SectionSym:
YAML: SectionNumber: 4 YAML: SectionNumber: 4
YAML: Alignment: 12 YAML: Alignment: 12
YAML: Reserved: 0
YAML: Rva: 20480 YAML: Rva: 20480
YAML: Length: 8 YAML: Length: 8
YAML: Characteristics: 1107296320 YAML: Characteristics: 1107296320

View File

@ -417,7 +417,6 @@
; EMPTY-NEXT: } ; EMPTY-NEXT: }
; EMPTY-NEXT: { ; EMPTY-NEXT: {
; EMPTY-NEXT: EnvBlock { ; EMPTY-NEXT: EnvBlock {
; EMPTY-NEXT: Reserved: 0
; EMPTY-NEXT: Entries [ ; EMPTY-NEXT: Entries [
; EMPTY-NEXT: cwd ; EMPTY-NEXT: cwd
; EMPTY-NEXT: d:\src\llvm\test\DebugInfo\PDB\Inputs ; EMPTY-NEXT: d:\src\llvm\test\DebugInfo\PDB\Inputs
@ -458,7 +457,6 @@
; EMPTY-NEXT: Section { ; EMPTY-NEXT: Section {
; EMPTY-NEXT: SectionNumber: 1 ; EMPTY-NEXT: SectionNumber: 1
; EMPTY-NEXT: Alignment: 12 ; EMPTY-NEXT: Alignment: 12
; EMPTY-NEXT: Reserved: 0
; EMPTY-NEXT: Rva: 4096 ; EMPTY-NEXT: Rva: 4096
; EMPTY-NEXT: Length: 4122 ; EMPTY-NEXT: Length: 4122
; EMPTY-NEXT: Characteristics [ (0x60000020) ; EMPTY-NEXT: Characteristics [ (0x60000020)
@ -494,7 +492,6 @@
; EMPTY-NEXT: Section { ; EMPTY-NEXT: Section {
; EMPTY-NEXT: SectionNumber: 2 ; EMPTY-NEXT: SectionNumber: 2
; EMPTY-NEXT: Alignment: 12 ; EMPTY-NEXT: Alignment: 12
; EMPTY-NEXT: Reserved: 0
; EMPTY-NEXT: Rva: 12288 ; EMPTY-NEXT: Rva: 12288
; EMPTY-NEXT: Length: 690 ; EMPTY-NEXT: Length: 690
; EMPTY-NEXT: Characteristics [ (0x40000040) ; EMPTY-NEXT: Characteristics [ (0x40000040)
@ -560,7 +557,6 @@
; EMPTY-NEXT: Section { ; EMPTY-NEXT: Section {
; EMPTY-NEXT: SectionNumber: 3 ; EMPTY-NEXT: SectionNumber: 3
; EMPTY-NEXT: Alignment: 12 ; EMPTY-NEXT: Alignment: 12
; EMPTY-NEXT: Reserved: 0
; EMPTY-NEXT: Rva: 16384 ; EMPTY-NEXT: Rva: 16384
; EMPTY-NEXT: Length: 4 ; EMPTY-NEXT: Length: 4
; EMPTY-NEXT: Characteristics [ (0xC0000040) ; EMPTY-NEXT: Characteristics [ (0xC0000040)
@ -596,7 +592,6 @@
; EMPTY-NEXT: Section { ; EMPTY-NEXT: Section {
; EMPTY-NEXT: SectionNumber: 4 ; EMPTY-NEXT: SectionNumber: 4
; EMPTY-NEXT: Alignment: 12 ; EMPTY-NEXT: Alignment: 12
; EMPTY-NEXT: Reserved: 0
; EMPTY-NEXT: Rva: 20480 ; EMPTY-NEXT: Rva: 20480
; EMPTY-NEXT: Length: 8 ; EMPTY-NEXT: Length: 8
; EMPTY-NEXT: Characteristics [ (0x42000040) ; EMPTY-NEXT: Characteristics [ (0x42000040)
@ -1255,7 +1250,6 @@
; ALL: } ; ALL: }
; ALL: { ; ALL: {
; ALL: EnvBlock { ; ALL: EnvBlock {
; ALL: Reserved: 0
; ALL: Entries [ ; ALL: Entries [
; ALL: cwd ; ALL: cwd
; ALL: d:\src\llvm\test\DebugInfo\PDB\Inputs ; ALL: d:\src\llvm\test\DebugInfo\PDB\Inputs
@ -1280,7 +1274,6 @@
; ALL: Section { ; ALL: Section {
; ALL: SectionNumber: 1 ; ALL: SectionNumber: 1
; ALL: Alignment: 12 ; ALL: Alignment: 12
; ALL: Reserved: 0
; ALL: Rva: 4096 ; ALL: Rva: 4096
; ALL: Length: 4122 ; ALL: Length: 4122
; ALL: Characteristics [ (0x60000020) ; ALL: Characteristics [ (0x60000020)
@ -1308,7 +1301,6 @@
; ALL: Section { ; ALL: Section {
; ALL: SectionNumber: 2 ; ALL: SectionNumber: 2
; ALL: Alignment: 12 ; ALL: Alignment: 12
; ALL: Reserved: 0
; ALL: Rva: 12288 ; ALL: Rva: 12288
; ALL: Length: 690 ; ALL: Length: 690
; ALL: Characteristics [ (0x40000040) ; ALL: Characteristics [ (0x40000040)
@ -1358,7 +1350,6 @@
; ALL: Section { ; ALL: Section {
; ALL: SectionNumber: 3 ; ALL: SectionNumber: 3
; ALL: Alignment: 12 ; ALL: Alignment: 12
; ALL: Reserved: 0
; ALL: Rva: 16384 ; ALL: Rva: 16384
; ALL: Length: 4 ; ALL: Length: 4
; ALL: Characteristics [ (0xC0000040) ; ALL: Characteristics [ (0xC0000040)
@ -1386,7 +1377,6 @@
; ALL: Section { ; ALL: Section {
; ALL: SectionNumber: 4 ; ALL: SectionNumber: 4
; ALL: Alignment: 12 ; ALL: Alignment: 12
; ALL: Reserved: 0
; ALL: Rva: 20480 ; ALL: Rva: 20480
; ALL: Length: 8 ; ALL: Length: 8
; ALL: Characteristics [ (0x42000040) ; ALL: Characteristics [ (0x42000040)

View File

@ -38,105 +38,197 @@ void ScalarEnumerationTraits<SymbolKind>::enumeration(IO &io,
io.enumCase(Value, E.Name.str().c_str(), E.Value); io.enumCase(Value, E.Name.str().c_str(), E.Value);
} }
template <> struct ScalarBitSetTraits<CompileSym2Flags> {
static void bitset(IO &io, CompileSym2Flags &Flags) {
auto FlagNames = getCompileSym2FlagNames();
for (const auto &E : FlagNames) {
io.bitSetCase(Flags, E.Name.str().c_str(),
static_cast<CompileSym2Flags>(E.Value));
}
}
};
template <> struct ScalarBitSetTraits<CompileSym3Flags> {
static void bitset(IO &io, CompileSym3Flags &Flags) {
auto FlagNames = getCompileSym3FlagNames();
for (const auto &E : FlagNames) {
io.bitSetCase(Flags, E.Name.str().c_str(),
static_cast<CompileSym3Flags>(E.Value));
}
}
};
template <> struct ScalarBitSetTraits<ExportFlags> {
static void bitset(IO &io, ExportFlags &Flags) {
auto FlagNames = getExportSymFlagNames();
for (const auto &E : FlagNames) {
io.bitSetCase(Flags, E.Name.str().c_str(),
static_cast<ExportFlags>(E.Value));
}
}
};
template <> struct ScalarBitSetTraits<LocalSymFlags> {
static void bitset(IO &io, LocalSymFlags &Flags) {
auto FlagNames = getLocalFlagNames();
for (const auto &E : FlagNames) {
io.bitSetCase(Flags, E.Name.str().c_str(),
static_cast<LocalSymFlags>(E.Value));
}
}
};
template <> struct ScalarBitSetTraits<ProcSymFlags> {
static void bitset(IO &io, ProcSymFlags &Flags) {
auto FlagNames = getProcSymFlagNames();
for (const auto &E : FlagNames) {
io.bitSetCase(Flags, E.Name.str().c_str(),
static_cast<ProcSymFlags>(E.Value));
}
}
};
template <> struct ScalarBitSetTraits<FrameProcedureOptions> {
static void bitset(IO &io, FrameProcedureOptions &Flags) {
auto FlagNames = getFrameProcSymFlagNames();
for (const auto &E : FlagNames) {
io.bitSetCase(Flags, E.Name.str().c_str(),
static_cast<FrameProcedureOptions>(E.Value));
}
}
};
template <> struct ScalarEnumerationTraits<CPUType> {
static void enumeration(IO &io, CPUType &Cpu) {
auto CpuNames = getCPUTypeNames();
for (const auto &E : CpuNames) {
io.enumCase(Cpu, E.Name.str().c_str(), static_cast<CPUType>(E.Value));
}
}
};
template <> struct ScalarEnumerationTraits<RegisterId> {
static void enumeration(IO &io, RegisterId &Reg) {
auto RegNames = getRegisterNames();
for (const auto &E : RegNames) {
io.enumCase(Reg, E.Name.str().c_str(), static_cast<RegisterId>(E.Value));
}
}
};
template <> struct ScalarEnumerationTraits<TrampolineType> {
static void enumeration(IO &io, TrampolineType &Tramp) {
auto TrampNames = getTrampolineNames();
for (const auto &E : TrampNames) {
io.enumCase(Tramp, E.Name.str().c_str(),
static_cast<TrampolineType>(E.Value));
}
}
};
template <> struct ScalarEnumerationTraits<ThunkOrdinal> { template <> struct ScalarEnumerationTraits<ThunkOrdinal> {
void enumeration(IO &io, ThunkOrdinal Ord) {} static void enumeration(IO &io, ThunkOrdinal &Ord) {
auto ThunkNames = getThunkOrdinalNames();
for (const auto &E : ThunkNames) {
io.enumCase(Ord, E.Name.str().c_str(),
static_cast<ThunkOrdinal>(E.Value));
}
}
}; };
void MappingTraits<ScopeEndSym>::mapping(IO &IO, ScopeEndSym &Obj) {} void MappingTraits<ScopeEndSym>::mapping(IO &IO, ScopeEndSym &Obj) {}
void MappingTraits<Thunk32Sym>::mapping(IO &IO, Thunk32Sym &Thunk) { void MappingTraits<Thunk32Sym>::mapping(IO &IO, Thunk32Sym &Thunk) {
IO.mapRequired("Parent", Thunk.Header.Parent); IO.mapRequired("Parent", Thunk.Parent);
IO.mapRequired("End", Thunk.Header.End); IO.mapRequired("End", Thunk.End);
IO.mapRequired("Next", Thunk.Header.Next); IO.mapRequired("Next", Thunk.Next);
IO.mapRequired("Off", Thunk.Header.Off); IO.mapRequired("Off", Thunk.Offset);
IO.mapRequired("Seg", Thunk.Header.Seg); IO.mapRequired("Seg", Thunk.Segment);
IO.mapRequired("Len", Thunk.Header.Len); IO.mapRequired("Len", Thunk.Length);
IO.mapRequired("Ordinal", Thunk.Header.Ord); IO.mapRequired("Ordinal", Thunk.Thunk);
} }
void MappingTraits<TrampolineSym>::mapping(IO &IO, TrampolineSym &Tramp) { void MappingTraits<TrampolineSym>::mapping(IO &IO, TrampolineSym &Tramp) {
IO.mapRequired("Type", Tramp.Header.Type); IO.mapRequired("Type", Tramp.Type);
IO.mapRequired("Size", Tramp.Header.Size); IO.mapRequired("Size", Tramp.Size);
IO.mapRequired("ThunkOff", Tramp.Header.ThunkOff); IO.mapRequired("ThunkOff", Tramp.ThunkOffset);
IO.mapRequired("TargetOff", Tramp.Header.TargetOff); IO.mapRequired("TargetOff", Tramp.TargetOffset);
IO.mapRequired("ThunkSection", Tramp.Header.ThunkSection); IO.mapRequired("ThunkSection", Tramp.ThunkSection);
IO.mapRequired("TargetSection", Tramp.Header.TargetSection); IO.mapRequired("TargetSection", Tramp.TargetSection);
} }
void MappingTraits<SectionSym>::mapping(IO &IO, SectionSym &Section) { void MappingTraits<SectionSym>::mapping(IO &IO, SectionSym &Section) {
IO.mapRequired("SectionNumber", Section.Header.SectionNumber); IO.mapRequired("SectionNumber", Section.SectionNumber);
IO.mapRequired("Alignment", Section.Header.Alignment); IO.mapRequired("Alignment", Section.Alignment);
IO.mapRequired("Reserved", Section.Header.Reserved); IO.mapRequired("Rva", Section.Rva);
IO.mapRequired("Rva", Section.Header.Rva); IO.mapRequired("Length", Section.Length);
IO.mapRequired("Length", Section.Header.Length); IO.mapRequired("Characteristics", Section.Characteristics);
IO.mapRequired("Characteristics", Section.Header.Characteristics);
IO.mapRequired("Name", Section.Name); IO.mapRequired("Name", Section.Name);
} }
void MappingTraits<CoffGroupSym>::mapping(IO &IO, CoffGroupSym &CoffGroup) { void MappingTraits<CoffGroupSym>::mapping(IO &IO, CoffGroupSym &CoffGroup) {
IO.mapRequired("Size", CoffGroup.Header.Size); IO.mapRequired("Size", CoffGroup.Size);
IO.mapRequired("Characteristics", CoffGroup.Header.Characteristics); IO.mapRequired("Characteristics", CoffGroup.Characteristics);
IO.mapRequired("Offset", CoffGroup.Header.Offset); IO.mapRequired("Offset", CoffGroup.Offset);
IO.mapRequired("Segment", CoffGroup.Header.Segment); IO.mapRequired("Segment", CoffGroup.Segment);
IO.mapRequired("Name", CoffGroup.Name); IO.mapRequired("Name", CoffGroup.Name);
} }
void MappingTraits<ExportSym>::mapping(IO &IO, ExportSym &Export) { void MappingTraits<ExportSym>::mapping(IO &IO, ExportSym &Export) {
IO.mapRequired("Ordinal", Export.Header.Ordinal); IO.mapRequired("Ordinal", Export.Ordinal);
IO.mapRequired("Flags", Export.Header.Flags); IO.mapRequired("Flags", Export.Flags);
IO.mapRequired("Name", Export.Name); IO.mapRequired("Name", Export.Name);
} }
void MappingTraits<ProcSym>::mapping(IO &IO, ProcSym &Proc) { void MappingTraits<ProcSym>::mapping(IO &IO, ProcSym &Proc) {
// TODO: Print the linkage name // TODO: Print the linkage name
IO.mapRequired("PtrParent", Proc.Header.PtrParent); IO.mapRequired("PtrParent", Proc.Parent);
IO.mapRequired("PtrEnd", Proc.Header.PtrEnd); IO.mapRequired("PtrEnd", Proc.End);
IO.mapRequired("PtrNext", Proc.Header.PtrNext); IO.mapRequired("PtrNext", Proc.Next);
IO.mapRequired("CodeSize", Proc.Header.CodeSize); IO.mapRequired("CodeSize", Proc.CodeSize);
IO.mapRequired("DbgStart", Proc.Header.DbgStart); IO.mapRequired("DbgStart", Proc.DbgStart);
IO.mapRequired("DbgEnd", Proc.Header.DbgEnd); IO.mapRequired("DbgEnd", Proc.DbgEnd);
IO.mapRequired("FunctionType", Proc.Header.FunctionType); IO.mapRequired("FunctionType", Proc.FunctionType);
IO.mapRequired("Segment", Proc.Header.Segment); IO.mapRequired("Segment", Proc.Segment);
IO.mapRequired("Flags", Proc.Header.Flags); IO.mapRequired("Flags", Proc.Flags);
IO.mapRequired("DisplayName", Proc.Name); IO.mapRequired("DisplayName", Proc.Name);
} }
void MappingTraits<RegisterSym>::mapping(IO &IO, RegisterSym &Register) { void MappingTraits<RegisterSym>::mapping(IO &IO, RegisterSym &Register) {
IO.mapRequired("Type", Register.Header.Index); IO.mapRequired("Type", Register.Index);
IO.mapRequired("Seg", Register.Header.Register); IO.mapRequired("Seg", Register.Register);
IO.mapRequired("Name", Register.Name); IO.mapRequired("Name", Register.Name);
} }
void MappingTraits<PublicSym32>::mapping(IO &IO, PublicSym32 &Public) { void MappingTraits<PublicSym32>::mapping(IO &IO, PublicSym32 &Public) {
IO.mapRequired("Type", Public.Header.Index); IO.mapRequired("Type", Public.Index);
IO.mapRequired("Seg", Public.Header.Seg); IO.mapRequired("Seg", Public.Segment);
IO.mapRequired("Off", Public.Header.Off); IO.mapRequired("Off", Public.Offset);
IO.mapRequired("Name", Public.Name); IO.mapRequired("Name", Public.Name);
} }
void MappingTraits<ProcRefSym>::mapping(IO &IO, ProcRefSym &ProcRef) { void MappingTraits<ProcRefSym>::mapping(IO &IO, ProcRefSym &ProcRef) {
IO.mapRequired("SumName", ProcRef.Header.SumName); IO.mapRequired("SumName", ProcRef.SumName);
IO.mapRequired("SymOffset", ProcRef.Header.SymOffset); IO.mapRequired("SymOffset", ProcRef.SymOffset);
IO.mapRequired("Mod", ProcRef.Header.Mod); IO.mapRequired("Mod", ProcRef.Module);
IO.mapRequired("Name", ProcRef.Name); IO.mapRequired("Name", ProcRef.Name);
} }
void MappingTraits<EnvBlockSym>::mapping(IO &IO, EnvBlockSym &EnvBlock) { void MappingTraits<EnvBlockSym>::mapping(IO &IO, EnvBlockSym &EnvBlock) {
IO.mapRequired("Reserved", EnvBlock.Header.Reserved);
IO.mapRequired("Entries", EnvBlock.Fields); IO.mapRequired("Entries", EnvBlock.Fields);
} }
void MappingTraits<InlineSiteSym>::mapping(IO &IO, InlineSiteSym &InlineSite) { void MappingTraits<InlineSiteSym>::mapping(IO &IO, InlineSiteSym &InlineSite) {
IO.mapRequired("PtrParent", InlineSite.Header.PtrParent); IO.mapRequired("PtrParent", InlineSite.Parent);
IO.mapRequired("PtrEnd", InlineSite.Header.PtrEnd); IO.mapRequired("PtrEnd", InlineSite.End);
IO.mapRequired("Inlinee", InlineSite.Header.Inlinee); IO.mapRequired("Inlinee", InlineSite.Inlinee);
// TODO: The binary annotations // TODO: The binary annotations
} }
void MappingTraits<LocalSym>::mapping(IO &IO, LocalSym &Local) { void MappingTraits<LocalSym>::mapping(IO &IO, LocalSym &Local) {
IO.mapRequired("Type", Local.Header.Type); IO.mapRequired("Type", Local.Type);
IO.mapRequired("Flags", Local.Header.Flags); IO.mapRequired("Flags", Local.Flags);
IO.mapRequired("VarName", Local.Name); IO.mapRequired("VarName", Local.Name);
} }
@ -176,95 +268,93 @@ void MappingTraits<DefRangeRegisterRelSym>::mapping(
void MappingTraits<BlockSym>::mapping(IO &IO, BlockSym &Block) { void MappingTraits<BlockSym>::mapping(IO &IO, BlockSym &Block) {
// TODO: Print the linkage name // TODO: Print the linkage name
IO.mapRequired("PtrParent", Block.Header.PtrParent); IO.mapRequired("PtrParent", Block.Parent);
IO.mapRequired("PtrEnd", Block.Header.PtrEnd); IO.mapRequired("PtrEnd", Block.End);
IO.mapRequired("CodeSize", Block.Header.CodeSize); IO.mapRequired("CodeSize", Block.CodeSize);
IO.mapRequired("Segment", Block.Header.Segment); IO.mapRequired("Segment", Block.Segment);
IO.mapRequired("BlockName", Block.Name); IO.mapRequired("BlockName", Block.Name);
} }
void MappingTraits<LabelSym>::mapping(IO &IO, LabelSym &Label) { void MappingTraits<LabelSym>::mapping(IO &IO, LabelSym &Label) {
// TODO: Print the linkage name // TODO: Print the linkage name
IO.mapRequired("Segment", Label.Header.Segment); IO.mapRequired("Segment", Label.Segment);
IO.mapRequired("Flags", Label.Header.Flags); IO.mapRequired("Flags", Label.Flags);
IO.mapRequired("Flags", Label.Header.Flags); IO.mapRequired("Flags", Label.Flags);
IO.mapRequired("DisplayName", Label.Name); IO.mapRequired("DisplayName", Label.Name);
} }
void MappingTraits<ObjNameSym>::mapping(IO &IO, ObjNameSym &ObjName) { void MappingTraits<ObjNameSym>::mapping(IO &IO, ObjNameSym &ObjName) {
IO.mapRequired("Signature", ObjName.Header.Signature); IO.mapRequired("Signature", ObjName.Signature);
IO.mapRequired("ObjectName", ObjName.Name); IO.mapRequired("ObjectName", ObjName.Name);
} }
void MappingTraits<Compile2Sym>::mapping(IO &IO, Compile2Sym &Compile2) { void MappingTraits<Compile2Sym>::mapping(IO &IO, Compile2Sym &Compile2) {
IO.mapRequired("Flags", Compile2.Header.flags); IO.mapRequired("Flags", Compile2.Flags);
IO.mapRequired("Machine", Compile2.Header.Machine); IO.mapRequired("Machine", Compile2.Machine);
IO.mapRequired("FrontendMajor", Compile2.Header.VersionFrontendMajor); IO.mapRequired("FrontendMajor", Compile2.VersionFrontendMajor);
IO.mapRequired("FrontendMinor", Compile2.Header.VersionFrontendMinor); IO.mapRequired("FrontendMinor", Compile2.VersionFrontendMinor);
IO.mapRequired("FrontendBuild", Compile2.Header.VersionFrontendBuild); IO.mapRequired("FrontendBuild", Compile2.VersionFrontendBuild);
IO.mapRequired("BackendMajor", Compile2.Header.VersionBackendMajor); IO.mapRequired("BackendMajor", Compile2.VersionBackendMajor);
IO.mapRequired("BackendMinor", Compile2.Header.VersionBackendMinor); IO.mapRequired("BackendMinor", Compile2.VersionBackendMinor);
IO.mapRequired("BackendBuild", Compile2.Header.VersionBackendBuild); IO.mapRequired("BackendBuild", Compile2.VersionBackendBuild);
IO.mapRequired("Version", Compile2.Version); IO.mapRequired("Version", Compile2.Version);
} }
void MappingTraits<Compile3Sym>::mapping(IO &IO, Compile3Sym &Compile3) { void MappingTraits<Compile3Sym>::mapping(IO &IO, Compile3Sym &Compile3) {
IO.mapRequired("Flags", Compile3.Header.flags); IO.mapRequired("Flags", Compile3.Flags);
IO.mapRequired("Machine", Compile3.Header.Machine); IO.mapRequired("Machine", Compile3.Machine);
IO.mapRequired("FrontendMajor", Compile3.Header.VersionFrontendMajor); IO.mapRequired("FrontendMajor", Compile3.VersionFrontendMajor);
IO.mapRequired("FrontendMinor", Compile3.Header.VersionFrontendMinor); IO.mapRequired("FrontendMinor", Compile3.VersionFrontendMinor);
IO.mapRequired("FrontendBuild", Compile3.Header.VersionFrontendBuild); IO.mapRequired("FrontendBuild", Compile3.VersionFrontendBuild);
IO.mapRequired("FrontendQFE", Compile3.Header.VersionFrontendQFE); IO.mapRequired("FrontendQFE", Compile3.VersionFrontendQFE);
IO.mapRequired("BackendMajor", Compile3.Header.VersionBackendMajor); IO.mapRequired("BackendMajor", Compile3.VersionBackendMajor);
IO.mapRequired("BackendMinor", Compile3.Header.VersionBackendMinor); IO.mapRequired("BackendMinor", Compile3.VersionBackendMinor);
IO.mapRequired("BackendBuild", Compile3.Header.VersionBackendBuild); IO.mapRequired("BackendBuild", Compile3.VersionBackendBuild);
IO.mapRequired("BackendQFE", Compile3.Header.VersionBackendQFE); IO.mapRequired("BackendQFE", Compile3.VersionBackendQFE);
IO.mapRequired("Version", Compile3.Version); IO.mapRequired("Version", Compile3.Version);
} }
void MappingTraits<FrameProcSym>::mapping(IO &IO, FrameProcSym &FrameProc) { void MappingTraits<FrameProcSym>::mapping(IO &IO, FrameProcSym &FrameProc) {
IO.mapRequired("TotalFrameBytes", FrameProc.Header.TotalFrameBytes); IO.mapRequired("TotalFrameBytes", FrameProc.TotalFrameBytes);
IO.mapRequired("PaddingFrameBytes", FrameProc.Header.PaddingFrameBytes); IO.mapRequired("PaddingFrameBytes", FrameProc.PaddingFrameBytes);
IO.mapRequired("OffsetToPadding", FrameProc.Header.OffsetToPadding); IO.mapRequired("OffsetToPadding", FrameProc.OffsetToPadding);
IO.mapRequired("BytesOfCalleeSavedRegisters", IO.mapRequired("BytesOfCalleeSavedRegisters",
FrameProc.Header.BytesOfCalleeSavedRegisters); FrameProc.BytesOfCalleeSavedRegisters);
IO.mapRequired("OffsetOfExceptionHandler", IO.mapRequired("OffsetOfExceptionHandler",
FrameProc.Header.OffsetOfExceptionHandler); FrameProc.OffsetOfExceptionHandler);
IO.mapRequired("SectionIdOfExceptionHandler", IO.mapRequired("SectionIdOfExceptionHandler",
FrameProc.Header.SectionIdOfExceptionHandler); FrameProc.SectionIdOfExceptionHandler);
IO.mapRequired("Flags", FrameProc.Header.Flags); IO.mapRequired("Flags", FrameProc.Flags);
} }
void MappingTraits<CallSiteInfoSym>::mapping(IO &IO, void MappingTraits<CallSiteInfoSym>::mapping(IO &IO,
CallSiteInfoSym &CallSiteInfo) { CallSiteInfoSym &CallSiteInfo) {
// TODO: Map Linkage Name // TODO: Map Linkage Name
IO.mapRequired("Segment", CallSiteInfo.Header.Segment); IO.mapRequired("Segment", CallSiteInfo.Segment);
IO.mapRequired("Reserved", CallSiteInfo.Header.Reserved); IO.mapRequired("Type", CallSiteInfo.Type);
IO.mapRequired("Type", CallSiteInfo.Header.Type);
} }
void MappingTraits<FileStaticSym>::mapping(IO &IO, FileStaticSym &FileStatic) { void MappingTraits<FileStaticSym>::mapping(IO &IO, FileStaticSym &FileStatic) {
IO.mapRequired("Index", FileStatic.Header.Index); IO.mapRequired("Index", FileStatic.Index);
IO.mapRequired("ModFilenameOffset", FileStatic.Header.ModFilenameOffset); IO.mapRequired("ModFilenameOffset", FileStatic.ModFilenameOffset);
IO.mapRequired("Flags", FileStatic.Header.Flags); IO.mapRequired("Flags", FileStatic.Flags);
IO.mapRequired("Name", FileStatic.Name); IO.mapRequired("Name", FileStatic.Name);
} }
void MappingTraits<HeapAllocationSiteSym>::mapping( void MappingTraits<HeapAllocationSiteSym>::mapping(
IO &IO, HeapAllocationSiteSym &HeapAllocSite) { IO &IO, HeapAllocationSiteSym &HeapAllocSite) {
// TODO: Map Linkage Name // TODO: Map Linkage Name
IO.mapRequired("Segment", HeapAllocSite.Header.Segment); IO.mapRequired("Segment", HeapAllocSite.Segment);
IO.mapRequired("CallInstructionSize", IO.mapRequired("CallInstructionSize", HeapAllocSite.CallInstructionSize);
HeapAllocSite.Header.CallInstructionSize); IO.mapRequired("Type", HeapAllocSite.Type);
IO.mapRequired("Type", HeapAllocSite.Header.Type);
} }
void MappingTraits<FrameCookieSym>::mapping(IO &IO, void MappingTraits<FrameCookieSym>::mapping(IO &IO,
FrameCookieSym &FrameCookie) { FrameCookieSym &FrameCookie) {
// TODO: Map Linkage Name // TODO: Map Linkage Name
IO.mapRequired("Register", FrameCookie.Header.Register); IO.mapRequired("Register", FrameCookie.Register);
IO.mapRequired("CookieKind", FrameCookie.Header.CookieKind); IO.mapRequired("CookieKind", FrameCookie.CookieKind);
IO.mapRequired("Flags", FrameCookie.Header.Flags); IO.mapRequired("Flags", FrameCookie.Flags);
} }
void MappingTraits<CallerSym>::mapping(IO &IO, CallerSym &Caller) { void MappingTraits<CallerSym>::mapping(IO &IO, CallerSym &Caller) {
@ -274,43 +364,43 @@ void MappingTraits<CallerSym>::mapping(IO &IO, CallerSym &Caller) {
} }
void MappingTraits<UDTSym>::mapping(IO &IO, UDTSym &UDT) { void MappingTraits<UDTSym>::mapping(IO &IO, UDTSym &UDT) {
IO.mapRequired("Type", UDT.Header.Type); IO.mapRequired("Type", UDT.Type);
IO.mapRequired("UDTName", UDT.Name); IO.mapRequired("UDTName", UDT.Name);
} }
void MappingTraits<BuildInfoSym>::mapping(IO &IO, BuildInfoSym &BuildInfo) { void MappingTraits<BuildInfoSym>::mapping(IO &IO, BuildInfoSym &BuildInfo) {
IO.mapRequired("BuildId", BuildInfo.Header.BuildId); IO.mapRequired("BuildId", BuildInfo.BuildId);
} }
void MappingTraits<BPRelativeSym>::mapping(IO &IO, BPRelativeSym &BPRel) { void MappingTraits<BPRelativeSym>::mapping(IO &IO, BPRelativeSym &BPRel) {
IO.mapRequired("Offset", BPRel.Header.Offset); IO.mapRequired("Offset", BPRel.Offset);
IO.mapRequired("Type", BPRel.Header.Type); IO.mapRequired("Type", BPRel.Type);
IO.mapRequired("VarName", BPRel.Name); IO.mapRequired("VarName", BPRel.Name);
} }
void MappingTraits<RegRelativeSym>::mapping(IO &IO, RegRelativeSym &RegRel) { void MappingTraits<RegRelativeSym>::mapping(IO &IO, RegRelativeSym &RegRel) {
IO.mapRequired("Offset", RegRel.Header.Offset); IO.mapRequired("Offset", RegRel.Offset);
IO.mapRequired("Type", RegRel.Header.Type); IO.mapRequired("Type", RegRel.Type);
IO.mapRequired("Register", RegRel.Header.Register); IO.mapRequired("Register", RegRel.Register);
IO.mapRequired("VarName", RegRel.Name); IO.mapRequired("VarName", RegRel.Name);
} }
void MappingTraits<ConstantSym>::mapping(IO &IO, ConstantSym &Constant) { void MappingTraits<ConstantSym>::mapping(IO &IO, ConstantSym &Constant) {
IO.mapRequired("Type", Constant.Header.Type); IO.mapRequired("Type", Constant.Type);
IO.mapRequired("Value", Constant.Value); IO.mapRequired("Value", Constant.Value);
IO.mapRequired("Name", Constant.Name); IO.mapRequired("Name", Constant.Name);
} }
void MappingTraits<DataSym>::mapping(IO &IO, DataSym &Data) { void MappingTraits<DataSym>::mapping(IO &IO, DataSym &Data) {
// TODO: Map linkage name // TODO: Map linkage name
IO.mapRequired("Type", Data.Header.Type); IO.mapRequired("Type", Data.Type);
IO.mapRequired("DisplayName", Data.Name); IO.mapRequired("DisplayName", Data.Name);
} }
void MappingTraits<ThreadLocalDataSym>::mapping(IO &IO, void MappingTraits<ThreadLocalDataSym>::mapping(IO &IO,
ThreadLocalDataSym &Data) { ThreadLocalDataSym &Data) {
// TODO: Map linkage name // TODO: Map linkage name
IO.mapRequired("Type", Data.Header.Type); IO.mapRequired("Type", Data.Type);
IO.mapRequired("DisplayName", Data.Name); IO.mapRequired("DisplayName", Data.Name);
} }
} }