Revert "[CodeView] Hook CodeViewRecordIO for reading/writing symbols."

This reverts commit r289978, which is failing due to some rebase/merge
issues.

llvm-svn: 289981
This commit is contained in:
Zachary Turner 2016-12-16 19:25:23 +00:00
parent 242b46aa59
commit d0fffd1d14
16 changed files with 1201 additions and 1352 deletions

View File

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

View File

@ -46,17 +46,6 @@ public:
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) {
if (isWriting())
return Writer->writeInteger(Value);
@ -86,8 +75,6 @@ public:
Error mapStringZ(StringRef &Value);
Error mapGuid(StringRef &Guid);
Error mapStringZVectorZ(std::vector<StringRef> &Value);
template <typename SizeType, typename T, typename ElementMapper>
Error mapVectorN(T &Items, const ElementMapper &Mapper) {
SizeType Size;
@ -134,7 +121,6 @@ public:
}
Error mapByteVectorTail(ArrayRef<uint8_t> &Bytes);
Error mapByteVectorTail(std::vector<uint8_t> &Bytes);
Error skipPadding();

View File

@ -12,7 +12,6 @@
#include "llvm/ADT/ArrayRef.h"
#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
#include "llvm/DebugInfo/CodeView/SymbolRecordMapping.h"
#include "llvm/DebugInfo/CodeView/SymbolVisitorCallbacks.h"
#include "llvm/DebugInfo/CodeView/SymbolVisitorDelegate.h"
#include "llvm/DebugInfo/MSF/ByteStream.h"
@ -23,50 +22,41 @@ namespace llvm {
namespace codeview {
class SymbolVisitorDelegate;
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:
explicit SymbolDeserializer(SymbolVisitorDelegate *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) \
Error visitKnownRecord(CVSymbol &CVR, Name &Record) override { \
return visitKnownRecordImpl(CVR, Record); \
return defaultVisitKnownRecord(CVR, Record); \
}
#define SYMBOL_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
#include "CVSymbolTypes.def"
private:
template <typename T> Error visitKnownRecordImpl(CVSymbol &CVR, T &Record) {
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();
}
Record.RecordOffset =
Delegate ? Delegate->getRecordOffset(Mapping->Reader) : 0;
if (auto EC = Mapping->Mapping.visitKnownRecord(CVR, Record))
private:
template <typename T>
Error defaultVisitKnownRecord(CVSymbol &CVR, T &Record) {
msf::ByteStream S(CVR.content());
msf::StreamReader SR(S);
if (auto EC = deserializeRecord(SR, CVR.Type, Record))
return EC;
return Error::success();
}
SymbolVisitorDelegate *Delegate;
std::unique_ptr<MappingInfo> Mapping;
};
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,44 +0,0 @@
//===- 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

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

View File

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

View File

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

View File

@ -1,464 +0,0 @@
//===- 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

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

View File

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

View File

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

View File

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

View File

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