summaryrefslogtreecommitdiff
path: root/include/llvm/DebugInfo
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-06-26 20:32:52 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-06-26 20:32:52 +0000
commit08bbd35a80bf7765fe0d3043f9eb5a2f2786b649 (patch)
tree80108f0f128657f8623f8f66ad9735b4d88e7b47 /include/llvm/DebugInfo
parent7c7aba6e5fef47a01a136be655b0a92cfd7090f6 (diff)
Notes
Diffstat (limited to 'include/llvm/DebugInfo')
-rw-r--r--include/llvm/DebugInfo/CodeView/CVRecord.h5
-rw-r--r--include/llvm/DebugInfo/CodeView/CodeView.h10
-rw-r--r--include/llvm/DebugInfo/CodeView/DebugSubsectionRecord.h12
-rw-r--r--include/llvm/DebugInfo/CodeView/EnumTables.h1
-rw-r--r--include/llvm/DebugInfo/CodeView/LazyRandomTypeCollection.h41
-rw-r--r--include/llvm/DebugInfo/CodeView/SymbolRecord.h2
-rw-r--r--include/llvm/DebugInfo/CodeView/TypeDatabase.h84
-rw-r--r--include/llvm/DebugInfo/CodeView/TypeDatabaseVisitor.h62
-rw-r--r--include/llvm/DebugInfo/CodeView/TypeIndexDiscovery.h6
-rw-r--r--include/llvm/DebugInfo/CodeView/TypeName.h22
-rw-r--r--include/llvm/DebugInfo/CodeView/TypeRecordMapping.h1
-rw-r--r--include/llvm/DebugInfo/CodeView/TypeSerializer.h1
-rw-r--r--include/llvm/DebugInfo/CodeView/TypeTableCollection.h11
-rw-r--r--include/llvm/DebugInfo/DIContext.h5
-rw-r--r--include/llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h7
-rw-r--r--include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h5
-rw-r--r--include/llvm/DebugInfo/DWARF/DWARFContext.h22
-rw-r--r--include/llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h10
-rw-r--r--include/llvm/DebugInfo/DWARF/DWARFDebugArangeSet.h4
-rw-r--r--include/llvm/DebugInfo/DWARF/DWARFDebugAranges.h4
-rw-r--r--include/llvm/DebugInfo/DWARF/DWARFDebugLine.h40
-rw-r--r--include/llvm/DebugInfo/DWARF/DWARFDebugLoc.h4
-rw-r--r--include/llvm/DebugInfo/DWARF/DWARFDebugMacro.h2
-rw-r--r--include/llvm/DebugInfo/DWARF/DWARFDebugRangeList.h4
-rw-r--r--include/llvm/DebugInfo/DWARF/DWARFFormValue.h113
-rw-r--r--include/llvm/DebugInfo/DWARF/DWARFRelocMap.h3
-rw-r--r--include/llvm/DebugInfo/DWARF/DWARFUnit.h48
-rw-r--r--include/llvm/DebugInfo/MSF/MSFBuilder.h13
-rw-r--r--include/llvm/DebugInfo/MSF/MSFCommon.h18
-rw-r--r--include/llvm/DebugInfo/MSF/MappedBlockStream.h20
-rw-r--r--include/llvm/DebugInfo/PDB/DIA/DIASession.h2
-rw-r--r--include/llvm/DebugInfo/PDB/IPDBSession.h2
-rw-r--r--include/llvm/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.h4
-rw-r--r--include/llvm/DebugInfo/PDB/Native/DbiStream.h17
-rw-r--r--include/llvm/DebugInfo/PDB/Native/DbiStreamBuilder.h1
-rw-r--r--include/llvm/DebugInfo/PDB/Native/InfoStream.h4
-rw-r--r--include/llvm/DebugInfo/PDB/Native/ModuleDebugStream.h19
-rw-r--r--include/llvm/DebugInfo/PDB/Native/NativeCompilandSymbol.h6
-rw-r--r--include/llvm/DebugInfo/PDB/Native/NativeExeSymbol.h4
-rw-r--r--include/llvm/DebugInfo/PDB/Native/NativeRawSymbol.h5
-rw-r--r--include/llvm/DebugInfo/PDB/Native/NativeSession.h2
-rw-r--r--include/llvm/DebugInfo/PDB/Native/PDBFile.h3
-rw-r--r--include/llvm/DebugInfo/PDB/Native/TpiStream.h5
-rw-r--r--include/llvm/DebugInfo/Symbolize/SymbolizableModule.h16
-rw-r--r--include/llvm/DebugInfo/Symbolize/Symbolize.h21
45 files changed, 326 insertions, 365 deletions
diff --git a/include/llvm/DebugInfo/CodeView/CVRecord.h b/include/llvm/DebugInfo/CodeView/CVRecord.h
index 4c6bbedc6bbdd..44040e04388af 100644
--- a/include/llvm/DebugInfo/CodeView/CVRecord.h
+++ b/include/llvm/DebugInfo/CodeView/CVRecord.h
@@ -27,9 +27,12 @@ namespace codeview {
template <typename Kind> class CVRecord {
public:
- CVRecord() = default;
+ CVRecord() : Type(static_cast<Kind>(0)) {}
+
CVRecord(Kind K, ArrayRef<uint8_t> Data) : Type(K), RecordData(Data) {}
+ bool valid() const { return Type != static_cast<Kind>(0); }
+
uint32_t length() const { return RecordData.size(); }
Kind kind() const { return Type; }
ArrayRef<uint8_t> data() const { return RecordData; }
diff --git a/include/llvm/DebugInfo/CodeView/CodeView.h b/include/llvm/DebugInfo/CodeView/CodeView.h
index 6820e26b754c0..b7a7e33abadf8 100644
--- a/include/llvm/DebugInfo/CodeView/CodeView.h
+++ b/include/llvm/DebugInfo/CodeView/CodeView.h
@@ -402,6 +402,16 @@ enum class LocalSymFlags : uint16_t {
};
CV_DEFINE_ENUM_CLASS_FLAGS_OPERATORS(LocalSymFlags)
+/// Corresponds to the CV_PUBSYMFLAGS bitfield.
+enum class PublicSymFlags : uint32_t {
+ None = 0,
+ Code = 1 << 0,
+ Function = 1 << 1,
+ Managed = 1 << 2,
+ MSIL = 1 << 3,
+};
+CV_DEFINE_ENUM_CLASS_FLAGS_OPERATORS(PublicSymFlags)
+
/// Corresponds to the CV_PROCFLAGS bitfield.
enum class ProcSymFlags : uint8_t {
None = 0,
diff --git a/include/llvm/DebugInfo/CodeView/DebugSubsectionRecord.h b/include/llvm/DebugInfo/CodeView/DebugSubsectionRecord.h
index 6947317420643..ee17b47d8e631 100644
--- a/include/llvm/DebugInfo/CodeView/DebugSubsectionRecord.h
+++ b/include/llvm/DebugInfo/CodeView/DebugSubsectionRecord.h
@@ -51,11 +51,23 @@ class DebugSubsectionRecordBuilder {
public:
DebugSubsectionRecordBuilder(std::shared_ptr<DebugSubsection> Subsection,
CodeViewContainer Container);
+
+ /// Use this to copy existing subsections directly from source to destination.
+ /// For example, line table subsections in an object file only need to be
+ /// relocated before being copied into the PDB.
+ DebugSubsectionRecordBuilder(const DebugSubsectionRecord &Contents,
+ CodeViewContainer Container);
+
uint32_t calculateSerializedLength();
Error commit(BinaryStreamWriter &Writer) const;
private:
+ /// The subsection to build. Will be null if Contents is non-empty.
std::shared_ptr<DebugSubsection> Subsection;
+
+ /// The bytes of the subsection. Only non-empty if Subsection is null.
+ DebugSubsectionRecord Contents;
+
CodeViewContainer Container;
};
diff --git a/include/llvm/DebugInfo/CodeView/EnumTables.h b/include/llvm/DebugInfo/CodeView/EnumTables.h
index 013e440613fc1..5d54bb4cca841 100644
--- a/include/llvm/DebugInfo/CodeView/EnumTables.h
+++ b/include/llvm/DebugInfo/CodeView/EnumTables.h
@@ -22,6 +22,7 @@ namespace codeview {
ArrayRef<EnumEntry<SymbolKind>> getSymbolTypeNames();
ArrayRef<EnumEntry<TypeLeafKind>> getTypeLeafNames();
ArrayRef<EnumEntry<uint16_t>> getRegisterNames();
+ArrayRef<EnumEntry<uint32_t>> getPublicSymFlagNames();
ArrayRef<EnumEntry<uint8_t>> getProcSymFlagNames();
ArrayRef<EnumEntry<uint16_t>> getLocalFlagNames();
ArrayRef<EnumEntry<uint8_t>> getFrameCookieKindNames();
diff --git a/include/llvm/DebugInfo/CodeView/LazyRandomTypeCollection.h b/include/llvm/DebugInfo/CodeView/LazyRandomTypeCollection.h
index 0d056e42b45f5..8b1540abf903e 100644
--- a/include/llvm/DebugInfo/CodeView/LazyRandomTypeCollection.h
+++ b/include/llvm/DebugInfo/CodeView/LazyRandomTypeCollection.h
@@ -11,18 +11,15 @@
#define LLVM_DEBUGINFO_CODEVIEW_LAZYRANDOMTYPECOLLECTION_H
#include "llvm/DebugInfo/CodeView/TypeCollection.h"
-#include "llvm/DebugInfo/CodeView/TypeDatabase.h"
-#include "llvm/DebugInfo/CodeView/TypeDatabaseVisitor.h"
#include "llvm/DebugInfo/CodeView/TypeIndex.h"
#include "llvm/DebugInfo/CodeView/TypeRecord.h"
+#include "llvm/Support/Allocator.h"
#include "llvm/Support/Error.h"
+#include "llvm/Support/StringSaver.h"
namespace llvm {
namespace codeview {
-class TypeDatabase;
-class TypeVisitorCallbacks;
-
/// \brief Provides amortized O(1) random access to a CodeView type stream.
/// Normally to access a type from a type stream, you must know its byte
/// offset into the type stream, because type records are variable-lengthed.
@@ -47,6 +44,11 @@ class TypeVisitorCallbacks;
/// of O(N/M) and an amortized time of O(1).
class LazyRandomTypeCollection : public TypeCollection {
typedef FixedStreamArray<TypeIndexOffset> PartialOffsetArray;
+ struct CacheEntry {
+ CVType Type;
+ uint32_t Offset;
+ StringRef Name;
+ };
public:
explicit LazyRandomTypeCollection(uint32_t RecordCountHint);
@@ -56,8 +58,10 @@ public:
PartialOffsetArray PartialOffsets);
LazyRandomTypeCollection(const CVTypeArray &Types, uint32_t RecordCountHint);
- void reset(ArrayRef<uint8_t> Data);
- void reset(StringRef Data);
+ void reset(ArrayRef<uint8_t> Data, uint32_t RecordCountHint);
+ void reset(StringRef Data, uint32_t RecordCountHint);
+
+ uint32_t getOffsetOfType(TypeIndex Index);
CVType getType(TypeIndex Index) override;
StringRef getTypeName(TypeIndex Index) override;
@@ -68,27 +72,26 @@ public:
Optional<TypeIndex> getNext(TypeIndex Prev) override;
private:
- const TypeDatabase &database() const { return Database; }
Error ensureTypeExists(TypeIndex Index);
+ void ensureCapacityFor(TypeIndex Index);
Error visitRangeForType(TypeIndex TI);
Error fullScanForType(TypeIndex TI);
- Error visitRange(TypeIndex Begin, uint32_t BeginOffset, TypeIndex End);
- Error visitOneRecord(TypeIndex TI, uint32_t Offset, CVType &Record);
+ void visitRange(TypeIndex Begin, uint32_t BeginOffset, TypeIndex End);
+
+ /// Number of actual records.
+ uint32_t Count = 0;
- /// Visited records get automatically added to the type database.
- TypeDatabase Database;
+ /// The largest type index which we've visited.
+ TypeIndex LargestTypeIndex = TypeIndex::None();
+
+ BumpPtrAllocator Allocator;
+ StringSaver NameStorage;
/// The type array to allow random access visitation of.
CVTypeArray Types;
- /// The database visitor which adds new records to the database.
- TypeDatabaseVisitor DatabaseVisitor;
-
- /// A vector mapping type indices to type offset. For every record that has
- /// been visited, contains the absolute offset of that record in the record
- /// array.
- std::vector<uint32_t> KnownOffsets;
+ std::vector<CacheEntry> Records;
/// An array of index offsets for the given type stream, allowing log(N)
/// lookups of a type record by index. Similar to KnownOffsets but only
diff --git a/include/llvm/DebugInfo/CodeView/SymbolRecord.h b/include/llvm/DebugInfo/CodeView/SymbolRecord.h
index 5f85ed28cb3a1..1cf77fcdecbe0 100644
--- a/include/llvm/DebugInfo/CodeView/SymbolRecord.h
+++ b/include/llvm/DebugInfo/CodeView/SymbolRecord.h
@@ -363,7 +363,7 @@ public:
: SymbolRecord(SymbolRecordKind::PublicSym32),
RecordOffset(RecordOffset) {}
- TypeIndex Index;
+ PublicSymFlags Flags;
uint32_t Offset;
uint16_t Segment;
StringRef Name;
diff --git a/include/llvm/DebugInfo/CodeView/TypeDatabase.h b/include/llvm/DebugInfo/CodeView/TypeDatabase.h
deleted file mode 100644
index a743e7f70855f..0000000000000
--- a/include/llvm/DebugInfo/CodeView/TypeDatabase.h
+++ /dev/null
@@ -1,84 +0,0 @@
-//===- TypeDatabase.h - A collection of CodeView type records ---*- 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_TYPEDATABASE_H
-#define LLVM_DEBUGINFO_CODEVIEW_TYPEDATABASE_H
-
-#include "llvm/ADT/BitVector.h"
-#include "llvm/ADT/SmallVector.h"
-#include "llvm/ADT/StringRef.h"
-#include "llvm/DebugInfo/CodeView/TypeCollection.h"
-#include "llvm/DebugInfo/CodeView/TypeIndex.h"
-#include "llvm/DebugInfo/CodeView/TypeRecord.h"
-#include "llvm/Support/Allocator.h"
-#include "llvm/Support/StringSaver.h"
-
-namespace llvm {
-namespace codeview {
-class TypeDatabase : public TypeCollection {
- friend class RandomAccessTypeVisitor;
-
-public:
- explicit TypeDatabase(uint32_t Capacity);
-
- /// Records the name of a type, and reserves its type index.
- TypeIndex appendType(StringRef Name, const CVType &Data);
-
- /// Records the name of a type, and reserves its type index.
- void recordType(StringRef Name, TypeIndex Index, const CVType &Data);
-
- /// Saves the name in a StringSet and creates a stable StringRef.
- StringRef saveTypeName(StringRef TypeName);
-
- StringRef getTypeName(TypeIndex Index) const;
-
- const CVType &getTypeRecord(TypeIndex Index) const;
- CVType &getTypeRecord(TypeIndex Index);
-
- bool contains(TypeIndex Index) const;
- uint32_t size() const;
- uint32_t capacity() const;
- bool empty() const;
-
- CVType getType(TypeIndex Index) override;
- StringRef getTypeName(TypeIndex Index) override;
- bool contains(TypeIndex Index) override;
- uint32_t size() override;
- uint32_t capacity() override;
-
- Optional<TypeIndex> getFirst() override;
- Optional<TypeIndex> getNext(TypeIndex Prev) override;
-
- Optional<TypeIndex> largestTypeIndexLessThan(TypeIndex TI) const;
-
-private:
- TypeIndex getAppendIndex() const;
-
- void grow();
- void grow(TypeIndex Index);
-
- BumpPtrAllocator Allocator;
-
- uint32_t Count = 0;
- TypeIndex LargestTypeIndex;
-
- /// All user defined type records in .debug$T live in here. Type indices
- /// greater than 0x1000 are user defined. Subtract 0x1000 from the index to
- /// index into this vector.
- SmallVector<StringRef, 10> CVUDTNames;
- SmallVector<CVType, 10> TypeRecords;
-
- StringSaver TypeNameStorage;
-
- BitVector ValidRecords;
-};
-}
-}
-
-#endif \ No newline at end of file
diff --git a/include/llvm/DebugInfo/CodeView/TypeDatabaseVisitor.h b/include/llvm/DebugInfo/CodeView/TypeDatabaseVisitor.h
deleted file mode 100644
index 77dbc91a7d38c..0000000000000
--- a/include/llvm/DebugInfo/CodeView/TypeDatabaseVisitor.h
+++ /dev/null
@@ -1,62 +0,0 @@
-//===-- TypeDatabaseVisitor.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_TYPEDATABASEVISITOR_H
-#define LLVM_DEBUGINFO_CODEVIEW_TYPEDATABASEVISITOR_H
-
-#include "llvm/ADT/PointerUnion.h"
-
-#include "llvm/DebugInfo/CodeView/TypeDatabase.h"
-#include "llvm/DebugInfo/CodeView/TypeIndex.h"
-#include "llvm/DebugInfo/CodeView/TypeRecord.h"
-#include "llvm/DebugInfo/CodeView/TypeVisitorCallbacks.h"
-
-namespace llvm {
-namespace codeview {
-
-/// Dumper for CodeView type streams found in COFF object files and PDB files.
-class TypeDatabaseVisitor : public TypeVisitorCallbacks {
-public:
- explicit TypeDatabaseVisitor(TypeDatabase &TypeDB) : TypeDB(&TypeDB) {}
-
- /// Paired begin/end actions for all types. Receives all record data,
- /// including the fixed-length record prefix.
- Error visitTypeBegin(CVType &Record) override;
- Error visitTypeBegin(CVType &Record, TypeIndex Index) override;
- Error visitTypeEnd(CVType &Record) override;
- Error visitMemberBegin(CVMemberRecord &Record) override;
- Error visitMemberEnd(CVMemberRecord &Record) override;
-
-#define TYPE_RECORD(EnumName, EnumVal, Name) \
- Error visitKnownRecord(CVType &CVR, Name##Record &Record) override;
-#define MEMBER_RECORD(EnumName, EnumVal, Name) \
- Error visitKnownMember(CVMemberRecord &CVR, Name##Record &Record) override;
-#define TYPE_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
-#define MEMBER_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
-#include "llvm/DebugInfo/CodeView/CodeViewTypes.def"
-
-private:
- StringRef getTypeName(TypeIndex Index) const;
- StringRef saveTypeName(StringRef Name);
-
- bool IsInFieldList = false;
-
- /// Name of the current type. Only valid before visitTypeEnd.
- StringRef Name;
- /// Current type index. Only valid before visitTypeEnd, and if we are
- /// visiting a random access type database.
- Optional<TypeIndex> CurrentTypeIndex;
-
- TypeDatabase *TypeDB;
-};
-
-} // end namespace codeview
-} // end namespace llvm
-
-#endif // LLVM_DEBUGINFO_CODEVIEW_TYPEDUMPER_H
diff --git a/include/llvm/DebugInfo/CodeView/TypeIndexDiscovery.h b/include/llvm/DebugInfo/CodeView/TypeIndexDiscovery.h
index 82ceb50383166..c393b42cd27c5 100644
--- a/include/llvm/DebugInfo/CodeView/TypeIndexDiscovery.h
+++ b/include/llvm/DebugInfo/CodeView/TypeIndexDiscovery.h
@@ -11,6 +11,7 @@
#define LLVM_DEBUGINFO_CODEVIEW_TYPEINDEXDISCOVERY_H
#include "llvm/ADT/SmallVector.h"
+#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
#include "llvm/DebugInfo/CodeView/TypeRecord.h"
#include "llvm/Support/Error.h"
@@ -27,6 +28,11 @@ void discoverTypeIndices(ArrayRef<uint8_t> RecordData,
SmallVectorImpl<TiReference> &Refs);
void discoverTypeIndices(const CVType &Type,
SmallVectorImpl<TiReference> &Refs);
+
+/// Discover type indices in symbol records. Returns false if this is an unknown
+/// record.
+bool discoverTypeIndices(const CVSymbol &Symbol,
+ SmallVectorImpl<TiReference> &Refs);
}
}
diff --git a/include/llvm/DebugInfo/CodeView/TypeName.h b/include/llvm/DebugInfo/CodeView/TypeName.h
new file mode 100644
index 0000000000000..a987b4afd283a
--- /dev/null
+++ b/include/llvm/DebugInfo/CodeView/TypeName.h
@@ -0,0 +1,22 @@
+//===- TypeName.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_TYPENAME_H
+#define LLVM_DEBUGINFO_CODEVIEW_TYPENAME_H
+
+#include "llvm/DebugInfo/CodeView/TypeCollection.h"
+#include "llvm/DebugInfo/CodeView/TypeIndex.h"
+
+namespace llvm {
+namespace codeview {
+std::string computeTypeName(TypeCollection &Types, TypeIndex Index);
+}
+} // namespace llvm
+
+#endif
diff --git a/include/llvm/DebugInfo/CodeView/TypeRecordMapping.h b/include/llvm/DebugInfo/CodeView/TypeRecordMapping.h
index 6156223b25601..cbe8d6066bb9f 100644
--- a/include/llvm/DebugInfo/CodeView/TypeRecordMapping.h
+++ b/include/llvm/DebugInfo/CodeView/TypeRecordMapping.h
@@ -25,6 +25,7 @@ public:
explicit TypeRecordMapping(BinaryStreamReader &Reader) : IO(Reader) {}
explicit TypeRecordMapping(BinaryStreamWriter &Writer) : IO(Writer) {}
+ using TypeVisitorCallbacks::visitTypeBegin;
Error visitTypeBegin(CVType &Record) override;
Error visitTypeEnd(CVType &Record) override;
diff --git a/include/llvm/DebugInfo/CodeView/TypeSerializer.h b/include/llvm/DebugInfo/CodeView/TypeSerializer.h
index f785d45095475..988a2d4aa8346 100644
--- a/include/llvm/DebugInfo/CodeView/TypeSerializer.h
+++ b/include/llvm/DebugInfo/CodeView/TypeSerializer.h
@@ -93,6 +93,7 @@ public:
TypeIndex insertRecord(const RemappedType &Record);
Expected<TypeIndex> visitTypeEndGetIndex(CVType &Record);
+ using TypeVisitorCallbacks::visitTypeBegin;
Error visitTypeBegin(CVType &Record) override;
Error visitTypeEnd(CVType &Record) override;
Error visitMemberBegin(CVMemberRecord &Record) override;
diff --git a/include/llvm/DebugInfo/CodeView/TypeTableCollection.h b/include/llvm/DebugInfo/CodeView/TypeTableCollection.h
index 42b62ba2b6ce5..80326a0ffd39d 100644
--- a/include/llvm/DebugInfo/CodeView/TypeTableCollection.h
+++ b/include/llvm/DebugInfo/CodeView/TypeTableCollection.h
@@ -11,7 +11,9 @@
#define LLVM_DEBUGINFO_CODEVIEW_TYPETABLECOLLECTION_H
#include "llvm/DebugInfo/CodeView/TypeCollection.h"
-#include "llvm/DebugInfo/CodeView/TypeDatabase.h"
+#include "llvm/Support/StringSaver.h"
+
+#include <vector>
namespace llvm {
namespace codeview {
@@ -30,11 +32,10 @@ public:
uint32_t capacity() override;
private:
- bool hasCapacityFor(TypeIndex Index) const;
- void ensureTypeExists(TypeIndex Index);
-
+ BumpPtrAllocator Allocator;
+ StringSaver NameStorage;
+ std::vector<StringRef> Names;
ArrayRef<ArrayRef<uint8_t>> Records;
- TypeDatabase Database;
};
}
}
diff --git a/include/llvm/DebugInfo/DIContext.h b/include/llvm/DebugInfo/DIContext.h
index 2e82a774cc23b..4126e245ff139 100644
--- a/include/llvm/DebugInfo/DIContext.h
+++ b/include/llvm/DebugInfo/DIContext.h
@@ -57,7 +57,7 @@ struct DILineInfo {
}
};
-typedef SmallVector<std::pair<uint64_t, DILineInfo>, 16> DILineInfoTable;
+using DILineInfoTable = SmallVector<std::pair<uint64_t, DILineInfo>, 16>;
/// DIInliningInfo - a format-neutral container for inlined code description.
class DIInliningInfo {
@@ -102,7 +102,7 @@ enum class DINameKind { None, ShortName, LinkageName };
/// should be filled with data.
struct DILineInfoSpecifier {
enum class FileLineInfoKind { None, Default, AbsoluteFilePath };
- typedef DINameKind FunctionNameKind;
+ using FunctionNameKind = DINameKind;
FileLineInfoKind FLIKind;
FunctionNameKind FNKind;
@@ -174,6 +174,7 @@ public:
// No verifier? Just say things went well.
return true;
}
+
virtual DILineInfo getLineInfoForAddress(uint64_t Address,
DILineInfoSpecifier Specifier = DILineInfoSpecifier()) = 0;
virtual DILineInfoTable getLineInfoForAddressRange(uint64_t Address,
diff --git a/include/llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h b/include/llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h
index e363cff158033..190a69b757390 100644
--- a/include/llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h
+++ b/include/llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h
@@ -33,6 +33,7 @@ public:
dwarf::Attribute Attr;
dwarf::Form Form;
+
/// The following field is used for ByteSize for non-implicit_const
/// attributes and as value for implicit_const ones, indicated by
/// Form == DW_FORM_implicit_const.
@@ -58,7 +59,7 @@ public:
/// the ByteSize member.
Optional<int64_t> getByteSize(const DWARFUnit &U) const;
};
- typedef SmallVector<AttributeSpec, 8> AttributeSpecVector;
+ using AttributeSpecVector = SmallVector<AttributeSpec, 8>;
DWARFAbbreviationDeclaration();
@@ -67,8 +68,8 @@ public:
dwarf::Tag getTag() const { return Tag; }
bool hasChildren() const { return HasChildren; }
- typedef iterator_range<AttributeSpecVector::const_iterator>
- attr_iterator_range;
+ using attr_iterator_range =
+ iterator_range<AttributeSpecVector::const_iterator>;
attr_iterator_range attributes() const {
return attr_iterator_range(AttributeSpecs.begin(), AttributeSpecs.end());
diff --git a/include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h b/include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h
index 3012b39dcc528..8bde63efe1882 100644
--- a/include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h
+++ b/include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h
@@ -32,8 +32,9 @@ class DWARFAcceleratorTable {
};
struct HeaderData {
- typedef uint16_t AtomType;
- typedef dwarf::Form Form;
+ using AtomType = uint16_t;
+ using Form = dwarf::Form;
+
uint32_t DIEOffsetBase;
SmallVector<std::pair<AtomType, Form>, 3> Atoms;
};
diff --git a/include/llvm/DebugInfo/DWARF/DWARFContext.h b/include/llvm/DebugInfo/DWARF/DWARFContext.h
index c72604a12bfda..4bf34d52bcba9 100644
--- a/include/llvm/DebugInfo/DWARF/DWARFContext.h
+++ b/include/llvm/DebugInfo/DWARF/DWARFContext.h
@@ -10,7 +10,6 @@
#ifndef LLVM_DEBUGINFO_DWARF_DWARFCONTEXT_H
#define LLVM_DEBUGINFO_DWARF_DWARFCONTEXT_H
-#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/MapVector.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/SmallVector.h"
@@ -25,21 +24,24 @@
#include "llvm/DebugInfo/DWARF/DWARFDebugLine.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugLoc.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugMacro.h"
+#include "llvm/DebugInfo/DWARF/DWARFDie.h"
#include "llvm/DebugInfo/DWARF/DWARFGdbIndex.h"
#include "llvm/DebugInfo/DWARF/DWARFSection.h"
#include "llvm/DebugInfo/DWARF/DWARFTypeUnit.h"
#include "llvm/DebugInfo/DWARF/DWARFUnit.h"
#include "llvm/DebugInfo/DWARF/DWARFUnitIndex.h"
+#include "llvm/Object/Binary.h"
#include "llvm/Object/ObjectFile.h"
+#include "llvm/Support/Error.h"
#include "llvm/Support/Host.h"
#include <cstdint>
#include <deque>
#include <map>
#include <memory>
-#include <utility>
namespace llvm {
+class DataExtractor;
class MemoryBuffer;
class raw_ostream;
@@ -73,7 +75,7 @@ class DWARFContext : public DIContext {
std::unique_ptr<DWARFDebugLocDWO> LocDWO;
/// The maximum DWARF version of all units.
- unsigned MaxVersion;
+ unsigned MaxVersion = 0;
struct DWOFile {
object::OwningBinary<object::ObjectFile> File;
@@ -100,7 +102,7 @@ class DWARFContext : public DIContext {
void parseDWOTypeUnits();
public:
- DWARFContext() : DIContext(CK_DWARF), MaxVersion(0) {}
+ DWARFContext() : DIContext(CK_DWARF) {}
DWARFContext(DWARFContext &) = delete;
DWARFContext &operator=(DWARFContext &) = delete;
@@ -112,9 +114,9 @@ public:
bool verify(raw_ostream &OS, DIDumpType DumpType = DIDT_All) override;
- typedef DWARFUnitSection<DWARFCompileUnit>::iterator_range cu_iterator_range;
- typedef DWARFUnitSection<DWARFTypeUnit>::iterator_range tu_iterator_range;
- typedef iterator_range<decltype(TUs)::iterator> tu_section_iterator_range;
+ using cu_iterator_range = DWARFUnitSection<DWARFCompileUnit>::iterator_range;
+ using tu_iterator_range = DWARFUnitSection<DWARFTypeUnit>::iterator_range;
+ using tu_section_iterator_range = iterator_range<decltype(TUs)::iterator>;
/// Get compile units in this context.
cu_iterator_range compile_units() {
@@ -230,8 +232,10 @@ public:
virtual bool isLittleEndian() const = 0;
virtual uint8_t getAddressSize() const = 0;
virtual const DWARFSection &getInfoSection() = 0;
- typedef MapVector<object::SectionRef, DWARFSection,
- std::map<object::SectionRef, unsigned>> TypeSectionMap;
+
+ using TypeSectionMap = MapVector<object::SectionRef, DWARFSection,
+ std::map<object::SectionRef, unsigned>>;
+
virtual const TypeSectionMap &getTypesSections() = 0;
virtual StringRef getAbbrevSection() = 0;
virtual const DWARFSection &getLocSection() = 0;
diff --git a/include/llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h b/include/llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h
index 9f86fe5083896..65571598d7432 100644
--- a/include/llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h
+++ b/include/llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h
@@ -18,6 +18,8 @@
namespace llvm {
+class raw_ostream;
+
class DWARFAbbreviationDeclarationSet {
uint32_t Offset;
/// Code of the first abbreviation, if all abbreviations in the set have
@@ -25,8 +27,8 @@ class DWARFAbbreviationDeclarationSet {
uint32_t FirstAbbrCode;
std::vector<DWARFAbbreviationDeclaration> Decls;
- typedef std::vector<DWARFAbbreviationDeclaration>::const_iterator
- const_iterator;
+ using const_iterator =
+ std::vector<DWARFAbbreviationDeclaration>::const_iterator;
public:
DWARFAbbreviationDeclarationSet();
@@ -51,8 +53,8 @@ private:
};
class DWARFDebugAbbrev {
- typedef std::map<uint64_t, DWARFAbbreviationDeclarationSet>
- DWARFAbbreviationDeclarationSetMap;
+ using DWARFAbbreviationDeclarationSetMap =
+ std::map<uint64_t, DWARFAbbreviationDeclarationSet>;
DWARFAbbreviationDeclarationSetMap AbbrDeclSets;
mutable DWARFAbbreviationDeclarationSetMap::const_iterator PrevAbbrOffsetPos;
diff --git a/include/llvm/DebugInfo/DWARF/DWARFDebugArangeSet.h b/include/llvm/DebugInfo/DWARF/DWARFDebugArangeSet.h
index 2d82104ea0984..dfbbb95076e81 100644
--- a/include/llvm/DebugInfo/DWARF/DWARFDebugArangeSet.h
+++ b/include/llvm/DebugInfo/DWARF/DWARFDebugArangeSet.h
@@ -46,8 +46,8 @@ public:
};
private:
- typedef std::vector<Descriptor> DescriptorColl;
- typedef iterator_range<DescriptorColl::const_iterator> desc_iterator_range;
+ using DescriptorColl = std::vector<Descriptor>;
+ using desc_iterator_range = iterator_range<DescriptorColl::const_iterator>;
uint32_t Offset;
Header HeaderData;
diff --git a/include/llvm/DebugInfo/DWARF/DWARFDebugAranges.h b/include/llvm/DebugInfo/DWARF/DWARFDebugAranges.h
index 2237aa361d187..ea71a50f3270d 100644
--- a/include/llvm/DebugInfo/DWARF/DWARFDebugAranges.h
+++ b/include/llvm/DebugInfo/DWARF/DWARFDebugAranges.h
@@ -76,8 +76,8 @@ private:
}
};
- typedef std::vector<Range> RangeColl;
- typedef RangeColl::const_iterator RangeCollIterator;
+ using RangeColl = std::vector<Range>;
+ using RangeCollIterator = RangeColl::const_iterator;
std::vector<RangeEndpoint> Endpoints;
RangeColl Aranges;
diff --git a/include/llvm/DebugInfo/DWARF/DWARFDebugLine.h b/include/llvm/DebugInfo/DWARF/DWARFDebugLine.h
index 39a7ef71de97d..4d624812f1861 100644
--- a/include/llvm/DebugInfo/DWARF/DWARFDebugLine.h
+++ b/include/llvm/DebugInfo/DWARF/DWARFDebugLine.h
@@ -10,7 +10,9 @@
#ifndef LLVM_DEBUGINFO_DWARFDEBUGLINE_H
#define LLVM_DEBUGINFO_DWARFDEBUGLINE_H
+#include "llvm/ADT/StringRef.h"
#include "llvm/DebugInfo/DIContext.h"
+#include "llvm/DebugInfo/DWARF/DWARFFormValue.h"
#include "llvm/DebugInfo/DWARF/DWARFRelocMap.h"
#include "llvm/Support/DataExtractor.h"
#include <cstdint>
@@ -42,10 +44,10 @@ public:
/// The size in bytes of the statement information for this compilation unit
/// (not including the total_length field itself).
uint64_t TotalLength;
- /// Version identifier for the statement information format.
- uint16_t Version;
- /// In v5, size in bytes of an address (or segment offset).
- uint8_t AddressSize;
+ /// Version, address size (starting in v5), and DWARF32/64 format; these
+ /// parameters affect interpretation of forms (used in the directory and
+ /// file tables starting with v5).
+ DWARFFormParams FormParams;
/// In v5, size in bytes of a segment selector.
uint8_t SegSelectorSize;
/// The number of bytes following the prologue_length field to the beginning
@@ -70,15 +72,18 @@ public:
std::vector<StringRef> IncludeDirectories;
std::vector<FileNameEntry> FileNames;
- bool IsDWARF64;
+ const DWARFFormParams getFormParams() const { return FormParams; }
+ uint16_t getVersion() const { return FormParams.Version; }
+ uint8_t getAddressSize() const { return FormParams.AddrSize; }
+ bool isDWARF64() const { return FormParams.Format == dwarf::DWARF64; }
- uint32_t sizeofTotalLength() const { return IsDWARF64 ? 12 : 4; }
+ uint32_t sizeofTotalLength() const { return isDWARF64() ? 12 : 4; }
- uint32_t sizeofPrologueLength() const { return IsDWARF64 ? 8 : 4; }
+ uint32_t sizeofPrologueLength() const { return isDWARF64() ? 8 : 4; }
/// Length of the prologue in bytes.
uint32_t getLength() const {
- return PrologueLength + sizeofTotalLength() + sizeof(Version) +
+ return PrologueLength + sizeofTotalLength() + sizeof(getVersion()) +
sizeofPrologueLength();
}
@@ -104,7 +109,9 @@ public:
void postAppend();
void reset(bool DefaultIsStmt);
void dump(raw_ostream &OS) const;
+
static void dumpTableHeader(raw_ostream &OS);
+
static bool orderByAddress(const Row &LHS, const Row &RHS) {
return LHS.Address < RHS.Address;
}
@@ -216,11 +223,12 @@ public:
bool parse(DataExtractor DebugLineData, const RelocAddrMap *RMap,
uint32_t *OffsetPtr);
+ using RowVector = std::vector<Row>;
+ using RowIter = RowVector::const_iterator;
+ using SequenceVector = std::vector<Sequence>;
+ using SequenceIter = SequenceVector::const_iterator;
+
struct Prologue Prologue;
- typedef std::vector<Row> RowVector;
- typedef RowVector::const_iterator RowIter;
- typedef std::vector<Sequence> SequenceVector;
- typedef SequenceVector::const_iterator SequenceIter;
RowVector Rows;
SequenceVector Sequences;
@@ -244,14 +252,14 @@ private:
struct LineTable *LineTable;
/// The row number that starts at zero for the prologue, and increases for
/// each row added to the matrix.
- unsigned RowNumber;
+ unsigned RowNumber = 0;
struct Row Row;
struct Sequence Sequence;
};
- typedef std::map<uint32_t, LineTable> LineTableMapTy;
- typedef LineTableMapTy::iterator LineTableIter;
- typedef LineTableMapTy::const_iterator LineTableConstIter;
+ using LineTableMapTy = std::map<uint32_t, LineTable>;
+ using LineTableIter = LineTableMapTy::iterator;
+ using LineTableConstIter = LineTableMapTy::const_iterator;
const RelocAddrMap *RelocMap;
LineTableMapTy LineTableMap;
diff --git a/include/llvm/DebugInfo/DWARF/DWARFDebugLoc.h b/include/llvm/DebugInfo/DWARF/DWARFDebugLoc.h
index 6d4cd8d1b5a3c..821da8f9b5361 100644
--- a/include/llvm/DebugInfo/DWARF/DWARFDebugLoc.h
+++ b/include/llvm/DebugInfo/DWARF/DWARFDebugLoc.h
@@ -39,7 +39,7 @@ class DWARFDebugLoc {
SmallVector<Entry, 2> Entries;
};
- typedef SmallVector<LocationList, 4> LocationLists;
+ using LocationLists = SmallVector<LocationList, 4>;
/// A list of all the variables in the debug_loc section, each one describing
/// the locations in which the variable is stored.
@@ -71,7 +71,7 @@ class DWARFDebugLocDWO {
SmallVector<Entry, 2> Entries;
};
- typedef SmallVector<LocationList, 4> LocationLists;
+ using LocationLists = SmallVector<LocationList, 4>;
LocationLists Locations;
diff --git a/include/llvm/DebugInfo/DWARF/DWARFDebugMacro.h b/include/llvm/DebugInfo/DWARF/DWARFDebugMacro.h
index 85d98b45afcd5..135c50761e36a 100644
--- a/include/llvm/DebugInfo/DWARF/DWARFDebugMacro.h
+++ b/include/llvm/DebugInfo/DWARF/DWARFDebugMacro.h
@@ -40,7 +40,7 @@ class DWARFDebugMacro {
};
};
- typedef SmallVector<Entry, 4> MacroList;
+ using MacroList = SmallVector<Entry, 4>;
/// A list of all the macro entries in the debug_macinfo section.
MacroList Macros;
diff --git a/include/llvm/DebugInfo/DWARF/DWARFDebugRangeList.h b/include/llvm/DebugInfo/DWARF/DWARFDebugRangeList.h
index 437060bc8fec1..49beec92ecc67 100644
--- a/include/llvm/DebugInfo/DWARF/DWARFDebugRangeList.h
+++ b/include/llvm/DebugInfo/DWARF/DWARFDebugRangeList.h
@@ -12,10 +12,8 @@
#include "llvm/DebugInfo/DWARF/DWARFRelocMap.h"
#include "llvm/Support/DataExtractor.h"
-
#include <cassert>
#include <cstdint>
-#include <utility>
#include <vector>
namespace llvm {
@@ -29,7 +27,7 @@ struct DWARFAddressRange {
};
/// DWARFAddressRangesVector - represents a set of absolute address ranges.
-typedef std::vector<DWARFAddressRange> DWARFAddressRangesVector;
+using DWARFAddressRangesVector = std::vector<DWARFAddressRange>;
class DWARFDebugRangeList {
public:
diff --git a/include/llvm/DebugInfo/DWARF/DWARFFormValue.h b/include/llvm/DebugInfo/DWARF/DWARFFormValue.h
index d6a3b52f2fe1a..78fa6639db087 100644
--- a/include/llvm/DebugInfo/DWARF/DWARFFormValue.h
+++ b/include/llvm/DebugInfo/DWARF/DWARFFormValue.h
@@ -22,6 +22,35 @@ namespace llvm {
class DWARFUnit;
class raw_ostream;
+/// A helper struct for DWARFFormValue methods, providing information that
+/// allows it to know the byte size of DW_FORM values that vary in size
+/// depending on the DWARF version, address byte size, or DWARF32/DWARF64.
+struct DWARFFormParams {
+ uint16_t Version;
+ uint8_t AddrSize;
+ dwarf::DwarfFormat Format;
+
+ /// The definition of the size of form DW_FORM_ref_addr depends on the
+ /// version. In DWARF v2 it's the size of an address; after that, it's the
+ /// size of a reference.
+ uint8_t getRefAddrByteSize() const {
+ if (Version == 2)
+ return AddrSize;
+ return getDwarfOffsetByteSize();
+ }
+
+ /// The size of a reference is determined by the DWARF 32/64-bit format.
+ uint8_t getDwarfOffsetByteSize() const {
+ switch (Format) {
+ case dwarf::DwarfFormat::DWARF32:
+ return 4;
+ case dwarf::DwarfFormat::DWARF64:
+ return 8;
+ }
+ llvm_unreachable("Invalid Format value");
+ }
+};
+
class DWARFFormValue {
public:
enum FormClass {
@@ -104,79 +133,43 @@ public:
/// Get the fixed byte size for a given form.
///
- /// If the form always has a fixed valid byte size that doesn't depend on a
- /// DWARFUnit, then an Optional with a value will be returned. If the form
- /// can vary in size depending on the DWARFUnit (DWARF version, address byte
- /// size, or DWARF 32/64) and the DWARFUnit is valid, then an Optional with a
- /// valid value is returned. If the form is always encoded using a variable
- /// length storage format (ULEB or SLEB numbers or blocks) or the size
- /// depends on a DWARFUnit and the DWARFUnit is NULL, then None will be
- /// returned.
- /// \param Form The DWARF form to get the fixed byte size for
- /// \param U The DWARFUnit that can be used to help determine the byte size.
- ///
- /// \returns Optional<uint8_t> value with the fixed byte size or None if
- /// \p Form doesn't have a fixed byte size or a DWARFUnit wasn't supplied
- /// and was needed to calculate the byte size.
- static Optional<uint8_t> getFixedByteSize(dwarf::Form Form,
- const DWARFUnit *U = nullptr);
-
- /// Get the fixed byte size for a given form.
- ///
- /// If the form has a fixed byte size given a valid DWARF version and address
- /// byte size, then an Optional with a valid value is returned. If the form
- /// is always encoded using a variable length storage format (ULEB or SLEB
- /// numbers or blocks) then None will be returned.
+ /// If the form has a fixed byte size, then an Optional with a value will be
+ /// returned. If the form is always encoded using a variable length storage
+ /// format (ULEB or SLEB numbers or blocks) then None will be returned.
///
- /// \param Form DWARF form to get the fixed byte size for
- /// \param Version DWARF version number.
- /// \param AddrSize size of an address in bytes.
- /// \param Format enum value from llvm::dwarf::DwarfFormat.
+ /// \param Form DWARF form to get the fixed byte size for.
+ /// \param FormParams DWARF parameters to help interpret forms.
/// \returns Optional<uint8_t> value with the fixed byte size or None if
/// \p Form doesn't have a fixed byte size.
- static Optional<uint8_t> getFixedByteSize(dwarf::Form Form, uint16_t Version,
- uint8_t AddrSize,
- llvm::dwarf::DwarfFormat Format);
+ static Optional<uint8_t> getFixedByteSize(dwarf::Form Form,
+ const DWARFFormParams FormParams);
- /// Skip a form in \p DebugInfoData at offset specified by \p OffsetPtr.
+ /// Skip a form's value in \p DebugInfoData at the offset specified by
+ /// \p OffsetPtr.
///
- /// Skips the bytes for this form in the debug info and updates the offset.
+ /// Skips the bytes for the current form and updates the offset.
///
- /// \param DebugInfoData the .debug_info data to use to skip the value.
- /// \param OffsetPtr a reference to the offset that will be updated.
- /// \param U the DWARFUnit to use when skipping the form in case the form
- /// size differs according to data in the DWARFUnit.
+ /// \param DebugInfoData The data where we want to skip the value.
+ /// \param OffsetPtr A reference to the offset that will be updated.
+ /// \param Params DWARF parameters to help interpret forms.
/// \returns true on success, false if the form was not skipped.
bool skipValue(DataExtractor DebugInfoData, uint32_t *OffsetPtr,
- const DWARFUnit *U) const;
-
- /// Skip a form in \p DebugInfoData at offset specified by \p OffsetPtr.
- ///
- /// Skips the bytes for this form in the debug info and updates the offset.
- ///
- /// \param Form the DW_FORM enumeration that indicates the form to skip.
- /// \param DebugInfoData the .debug_info data to use to skip the value.
- /// \param OffsetPtr a reference to the offset that will be updated.
- /// \param U the DWARFUnit to use when skipping the form in case the form
- /// size differs according to data in the DWARFUnit.
- /// \returns true on success, false if the form was not skipped.
- static bool skipValue(dwarf::Form Form, DataExtractor DebugInfoData,
- uint32_t *OffsetPtr, const DWARFUnit *U);
+ const DWARFFormParams Params) const {
+ return DWARFFormValue::skipValue(Form, DebugInfoData, OffsetPtr, Params);
+ }
- /// Skip a form in \p DebugInfoData at offset specified by \p OffsetPtr.
+ /// Skip a form's value in \p DebugInfoData at the offset specified by
+ /// \p OffsetPtr.
///
- /// Skips the bytes for this form in the debug info and updates the offset.
+ /// Skips the bytes for the specified form and updates the offset.
///
- /// \param Form the DW_FORM enumeration that indicates the form to skip.
- /// \param DebugInfoData the .debug_info data to use to skip the value.
- /// \param OffsetPtr a reference to the offset that will be updated.
- /// \param Version DWARF version number.
- /// \param AddrSize size of an address in bytes.
- /// \param Format enum value from llvm::dwarf::DwarfFormat.
+ /// \param Form The DW_FORM enumeration that indicates the form to skip.
+ /// \param DebugInfoData The data where we want to skip the value.
+ /// \param OffsetPtr A reference to the offset that will be updated.
+ /// \param FormParams DWARF parameters to help interpret forms.
/// \returns true on success, false if the form was not skipped.
static bool skipValue(dwarf::Form Form, DataExtractor DebugInfoData,
- uint32_t *OffsetPtr, uint16_t Version, uint8_t AddrSize,
- llvm::dwarf::DwarfFormat Format);
+ uint32_t *OffsetPtr, const DWARFFormParams FormParams);
private:
void dumpString(raw_ostream &OS) const;
diff --git a/include/llvm/DebugInfo/DWARF/DWARFRelocMap.h b/include/llvm/DebugInfo/DWARF/DWARFRelocMap.h
index f143de334737a..f51838424614a 100644
--- a/include/llvm/DebugInfo/DWARF/DWARFRelocMap.h
+++ b/include/llvm/DebugInfo/DWARF/DWARFRelocMap.h
@@ -12,7 +12,6 @@
#include "llvm/ADT/DenseMap.h"
#include <cstdint>
-#include <utility>
namespace llvm {
@@ -28,7 +27,7 @@ struct RelocAddrEntry {
/// dwarf where we expect relocated values. This adds a bit of complexity to the
/// dwarf parsing/extraction at the benefit of not allocating memory for the
/// entire size of the debug info sections.
-typedef DenseMap<uint64_t, RelocAddrEntry> RelocAddrMap;
+using RelocAddrMap = DenseMap<uint64_t, RelocAddrEntry>;
} // end namespace llvm
diff --git a/include/llvm/DebugInfo/DWARF/DWARFUnit.h b/include/llvm/DebugInfo/DWARF/DWARFUnit.h
index 945b8999ff22f..d7ccaf82bc9a1 100644
--- a/include/llvm/DebugInfo/DWARF/DWARFUnit.h
+++ b/include/llvm/DebugInfo/DWARF/DWARFUnit.h
@@ -19,11 +19,10 @@
#include "llvm/DebugInfo/DWARF/DWARFDebugInfoEntry.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugRangeList.h"
#include "llvm/DebugInfo/DWARF/DWARFDie.h"
+#include "llvm/DebugInfo/DWARF/DWARFFormValue.h"
#include "llvm/DebugInfo/DWARF/DWARFRelocMap.h"
#include "llvm/DebugInfo/DWARF/DWARFSection.h"
#include "llvm/DebugInfo/DWARF/DWARFUnitIndex.h"
-#include "llvm/Object/Binary.h"
-#include "llvm/Object/ObjectFile.h"
#include "llvm/Support/DataExtractor.h"
#include <algorithm>
#include <cassert>
@@ -31,6 +30,7 @@
#include <cstdint>
#include <map>
#include <memory>
+#include <utility>
#include <vector>
namespace llvm {
@@ -72,9 +72,9 @@ class DWARFUnitSection final : public SmallVector<std::unique_ptr<UnitType>, 1>,
bool Parsed = false;
public:
- typedef SmallVectorImpl<std::unique_ptr<UnitType>> UnitVector;
- typedef typename UnitVector::iterator iterator;
- typedef llvm::iterator_range<typename UnitVector::iterator> iterator_range;
+ using UnitVector = SmallVectorImpl<std::unique_ptr<UnitType>>;
+ using iterator = typename UnitVector::iterator;
+ using iterator_range = llvm::iterator_range<typename UnitVector::iterator>;
UnitType *getUnitForOffset(uint32_t Offset) const override {
auto *CU = std::upper_bound(
@@ -128,12 +128,13 @@ class DWARFUnit {
bool isDWO;
const DWARFUnitSectionBase &UnitSection;
+ // Version, address size, and DWARF format.
+ DWARFFormParams FormParams;
+
uint32_t Offset;
uint32_t Length;
const DWARFAbbreviationDeclarationSet *Abbrevs;
- uint16_t Version;
uint8_t UnitType;
- uint8_t AddrSize;
uint64_t BaseAddr;
/// The compile unit debug information entry items.
std::vector<DWARFDebugInfoEntry> DieArray;
@@ -142,8 +143,9 @@ class DWARFUnit {
/// IntervalMap does not support range removal, as a result, we use the
/// std::map::upper_bound for address range lookup.
std::map<uint64_t, std::pair<uint64_t, DWARFDie>> AddrDieMap;
- typedef iterator_range<std::vector<DWARFDebugInfoEntry>::iterator>
- die_iterator_range;
+
+ using die_iterator_range =
+ iterator_range<std::vector<DWARFDebugInfoEntry>::iterator>;
std::shared_ptr<DWARFUnit> DWO;
@@ -159,7 +161,7 @@ protected:
virtual bool extractImpl(DataExtractor debug_info, uint32_t *offset_ptr);
/// Size in bytes of the unit header.
- virtual uint32_t getHeaderSize() const { return Version <= 4 ? 11 : 12; }
+ virtual uint32_t getHeaderSize() const { return getVersion() <= 4 ? 11 : 12; }
public:
DWARFUnit(DWARFContext &Context, const DWARFSection &Section,
@@ -197,7 +199,8 @@ public:
uint64_t getStringOffsetSectionRelocation(uint32_t Index) const;
DataExtractor getDebugInfoExtractor() const {
- return DataExtractor(InfoSection.Data, isLittleEndian, AddrSize);
+ return DataExtractor(InfoSection.Data, isLittleEndian,
+ getAddressByteSize());
}
DataExtractor getStringExtractor() const {
@@ -220,10 +223,14 @@ public:
uint32_t getOffset() const { return Offset; }
uint32_t getNextUnitOffset() const { return Offset + Length + 4; }
uint32_t getLength() const { return Length; }
- uint16_t getVersion() const { return Version; }
- dwarf::DwarfFormat getFormat() const {
- return dwarf::DwarfFormat::DWARF32; // FIXME: Support DWARF64.
+ const DWARFFormParams &getFormParams() const { return FormParams; }
+ uint16_t getVersion() const { return FormParams.Version; }
+ dwarf::DwarfFormat getFormat() const { return FormParams.Format; }
+ uint8_t getAddressByteSize() const { return FormParams.AddrSize; }
+ uint8_t getRefAddrByteSize() const { return FormParams.getRefAddrByteSize(); }
+ uint8_t getDwarfOffsetByteSize() const {
+ return FormParams.getDwarfOffsetByteSize();
}
const DWARFAbbreviationDeclarationSet *getAbbreviations() const {
@@ -231,19 +238,6 @@ public:
}
uint8_t getUnitType() const { return UnitType; }
- uint8_t getAddressByteSize() const { return AddrSize; }
-
- uint8_t getRefAddrByteSize() const {
- if (Version == 2)
- return AddrSize;
- return getDwarfOffsetByteSize();
- }
-
- uint8_t getDwarfOffsetByteSize() const {
- if (getFormat() == dwarf::DwarfFormat::DWARF64)
- return 8;
- return 4;
- }
uint64_t getBaseAddress() const { return BaseAddr; }
diff --git a/include/llvm/DebugInfo/MSF/MSFBuilder.h b/include/llvm/DebugInfo/MSF/MSFBuilder.h
index 6d067cc1c2381..b2c8f2d1c20da 100644
--- a/include/llvm/DebugInfo/MSF/MSFBuilder.h
+++ b/include/llvm/DebugInfo/MSF/MSFBuilder.h
@@ -12,18 +12,16 @@
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/BitVector.h"
-
#include "llvm/DebugInfo/MSF/MSFCommon.h"
-
#include "llvm/Support/Allocator.h"
-#include "llvm/Support/Endian.h"
#include "llvm/Support/Error.h"
-
+#include <cstdint>
#include <utility>
#include <vector>
namespace llvm {
namespace msf {
+
class MSFBuilder {
public:
/// \brief Create a new `MSFBuilder`.
@@ -122,7 +120,7 @@ private:
Error allocateBlocks(uint32_t NumBlocks, MutableArrayRef<uint32_t> Blocks);
uint32_t computeDirectoryByteSize() const;
- typedef std::vector<uint32_t> BlockList;
+ using BlockList = std::vector<uint32_t>;
BumpPtrAllocator &Allocator;
@@ -136,7 +134,8 @@ private:
std::vector<uint32_t> DirectoryBlocks;
std::vector<std::pair<uint32_t, BlockList>> StreamData;
};
-} // namespace msf
-} // namespace llvm
+
+} // end namespace msf
+} // end namespace llvm
#endif // LLVM_DEBUGINFO_MSF_MSFBUILDER_H
diff --git a/include/llvm/DebugInfo/MSF/MSFCommon.h b/include/llvm/DebugInfo/MSF/MSFCommon.h
index 93a9c808b7368..eca1b8b89ebd8 100644
--- a/include/llvm/DebugInfo/MSF/MSFCommon.h
+++ b/include/llvm/DebugInfo/MSF/MSFCommon.h
@@ -12,15 +12,15 @@
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/BitVector.h"
-
#include "llvm/Support/Endian.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/MathExtras.h"
-
+#include <cstdint>
#include <vector>
namespace llvm {
namespace msf {
+
static const char Magic[] = {'M', 'i', 'c', 'r', 'o', 's', 'o', 'f',
't', ' ', 'C', '/', 'C', '+', '+', ' ',
'M', 'S', 'F', ' ', '7', '.', '0', '0',
@@ -50,8 +50,9 @@ struct SuperBlock {
};
struct MSFLayout {
- MSFLayout() : SB(nullptr) {}
- const SuperBlock *SB;
+ MSFLayout() = default;
+
+ const SuperBlock *SB = nullptr;
BitVector FreePageMap;
ArrayRef<support::ulittle32_t> DirectoryBlocks;
ArrayRef<support::ulittle32_t> StreamSizes;
@@ -90,15 +91,16 @@ inline uint32_t getFpmIntervalLength(const MSFLayout &L) {
inline uint32_t getNumFpmIntervals(const MSFLayout &L) {
uint32_t Length = getFpmIntervalLength(L);
- return llvm::alignTo(L.SB->NumBlocks, Length) / Length;
+ return alignTo(L.SB->NumBlocks, Length) / Length;
}
inline uint32_t getFullFpmByteSize(const MSFLayout &L) {
- return llvm::alignTo(L.SB->NumBlocks, 8) / 8;
+ return alignTo(L.SB->NumBlocks, 8) / 8;
}
Error validateSuperBlock(const SuperBlock &SB);
-} // namespace msf
-} // namespace llvm
+
+} // end namespace msf
+} // end namespace llvm
#endif // LLVM_DEBUGINFO_MSF_MSFCOMMON_H
diff --git a/include/llvm/DebugInfo/MSF/MappedBlockStream.h b/include/llvm/DebugInfo/MSF/MappedBlockStream.h
index 02f3cb09b0045..6d88d2be85c9b 100644
--- a/include/llvm/DebugInfo/MSF/MappedBlockStream.h
+++ b/include/llvm/DebugInfo/MSF/MappedBlockStream.h
@@ -1,5 +1,4 @@
-//===- MappedBlockStream.h - Discontiguous stream data in an MSF -*- C++
-//-*-===//
+//==- MappedBlockStream.h - Discontiguous stream data in an MSF --*- C++ -*-==//
//
// The LLVM Compiler Infrastructure
//
@@ -13,7 +12,6 @@
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
-#include "llvm/ADT/STLExtras.h"
#include "llvm/DebugInfo/MSF/MSFStreamLayout.h"
#include "llvm/Support/Allocator.h"
#include "llvm/Support/BinaryStream.h"
@@ -21,6 +19,7 @@
#include "llvm/Support/Endian.h"
#include "llvm/Support/Error.h"
#include <cstdint>
+#include <memory>
#include <vector>
namespace llvm {
@@ -40,6 +39,7 @@ struct MSFLayout;
/// of bytes.
class MappedBlockStream : public BinaryStream {
friend class WritableMappedBlockStream;
+
public:
static std::unique_ptr<MappedBlockStream>
createStream(uint32_t BlockSize, const MSFStreamLayout &Layout,
@@ -57,8 +57,8 @@ public:
createDirectoryStream(const MSFLayout &Layout, BinaryStreamRef MsfData,
BumpPtrAllocator &Allocator);
- llvm::support::endianness getEndian() const override {
- return llvm::support::little;
+ support::endianness getEndian() const override {
+ return support::little;
}
Error readBytes(uint32_t Offset, uint32_t Size,
@@ -68,7 +68,7 @@ public:
uint32_t getLength() override;
- llvm::BumpPtrAllocator &getAllocator() { return Allocator; }
+ BumpPtrAllocator &getAllocator() { return Allocator; }
void invalidateCache();
@@ -92,7 +92,7 @@ private:
const MSFStreamLayout StreamLayout;
BinaryStreamRef MsfData;
- typedef MutableArrayRef<uint8_t> CacheEntry;
+ using CacheEntry = MutableArrayRef<uint8_t>;
// We just store the allocator by reference. We use this to allocate
// contiguous memory for things like arrays or strings that cross a block
@@ -124,8 +124,8 @@ public:
createFpmStream(const MSFLayout &Layout, WritableBinaryStreamRef MsfData,
BumpPtrAllocator &Allocator);
- llvm::support::endianness getEndian() const override {
- return llvm::support::little;
+ support::endianness getEndian() const override {
+ return support::little;
}
Error readBytes(uint32_t Offset, uint32_t Size,
@@ -141,6 +141,7 @@ public:
const MSFStreamLayout &getStreamLayout() const {
return ReadInterface.getStreamLayout();
}
+
uint32_t getBlockSize() const { return ReadInterface.getBlockSize(); }
uint32_t getNumBlocks() const { return ReadInterface.getNumBlocks(); }
uint32_t getStreamLength() const { return ReadInterface.getStreamLength(); }
@@ -153,7 +154,6 @@ protected:
private:
MappedBlockStream ReadInterface;
-
WritableBinaryStreamRef WriteInterface;
};
diff --git a/include/llvm/DebugInfo/PDB/DIA/DIASession.h b/include/llvm/DebugInfo/PDB/DIA/DIASession.h
index 3f5818631e7bc..350442556bef8 100644
--- a/include/llvm/DebugInfo/PDB/DIA/DIASession.h
+++ b/include/llvm/DebugInfo/PDB/DIA/DIASession.h
@@ -31,7 +31,7 @@ public:
uint64_t getLoadAddress() const override;
void setLoadAddress(uint64_t Address) override;
- std::unique_ptr<PDBSymbolExe> getGlobalScope() const override;
+ std::unique_ptr<PDBSymbolExe> getGlobalScope() override;
std::unique_ptr<PDBSymbol> getSymbolById(uint32_t SymbolId) const override;
std::unique_ptr<PDBSymbol>
diff --git a/include/llvm/DebugInfo/PDB/IPDBSession.h b/include/llvm/DebugInfo/PDB/IPDBSession.h
index 85d9fe1248599..cf195095c8d22 100644
--- a/include/llvm/DebugInfo/PDB/IPDBSession.h
+++ b/include/llvm/DebugInfo/PDB/IPDBSession.h
@@ -29,7 +29,7 @@ public:
virtual uint64_t getLoadAddress() const = 0;
virtual void setLoadAddress(uint64_t Address) = 0;
- virtual std::unique_ptr<PDBSymbolExe> getGlobalScope() const = 0;
+ virtual std::unique_ptr<PDBSymbolExe> getGlobalScope() = 0;
virtual std::unique_ptr<PDBSymbol> getSymbolById(uint32_t SymbolId) const = 0;
template <typename T>
diff --git a/include/llvm/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.h b/include/llvm/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.h
index a89e26ae943c9..e4cb1b24e30d0 100644
--- a/include/llvm/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.h
+++ b/include/llvm/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.h
@@ -14,6 +14,7 @@
#include "llvm/DebugInfo/CodeView/DebugChecksumsSubsection.h"
#include "llvm/DebugInfo/CodeView/DebugInlineeLinesSubsection.h"
#include "llvm/DebugInfo/CodeView/DebugLinesSubsection.h"
+#include "llvm/DebugInfo/CodeView/DebugSubsectionRecord.h"
#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
#include "llvm/DebugInfo/PDB/Native/RawTypes.h"
#include "llvm/Support/Error.h"
@@ -52,6 +53,9 @@ public:
void
addDebugSubsection(std::shared_ptr<codeview::DebugSubsection> Subsection);
+ void
+ addDebugSubsection(const codeview::DebugSubsectionRecord &SubsectionContents);
+
uint16_t getStreamIndex() const;
StringRef getModuleName() const { return ModuleName; }
StringRef getObjFileName() const { return ObjFileName; }
diff --git a/include/llvm/DebugInfo/PDB/Native/DbiStream.h b/include/llvm/DebugInfo/PDB/Native/DbiStream.h
index 7123e88cd6423..3bf7907266564 100644
--- a/include/llvm/DebugInfo/PDB/Native/DbiStream.h
+++ b/include/llvm/DebugInfo/PDB/Native/DbiStream.h
@@ -63,6 +63,13 @@ public:
PDB_Machine getMachineType() const;
+ BinarySubstreamRef getSectionContributionData() const;
+ BinarySubstreamRef getSecMapSubstreamData() const;
+ BinarySubstreamRef getModiSubstreamData() const;
+ BinarySubstreamRef getFileInfoSubstreamData() const;
+ BinarySubstreamRef getTypeServerMapSubstreamData() const;
+ BinarySubstreamRef getECSubstreamData() const;
+
/// If the given stream type is present, returns its stream index. If it is
/// not present, returns InvalidStreamIndex.
uint32_t getDebugStreamIndex(DbgHeaderType Type) const;
@@ -87,10 +94,12 @@ private:
PDBStringTable ECNames;
- BinaryStreamRef SecContrSubstream;
- BinaryStreamRef SecMapSubstream;
- BinaryStreamRef TypeServerMapSubstream;
- BinaryStreamRef ECSubstream;
+ BinarySubstreamRef SecContrSubstream;
+ BinarySubstreamRef SecMapSubstream;
+ BinarySubstreamRef ModiSubstream;
+ BinarySubstreamRef FileInfoSubstream;
+ BinarySubstreamRef TypeServerMapSubstream;
+ BinarySubstreamRef ECSubstream;
DbiModuleList Modules;
diff --git a/include/llvm/DebugInfo/PDB/Native/DbiStreamBuilder.h b/include/llvm/DebugInfo/PDB/Native/DbiStreamBuilder.h
index aeb2e2ab026a5..744411854181f 100644
--- a/include/llvm/DebugInfo/PDB/Native/DbiStreamBuilder.h
+++ b/include/llvm/DebugInfo/PDB/Native/DbiStreamBuilder.h
@@ -58,6 +58,7 @@ public:
Expected<DbiModuleDescriptorBuilder &> addModuleInfo(StringRef ModuleName);
Error addModuleSourceFile(StringRef Module, StringRef File);
+ Error addModuleSourceFile(DbiModuleDescriptorBuilder &Module, StringRef File);
Expected<uint32_t> getSourceFileNameIndex(StringRef FileName);
Error finalizeMsfLayout();
diff --git a/include/llvm/DebugInfo/PDB/Native/InfoStream.h b/include/llvm/DebugInfo/PDB/Native/InfoStream.h
index fc91fc7097bd4..37bf5f3b573c3 100644
--- a/include/llvm/DebugInfo/PDB/Native/InfoStream.h
+++ b/include/llvm/DebugInfo/PDB/Native/InfoStream.h
@@ -47,6 +47,8 @@ public:
const NamedStreamMap &getNamedStreams() const;
+ BinarySubstreamRef getNamedStreamsBuffer() const;
+
uint32_t getNamedStreamIndex(llvm::StringRef Name) const;
iterator_range<StringMapConstIterator<uint32_t>> named_streams() const;
@@ -71,6 +73,8 @@ private:
// universally unique.
PDB_UniqueId Guid;
+ BinarySubstreamRef SubNamedStreams;
+
std::vector<PdbRaw_FeatureSig> FeatureSignatures;
PdbRaw_Features Features = PdbFeatureNone;
diff --git a/include/llvm/DebugInfo/PDB/Native/ModuleDebugStream.h b/include/llvm/DebugInfo/PDB/Native/ModuleDebugStream.h
index c744696ae2508..5565cd5582bc9 100644
--- a/include/llvm/DebugInfo/PDB/Native/ModuleDebugStream.h
+++ b/include/llvm/DebugInfo/PDB/Native/ModuleDebugStream.h
@@ -41,9 +41,12 @@ public:
iterator_range<codeview::CVSymbolArray::Iterator>
symbols(bool *HadError) const;
- const codeview::CVSymbolArray &getSymbolArray() const {
- return SymbolsSubstream;
- }
+ const codeview::CVSymbolArray &getSymbolArray() const { return SymbolArray; }
+
+ BinarySubstreamRef getSymbolsSubstream() const;
+ BinarySubstreamRef getC11LinesSubstream() const;
+ BinarySubstreamRef getC13LinesSubstream() const;
+ BinarySubstreamRef getGlobalRefsSubstream() const;
ModuleDebugStreamRef &operator=(ModuleDebugStreamRef &&Other) = default;
@@ -63,10 +66,12 @@ private:
std::shared_ptr<msf::MappedBlockStream> Stream;
- codeview::CVSymbolArray SymbolsSubstream;
- BinaryStreamRef C11LinesSubstream;
- BinaryStreamRef C13LinesSubstream;
- BinaryStreamRef GlobalRefsSubstream;
+ codeview::CVSymbolArray SymbolArray;
+
+ BinarySubstreamRef SymbolsSubstream;
+ BinarySubstreamRef C11LinesSubstream;
+ BinarySubstreamRef C13LinesSubstream;
+ BinarySubstreamRef GlobalRefsSubstream;
codeview::DebugSubsectionArray Subsections;
};
diff --git a/include/llvm/DebugInfo/PDB/Native/NativeCompilandSymbol.h b/include/llvm/DebugInfo/PDB/Native/NativeCompilandSymbol.h
index 22ed61910d94a..1687737f0e7f9 100644
--- a/include/llvm/DebugInfo/PDB/Native/NativeCompilandSymbol.h
+++ b/include/llvm/DebugInfo/PDB/Native/NativeCompilandSymbol.h
@@ -18,7 +18,11 @@ namespace pdb {
class NativeCompilandSymbol : public NativeRawSymbol {
public:
- NativeCompilandSymbol(NativeSession &Session, DbiModuleDescriptor MI);
+ NativeCompilandSymbol(NativeSession &Session, uint32_t SymbolId,
+ DbiModuleDescriptor MI);
+
+ std::unique_ptr<NativeRawSymbol> clone() const override;
+
PDB_SymType getSymTag() const override;
bool isEditAndContinueEnabled() const override;
uint32_t getLexicalParentId() const override;
diff --git a/include/llvm/DebugInfo/PDB/Native/NativeExeSymbol.h b/include/llvm/DebugInfo/PDB/Native/NativeExeSymbol.h
index 9516810539b6b..15bac78df191b 100644
--- a/include/llvm/DebugInfo/PDB/Native/NativeExeSymbol.h
+++ b/include/llvm/DebugInfo/PDB/Native/NativeExeSymbol.h
@@ -18,7 +18,9 @@ namespace pdb {
class NativeExeSymbol : public NativeRawSymbol {
public:
- NativeExeSymbol(NativeSession &Session);
+ NativeExeSymbol(NativeSession &Session, uint32_t SymbolId);
+
+ std::unique_ptr<NativeRawSymbol> clone() const override;
std::unique_ptr<IPDBEnumSymbols>
findChildren(PDB_SymType Type) const override;
diff --git a/include/llvm/DebugInfo/PDB/Native/NativeRawSymbol.h b/include/llvm/DebugInfo/PDB/Native/NativeRawSymbol.h
index e1e78035ff389..5e4aaafff1a90 100644
--- a/include/llvm/DebugInfo/PDB/Native/NativeRawSymbol.h
+++ b/include/llvm/DebugInfo/PDB/Native/NativeRawSymbol.h
@@ -19,7 +19,9 @@ class NativeSession;
class NativeRawSymbol : public IPDBRawSymbol {
public:
- explicit NativeRawSymbol(NativeSession &PDBSession);
+ NativeRawSymbol(NativeSession &PDBSession, uint32_t SymbolId);
+
+ virtual std::unique_ptr<NativeRawSymbol> clone() const = 0;
void dump(raw_ostream &OS, int Indent) const override;
@@ -201,6 +203,7 @@ public:
protected:
NativeSession &Session;
+ uint32_t SymbolId;
};
}
diff --git a/include/llvm/DebugInfo/PDB/Native/NativeSession.h b/include/llvm/DebugInfo/PDB/Native/NativeSession.h
index e6da266f796d5..bbe207738e021 100644
--- a/include/llvm/DebugInfo/PDB/Native/NativeSession.h
+++ b/include/llvm/DebugInfo/PDB/Native/NativeSession.h
@@ -32,7 +32,7 @@ public:
uint64_t getLoadAddress() const override;
void setLoadAddress(uint64_t Address) override;
- std::unique_ptr<PDBSymbolExe> getGlobalScope() const override;
+ std::unique_ptr<PDBSymbolExe> getGlobalScope() override;
std::unique_ptr<PDBSymbol> getSymbolById(uint32_t SymbolId) const override;
std::unique_ptr<PDBSymbol>
diff --git a/include/llvm/DebugInfo/PDB/Native/PDBFile.h b/include/llvm/DebugInfo/PDB/Native/PDBFile.h
index 4d3c569c3cdfb..4f6ad115e7dfd 100644
--- a/include/llvm/DebugInfo/PDB/Native/PDBFile.h
+++ b/include/llvm/DebugInfo/PDB/Native/PDBFile.h
@@ -13,6 +13,7 @@
#include "llvm/ADT/DenseMap.h"
#include "llvm/DebugInfo/MSF/IMSFFile.h"
#include "llvm/DebugInfo/MSF/MSFCommon.h"
+#include "llvm/DebugInfo/MSF/MSFStreamLayout.h"
#include "llvm/Support/Allocator.h"
#include "llvm/Support/BinaryStreamRef.h"
#include "llvm/Support/Endian.h"
@@ -85,6 +86,8 @@ public:
ArrayRef<support::ulittle32_t> getDirectoryBlockArray() const;
+ msf::MSFStreamLayout getStreamLayout(uint32_t StreamIdx) const;
+
Error parseFileHeaders();
Error parseStreamData();
diff --git a/include/llvm/DebugInfo/PDB/Native/TpiStream.h b/include/llvm/DebugInfo/PDB/Native/TpiStream.h
index 0ee697696ca54..d3475205a6c26 100644
--- a/include/llvm/DebugInfo/PDB/Native/TpiStream.h
+++ b/include/llvm/DebugInfo/PDB/Native/TpiStream.h
@@ -16,6 +16,7 @@
#include "llvm/DebugInfo/PDB/Native/RawTypes.h"
#include "llvm/DebugInfo/PDB/PDBTypes.h"
#include "llvm/Support/BinaryStreamArray.h"
+#include "llvm/Support/BinaryStreamRef.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/Error.h"
@@ -57,6 +58,8 @@ public:
codeview::LazyRandomTypeCollection &typeCollection() { return *Types; }
+ BinarySubstreamRef getTypeRecordsSubstream() const;
+
Error commit();
private:
@@ -65,6 +68,8 @@ private:
std::unique_ptr<codeview::LazyRandomTypeCollection> Types;
+ BinarySubstreamRef TypeRecordsSubstream;
+
codeview::CVTypeArray TypeRecords;
std::unique_ptr<BinaryStream> HashStream;
diff --git a/include/llvm/DebugInfo/Symbolize/SymbolizableModule.h b/include/llvm/DebugInfo/Symbolize/SymbolizableModule.h
index e0bec6f6cf859..e576a91e887cc 100644
--- a/include/llvm/DebugInfo/Symbolize/SymbolizableModule.h
+++ b/include/llvm/DebugInfo/Symbolize/SymbolizableModule.h
@@ -1,4 +1,4 @@
-//===-- SymbolizableModule.h ------------------------------------ C++ -----===//
+//===- SymbolizableModule.h -------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -14,12 +14,7 @@
#define LLVM_DEBUGINFO_SYMBOLIZE_SYMBOLIZABLEMODULE_H
#include "llvm/DebugInfo/DIContext.h"
-
-namespace llvm {
-namespace object {
-class ObjectFile;
-}
-}
+#include <cstdint>
namespace llvm {
namespace symbolize {
@@ -28,7 +23,8 @@ using FunctionNameKind = DILineInfoSpecifier::FunctionNameKind;
class SymbolizableModule {
public:
- virtual ~SymbolizableModule() {}
+ virtual ~SymbolizableModule() = default;
+
virtual DILineInfo symbolizeCode(uint64_t ModuleOffset,
FunctionNameKind FNKind,
bool UseSymbolTable) const = 0;
@@ -45,7 +41,7 @@ public:
virtual uint64_t getModulePreferredBase() const = 0;
};
-} // namespace symbolize
-} // namespace llvm
+} // end namespace symbolize
+} // end namespace llvm
#endif // LLVM_DEBUGINFO_SYMBOLIZE_SYMBOLIZABLEMODULE_H
diff --git a/include/llvm/DebugInfo/Symbolize/Symbolize.h b/include/llvm/DebugInfo/Symbolize/Symbolize.h
index 5103cc03a6bdb..d98d49b24bca2 100644
--- a/include/llvm/DebugInfo/Symbolize/Symbolize.h
+++ b/include/llvm/DebugInfo/Symbolize/Symbolize.h
@@ -1,4 +1,4 @@
-//===-- Symbolize.h --------------------------------------------- C++ -----===//
+//===- Symbolize.h ----------------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -10,21 +10,27 @@
// Header for LLVM symbolization library.
//
//===----------------------------------------------------------------------===//
+
#ifndef LLVM_DEBUGINFO_SYMBOLIZE_SYMBOLIZE_H
#define LLVM_DEBUGINFO_SYMBOLIZE_SYMBOLIZE_H
#include "llvm/DebugInfo/Symbolize/SymbolizableModule.h"
+#include "llvm/Object/Binary.h"
#include "llvm/Object/ObjectFile.h"
-#include "llvm/Support/ErrorOr.h"
+#include "llvm/Support/Error.h"
+#include <algorithm>
+#include <cstdint>
#include <map>
#include <memory>
#include <string>
#include <utility>
+#include <vector>
namespace llvm {
namespace symbolize {
using namespace object;
+
using FunctionNameKind = DILineInfoSpecifier::FunctionNameKind;
class LLVMSymbolizer {
@@ -36,6 +42,7 @@ public:
bool RelativeAddresses : 1;
std::string DefaultArch;
std::vector<std::string> DsymHints;
+
Options(FunctionNameKind PrintFunctions = FunctionNameKind::LinkageName,
bool UseSymbolTable = true, bool Demangle = true,
bool RelativeAddresses = false, std::string DefaultArch = "")
@@ -45,6 +52,7 @@ public:
};
LLVMSymbolizer(const Options &Opts = Options()) : Opts(Opts) {}
+
~LLVMSymbolizer() {
flush();
}
@@ -56,6 +64,7 @@ public:
Expected<DIGlobal> symbolizeData(const std::string &ModuleName,
uint64_t ModuleOffset);
void flush();
+
static std::string
DemangleName(const std::string &Name,
const SymbolizableModule *DbiModuleDescriptor);
@@ -63,7 +72,7 @@ public:
private:
// Bundles together object file with code/data and object file with
// corresponding debug info. These objects can be the same.
- typedef std::pair<ObjectFile*, ObjectFile*> ObjectPair;
+ using ObjectPair = std::pair<ObjectFile *, ObjectFile *>;
/// Returns a SymbolizableModule or an error if loading debug info failed.
/// Only one attempt is made to load a module, and errors during loading are
@@ -106,7 +115,7 @@ private:
Options Opts;
};
-} // namespace symbolize
-} // namespace llvm
+} // end namespace symbolize
+} // end namespace llvm
-#endif
+#endif // LLVM_DEBUGINFO_SYMBOLIZE_SYMBOLIZE_H