diff options
| author | Zachary Turner <zturner@google.com> | 2016-05-25 00:12:48 +0000 |
|---|---|---|
| committer | Zachary Turner <zturner@google.com> | 2016-05-25 00:12:48 +0000 |
| commit | 172d59c105ea99da09bbbef25698e94b8358bf20 (patch) | |
| tree | 34c6a512f85a909559eac6d363485fca93a6549a | |
| parent | 9f054d424fc5ccb73d0c668a3942281a957242c0 (diff) | |
| download | bcm5719-llvm-172d59c105ea99da09bbbef25698e94b8358bf20.tar.gz bcm5719-llvm-172d59c105ea99da09bbbef25698e94b8358bf20.zip | |
[codeview] Add support for new types and symbols.
This patch adds support for:
S_EXPORT
LF_BITFIELD
With this patch, I have run through a couple of gigabytes of PDB
files and cannot find a type or symbol that we do not understand.
llvm-svn: 270637
| -rw-r--r-- | llvm/include/llvm/DebugInfo/CodeView/CVTypeVisitor.h | 4 | ||||
| -rw-r--r-- | llvm/include/llvm/DebugInfo/CodeView/CodeView.h | 1 | ||||
| -rw-r--r-- | llvm/include/llvm/DebugInfo/CodeView/TypeRecord.h | 19 | ||||
| -rw-r--r-- | llvm/include/llvm/DebugInfo/CodeView/TypeRecords.def | 3 | ||||
| -rw-r--r-- | llvm/lib/DebugInfo/CodeView/TypeDumper.cpp | 15 | ||||
| -rw-r--r-- | llvm/lib/DebugInfo/CodeView/TypeRecord.cpp | 4 |
6 files changed, 42 insertions, 4 deletions
diff --git a/llvm/include/llvm/DebugInfo/CodeView/CVTypeVisitor.h b/llvm/include/llvm/DebugInfo/CodeView/CVTypeVisitor.h index 7641ae6091b..5058050de56 100644 --- a/llvm/include/llvm/DebugInfo/CodeView/CVTypeVisitor.h +++ b/llvm/include/llvm/DebugInfo/CodeView/CVTypeVisitor.h @@ -58,7 +58,7 @@ public: DerivedThis->visitTypeBegin(Record.Type, RecordData); switch (Record.Type) { default: - DerivedThis->visitUnknownType(Record.Type); + DerivedThis->visitUnknownType(Record.Type, RecordData); break; case LF_FIELDLIST: DerivedThis->visitFieldList(Record.Type, LeafData); @@ -90,7 +90,7 @@ public: } /// Action to take on unknown types. By default, they are ignored. - void visitUnknownType(TypeLeafKind Leaf) {} + void visitUnknownType(TypeLeafKind Leaf, ArrayRef<uint8_t> RecordData) {} /// Paired begin/end actions for all types. Receives all record data, /// including the fixed-length record prefix. diff --git a/llvm/include/llvm/DebugInfo/CodeView/CodeView.h b/llvm/include/llvm/DebugInfo/CodeView/CodeView.h index 19b3212b1f4..67c974a6f56 100644 --- a/llvm/include/llvm/DebugInfo/CodeView/CodeView.h +++ b/llvm/include/llvm/DebugInfo/CodeView/CodeView.h @@ -23,7 +23,6 @@ enum class TypeRecordKind : uint16_t { #include "TypeRecords.def" // FIXME: Add serialization support FieldList = 0x1203, - BitField = 0x1205, }; /// Duplicate copy of the above enum, but using the official CV names. Useful diff --git a/llvm/include/llvm/DebugInfo/CodeView/TypeRecord.h b/llvm/include/llvm/DebugInfo/CodeView/TypeRecord.h index 8021303e1eb..97b4737734b 100644 --- a/llvm/include/llvm/DebugInfo/CodeView/TypeRecord.h +++ b/llvm/include/llvm/DebugInfo/CodeView/TypeRecord.h @@ -705,17 +705,36 @@ private: TypeIndex UnderlyingType; }; +// LF_BITFIELD class BitFieldRecord : public TypeRecord { public: BitFieldRecord(TypeIndex Type, uint8_t BitSize, uint8_t BitOffset) : TypeRecord(TypeRecordKind::BitField), Type(Type), BitSize(BitSize), BitOffset(BitOffset) {} + /// Rewrite member type indices with IndexMap. Returns false if a type index + /// is not in the map. + bool remapTypeIndices(ArrayRef<TypeIndex> IndexMap); + + static ErrorOr<BitFieldRecord> deserialize(TypeRecordKind Kind, + ArrayRef<uint8_t> &Data) { + const Layout *L = nullptr; + CV_DESERIALIZE(Data, L); + + return BitFieldRecord(L->Type, L->BitSize, L->BitOffset); + } + TypeIndex getType() const { return Type; } uint8_t getBitOffset() const { return BitOffset; } uint8_t getBitSize() const { return BitSize; } private: + struct Layout { + TypeIndex Type; + uint8_t BitSize; + uint8_t BitOffset; + }; + TypeIndex Type; uint8_t BitSize; uint8_t BitOffset; diff --git a/llvm/include/llvm/DebugInfo/CodeView/TypeRecords.def b/llvm/include/llvm/DebugInfo/CodeView/TypeRecords.def index 74da3231e6e..e2824f1757e 100644 --- a/llvm/include/llvm/DebugInfo/CodeView/TypeRecords.def +++ b/llvm/include/llvm/DebugInfo/CodeView/TypeRecords.def @@ -53,6 +53,8 @@ TYPE_RECORD(LF_TYPESERVER2, 0x1515, TypeServer2) TYPE_RECORD(LF_VFTABLE, 0x151d, VFTable) TYPE_RECORD(LF_VTSHAPE, 0x000a, VFTableShape) +TYPE_RECORD(LF_BITFIELD, 0x1205, BitField) + // Member type records. These are generally not length prefixed, and appear // inside of a field list record. MEMBER_RECORD(LF_BCLASS, 0x1400, BaseClass) @@ -156,7 +158,6 @@ CV_TYPE(LF_SKIP, 0x1200) CV_TYPE(LF_DEFARG_ST, 0x1202) CV_TYPE(LF_FIELDLIST, 0x1203) CV_TYPE(LF_DERIVED, 0x1204) -CV_TYPE(LF_BITFIELD, 0x1205) CV_TYPE(LF_DIMCONU, 0x1207) CV_TYPE(LF_DIMCONLU, 0x1208) CV_TYPE(LF_DIMVARU, 0x1209) diff --git a/llvm/lib/DebugInfo/CodeView/TypeDumper.cpp b/llvm/lib/DebugInfo/CodeView/TypeDumper.cpp index 72e0e44ce26..74cb2d9e9c4 100644 --- a/llvm/lib/DebugInfo/CodeView/TypeDumper.cpp +++ b/llvm/lib/DebugInfo/CodeView/TypeDumper.cpp @@ -209,6 +209,7 @@ public: #include "llvm/DebugInfo/CodeView/TypeRecords.def" void visitUnknownMember(TypeLeafKind Leaf); + void visitUnknownType(TypeLeafKind Leaf, ArrayRef<uint8_t> LeafData); void visitTypeBegin(TypeLeafKind Leaf, ArrayRef<uint8_t> LeafData); void visitTypeEnd(TypeLeafKind Leaf, ArrayRef<uint8_t> LeafData); @@ -493,6 +494,13 @@ void CVTypeDumperImpl::visitModifier(TypeLeafKind Leaf, ModifierRecord &Mod) { Name = CVTD.saveName(TypeName); } +void CVTypeDumperImpl::visitBitField(TypeLeafKind Leaf, + BitFieldRecord &BitField) { + printTypeIndex("Type", BitField.getType()); + W.printNumber("BitSize", BitField.getBitSize()); + W.printNumber("BitOffset", BitField.getBitOffset()); +} + void CVTypeDumperImpl::visitVFTableShape(TypeLeafKind Leaf, VFTableShapeRecord &Shape) { W.printNumber("VFEntryCount", Shape.getEntryCount()); @@ -538,6 +546,13 @@ void CVTypeDumperImpl::visitUnknownMember(TypeLeafKind Leaf) { W.printHex("UnknownMember", unsigned(Leaf)); } +void CVTypeDumperImpl::visitUnknownType(TypeLeafKind Leaf, + ArrayRef<uint8_t> RecordData) { + DictScope S(W, "UnknownType"); + W.printEnum("Kind", uint16_t(Leaf), makeArrayRef(LeafTypeNames)); + W.printNumber("Length", uint32_t(RecordData.size())); +} + void CVTypeDumperImpl::visitNestedType(TypeLeafKind Leaf, NestedTypeRecord &Nested) { DictScope S(W, "NestedType"); diff --git a/llvm/lib/DebugInfo/CodeView/TypeRecord.cpp b/llvm/lib/DebugInfo/CodeView/TypeRecord.cpp index 57cd5b7e264..e9782978535 100644 --- a/llvm/lib/DebugInfo/CodeView/TypeRecord.cpp +++ b/llvm/lib/DebugInfo/CodeView/TypeRecord.cpp @@ -105,6 +105,10 @@ bool EnumRecord::remapTypeIndices(ArrayRef<TypeIndex> IndexMap) { return Success; } +bool BitFieldRecord::remapTypeIndices(ArrayRef<TypeIndex> IndexMap) { + return remapIndex(IndexMap, Type); +} + bool VFTableShapeRecord::remapTypeIndices(ArrayRef<TypeIndex> IndexMap) { return true; } |

