summaryrefslogtreecommitdiff
path: root/include/llvm/DebugInfo
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/DebugInfo')
-rw-r--r--include/llvm/DebugInfo/CodeView/CVRecord.h6
-rw-r--r--include/llvm/DebugInfo/CodeView/CodeView.h18
-rw-r--r--include/llvm/DebugInfo/CodeView/DebugChecksumsSubsection.h4
-rw-r--r--include/llvm/DebugInfo/CodeView/DebugCrossExSubsection.h64
-rw-r--r--include/llvm/DebugInfo/CodeView/DebugCrossImpSubsection.h88
-rw-r--r--include/llvm/DebugInfo/CodeView/DebugInlineeLinesSubsection.h7
-rw-r--r--include/llvm/DebugInfo/CodeView/DebugLinesSubsection.h10
-rw-r--r--include/llvm/DebugInfo/CodeView/DebugStringTableSubsection.h3
-rw-r--r--include/llvm/DebugInfo/CodeView/DebugSubsectionRecord.h14
-rw-r--r--include/llvm/DebugInfo/CodeView/DebugSubsectionVisitor.h128
-rw-r--r--include/llvm/DebugInfo/CodeView/DebugSymbolRVASubsection.h59
-rw-r--r--include/llvm/DebugInfo/CodeView/DebugSymbolsSubsection.h3
-rw-r--r--include/llvm/DebugInfo/CodeView/EnumTables.h2
-rw-r--r--include/llvm/DebugInfo/CodeView/TypeSerializer.h2
-rw-r--r--include/llvm/DebugInfo/CodeView/TypeTableBuilder.h5
-rw-r--r--include/llvm/DebugInfo/DIContext.h2
-rw-r--r--include/llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h4
-rw-r--r--include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h2
-rw-r--r--include/llvm/DebugInfo/DWARF/DWARFAttribute.h2
-rw-r--r--include/llvm/DebugInfo/DWARF/DWARFCompileUnit.h6
-rw-r--r--include/llvm/DebugInfo/DWARF/DWARFContext.h35
-rw-r--r--include/llvm/DebugInfo/DWARF/DWARFDebugInfoEntry.h2
-rw-r--r--include/llvm/DebugInfo/DWARF/DWARFDebugPubTable.h2
-rw-r--r--include/llvm/DebugInfo/DWARF/DWARFDebugRangeList.h2
-rw-r--r--include/llvm/DebugInfo/DWARF/DWARFDie.h7
-rw-r--r--include/llvm/DebugInfo/DWARF/DWARFFormValue.h2
-rw-r--r--include/llvm/DebugInfo/DWARF/DWARFTypeUnit.h2
-rw-r--r--include/llvm/DebugInfo/DWARF/DWARFUnit.h32
-rw-r--r--include/llvm/DebugInfo/MSF/MappedBlockStream.h1
-rw-r--r--include/llvm/DebugInfo/PDB/DIA/DIAEnumDebugStreams.h1
-rw-r--r--include/llvm/DebugInfo/PDB/DIA/DIAEnumLineNumbers.h1
-rw-r--r--include/llvm/DebugInfo/PDB/DIA/DIAEnumSourceFiles.h1
-rw-r--r--include/llvm/DebugInfo/PDB/DIA/DIAEnumSymbols.h1
-rw-r--r--include/llvm/DebugInfo/PDB/Native/DbiModuleDescriptor.h5
-rw-r--r--include/llvm/DebugInfo/PDB/Native/DbiStream.h3
-rw-r--r--include/llvm/DebugInfo/PDB/PDBSymbol.h4
36 files changed, 449 insertions, 81 deletions
diff --git a/include/llvm/DebugInfo/CodeView/CVRecord.h b/include/llvm/DebugInfo/CodeView/CVRecord.h
index 68ad09982202..4c6bbedc6bbd 100644
--- a/include/llvm/DebugInfo/CodeView/CVRecord.h
+++ b/include/llvm/DebugInfo/CodeView/CVRecord.h
@@ -62,10 +62,8 @@ template <typename Kind> struct RemappedRecord {
template <typename Kind>
struct VarStreamArrayExtractor<codeview::CVRecord<Kind>> {
- typedef void ContextType;
-
- static Error extract(BinaryStreamRef Stream, uint32_t &Len,
- codeview::CVRecord<Kind> &Item) {
+ Error operator()(BinaryStreamRef Stream, uint32_t &Len,
+ codeview::CVRecord<Kind> &Item) {
using namespace codeview;
const RecordPrefix *Prefix = nullptr;
BinaryStreamReader Reader(Stream);
diff --git a/include/llvm/DebugInfo/CodeView/CodeView.h b/include/llvm/DebugInfo/CodeView/CodeView.h
index 9890263ae2d2..251c9d1ae62c 100644
--- a/include/llvm/DebugInfo/CodeView/CodeView.h
+++ b/include/llvm/DebugInfo/CodeView/CodeView.h
@@ -575,6 +575,24 @@ struct FrameData {
};
};
+// Corresponds to LocalIdAndGlobalIdPair structure.
+// This structure information allows cross-referencing between PDBs. For
+// example, when a PDB is being built during compilation it is not yet known
+// what other modules may end up in the PDB at link time. So certain types of
+// IDs may clash between the various compile time PDBs. For each affected
+// module, a subsection would be put into the PDB containing a mapping from its
+// local IDs to a single ID namespace for all items in the PDB file.
+struct CrossModuleExport {
+ support::ulittle32_t Local;
+ support::ulittle32_t Global;
+};
+
+struct CrossModuleImport {
+ support::ulittle32_t ModuleNameOffset;
+ support::ulittle32_t Count; // Number of elements
+ // support::ulittle32_t ids[Count]; // id from referenced module
+};
+
enum class CodeViewContainer { ObjectFile, Pdb };
inline uint32_t alignOf(CodeViewContainer Container) {
diff --git a/include/llvm/DebugInfo/CodeView/DebugChecksumsSubsection.h b/include/llvm/DebugInfo/CodeView/DebugChecksumsSubsection.h
index c958a95ee6de..9fc90f13d347 100644
--- a/include/llvm/DebugInfo/CodeView/DebugChecksumsSubsection.h
+++ b/include/llvm/DebugInfo/CodeView/DebugChecksumsSubsection.h
@@ -36,8 +36,8 @@ template <> struct VarStreamArrayExtractor<codeview::FileChecksumEntry> {
public:
typedef void ContextType;
- static Error extract(BinaryStreamRef Stream, uint32_t &Len,
- codeview::FileChecksumEntry &Item);
+ Error operator()(BinaryStreamRef Stream, uint32_t &Len,
+ codeview::FileChecksumEntry &Item);
};
}
diff --git a/include/llvm/DebugInfo/CodeView/DebugCrossExSubsection.h b/include/llvm/DebugInfo/CodeView/DebugCrossExSubsection.h
new file mode 100644
index 000000000000..f755b23422c7
--- /dev/null
+++ b/include/llvm/DebugInfo/CodeView/DebugCrossExSubsection.h
@@ -0,0 +1,64 @@
+//===- DebugCrossExSubsection.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_DEBUGCROSSEXSUBSECTION_H
+#define LLVM_DEBUGINFO_CODEVIEW_DEBUGCROSSEXSUBSECTION_H
+
+#include "llvm/DebugInfo/CodeView/DebugSubsection.h"
+#include "llvm/Support/BinaryStreamArray.h"
+#include "llvm/Support/BinaryStreamReader.h"
+#include "llvm/Support/Endian.h"
+
+#include <map>
+
+namespace llvm {
+namespace codeview {
+class DebugCrossModuleExportsSubsectionRef final : public DebugSubsectionRef {
+ typedef FixedStreamArray<CrossModuleExport> ReferenceArray;
+ typedef ReferenceArray::Iterator Iterator;
+
+public:
+ DebugCrossModuleExportsSubsectionRef()
+ : DebugSubsectionRef(DebugSubsectionKind::CrossScopeExports) {}
+
+ static bool classof(const DebugSubsectionRef *S) {
+ return S->kind() == DebugSubsectionKind::CrossScopeExports;
+ }
+
+ Error initialize(BinaryStreamReader Reader);
+ Error initialize(BinaryStreamRef Stream);
+
+ Iterator begin() const { return References.begin(); }
+ Iterator end() const { return References.end(); }
+
+private:
+ FixedStreamArray<CrossModuleExport> References;
+};
+
+class DebugCrossModuleExportsSubsection final : public DebugSubsection {
+public:
+ DebugCrossModuleExportsSubsection()
+ : DebugSubsection(DebugSubsectionKind::CrossScopeExports) {}
+
+ static bool classof(const DebugSubsection *S) {
+ return S->kind() == DebugSubsectionKind::CrossScopeExports;
+ }
+
+ void addMapping(uint32_t Local, uint32_t Global);
+
+ uint32_t calculateSerializedSize() const override;
+ Error commit(BinaryStreamWriter &Writer) const override;
+
+private:
+ std::map<uint32_t, uint32_t> Mappings;
+};
+}
+}
+
+#endif
diff --git a/include/llvm/DebugInfo/CodeView/DebugCrossImpSubsection.h b/include/llvm/DebugInfo/CodeView/DebugCrossImpSubsection.h
new file mode 100644
index 000000000000..ea3a9a43d50b
--- /dev/null
+++ b/include/llvm/DebugInfo/CodeView/DebugCrossImpSubsection.h
@@ -0,0 +1,88 @@
+//===- DebugCrossExSubsection.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_DEBUGCROSSIMPSUBSECTION_H
+#define LLVM_DEBUGINFO_CODEVIEW_DEBUGCROSSIMPSUBSECTION_H
+
+#include "llvm/ADT/StringMap.h"
+#include "llvm/DebugInfo/CodeView/DebugSubsection.h"
+#include "llvm/Support/BinaryStreamArray.h"
+#include "llvm/Support/BinaryStreamReader.h"
+#include "llvm/Support/Endian.h"
+
+namespace llvm {
+namespace codeview {
+
+struct CrossModuleImportItem {
+ const CrossModuleImport *Header = nullptr;
+ llvm::FixedStreamArray<support::ulittle32_t> Imports;
+};
+}
+}
+
+namespace llvm {
+template <> struct VarStreamArrayExtractor<codeview::CrossModuleImportItem> {
+public:
+ typedef void ContextType;
+
+ Error operator()(BinaryStreamRef Stream, uint32_t &Len,
+ codeview::CrossModuleImportItem &Item);
+};
+}
+
+namespace llvm {
+namespace codeview {
+class DebugStringTableSubsection;
+
+class DebugCrossModuleImportsSubsectionRef final : public DebugSubsectionRef {
+ typedef VarStreamArray<CrossModuleImportItem> ReferenceArray;
+ typedef ReferenceArray::Iterator Iterator;
+
+public:
+ DebugCrossModuleImportsSubsectionRef()
+ : DebugSubsectionRef(DebugSubsectionKind::CrossScopeImports) {}
+
+ static bool classof(const DebugSubsectionRef *S) {
+ return S->kind() == DebugSubsectionKind::CrossScopeImports;
+ }
+
+ Error initialize(BinaryStreamReader Reader);
+ Error initialize(BinaryStreamRef Stream);
+
+ Iterator begin() const { return References.begin(); }
+ Iterator end() const { return References.end(); }
+
+private:
+ ReferenceArray References;
+};
+
+class DebugCrossModuleImportsSubsection final : public DebugSubsection {
+public:
+ explicit DebugCrossModuleImportsSubsection(
+ DebugStringTableSubsection &Strings)
+ : DebugSubsection(DebugSubsectionKind::CrossScopeImports),
+ Strings(Strings) {}
+
+ static bool classof(const DebugSubsection *S) {
+ return S->kind() == DebugSubsectionKind::CrossScopeImports;
+ }
+
+ void addImport(StringRef Module, uint32_t ImportId);
+
+ uint32_t calculateSerializedSize() const override;
+ Error commit(BinaryStreamWriter &Writer) const override;
+
+private:
+ DebugStringTableSubsection &Strings;
+ StringMap<std::vector<support::ulittle32_t>> Mappings;
+};
+}
+}
+
+#endif
diff --git a/include/llvm/DebugInfo/CodeView/DebugInlineeLinesSubsection.h b/include/llvm/DebugInfo/CodeView/DebugInlineeLinesSubsection.h
index 60440700c265..c9b062717baa 100644
--- a/include/llvm/DebugInfo/CodeView/DebugInlineeLinesSubsection.h
+++ b/include/llvm/DebugInfo/CodeView/DebugInlineeLinesSubsection.h
@@ -43,10 +43,9 @@ struct InlineeSourceLine {
}
template <> struct VarStreamArrayExtractor<codeview::InlineeSourceLine> {
- typedef bool ContextType;
-
- static Error extract(BinaryStreamRef Stream, uint32_t &Len,
- codeview::InlineeSourceLine &Item, bool HasExtraFiles);
+ Error operator()(BinaryStreamRef Stream, uint32_t &Len,
+ codeview::InlineeSourceLine &Item);
+ bool HasExtraFiles = false;
};
namespace codeview {
diff --git a/include/llvm/DebugInfo/CodeView/DebugLinesSubsection.h b/include/llvm/DebugInfo/CodeView/DebugLinesSubsection.h
index 1b63af59c2ed..f1feb1336cc5 100644
--- a/include/llvm/DebugInfo/CodeView/DebugLinesSubsection.h
+++ b/include/llvm/DebugInfo/CodeView/DebugLinesSubsection.h
@@ -64,10 +64,10 @@ struct LineColumnEntry {
class LineColumnExtractor {
public:
- typedef const LineFragmentHeader *ContextType;
+ Error operator()(BinaryStreamRef Stream, uint32_t &Len,
+ LineColumnEntry &Item);
- static Error extract(BinaryStreamRef Stream, uint32_t &Len,
- LineColumnEntry &Item, const LineFragmentHeader *Ctx);
+ const LineFragmentHeader *Header = nullptr;
};
class DebugLinesSubsectionRef final : public DebugSubsectionRef {
@@ -122,7 +122,7 @@ public:
uint32_t calculateSerializedSize() const override;
Error commit(BinaryStreamWriter &Writer) const override;
- void setRelocationAddress(uint16_t Segment, uint16_t Offset);
+ void setRelocationAddress(uint16_t Segment, uint32_t Offset);
void setCodeSize(uint32_t Size);
void setFlags(LineFlags Flags);
@@ -131,7 +131,7 @@ public:
private:
DebugChecksumsSubsection &Checksums;
- uint16_t RelocOffset = 0;
+ uint32_t RelocOffset = 0;
uint16_t RelocSegment = 0;
uint32_t CodeSize = 0;
LineFlags Flags = LF_None;
diff --git a/include/llvm/DebugInfo/CodeView/DebugStringTableSubsection.h b/include/llvm/DebugInfo/CodeView/DebugStringTableSubsection.h
index fbe39cb16f09..be0a2344965b 100644
--- a/include/llvm/DebugInfo/CodeView/DebugStringTableSubsection.h
+++ b/include/llvm/DebugInfo/CodeView/DebugStringTableSubsection.h
@@ -39,11 +39,14 @@ public:
}
Error initialize(BinaryStreamRef Contents);
+ Error initialize(BinaryStreamReader &Reader);
Expected<StringRef> getString(uint32_t Offset) const;
bool valid() const { return Stream.valid(); }
+ BinaryStreamRef getBuffer() const { return Stream; }
+
private:
BinaryStreamRef Stream;
};
diff --git a/include/llvm/DebugInfo/CodeView/DebugSubsectionRecord.h b/include/llvm/DebugInfo/CodeView/DebugSubsectionRecord.h
index 847259c5ceac..49a269d92e35 100644
--- a/include/llvm/DebugInfo/CodeView/DebugSubsectionRecord.h
+++ b/include/llvm/DebugInfo/CodeView/DebugSubsectionRecord.h
@@ -52,7 +52,7 @@ public:
DebugSubsectionRecordBuilder(std::unique_ptr<DebugSubsection> Subsection,
CodeViewContainer Container);
uint32_t calculateSerializedLength();
- Error commit(BinaryStreamWriter &Writer);
+ Error commit(BinaryStreamWriter &Writer) const;
private:
std::unique_ptr<DebugSubsection> Subsection;
@@ -62,18 +62,12 @@ private:
} // namespace codeview
template <> struct VarStreamArrayExtractor<codeview::DebugSubsectionRecord> {
- typedef void ContextType;
-
- static Error extract(BinaryStreamRef Stream, uint32_t &Length,
- codeview::DebugSubsectionRecord &Info) {
- // FIXME: We need to pass the container type through to this function, but
- // VarStreamArray doesn't easily support stateful contexts. In practice
- // this isn't super important since the subsection header describes its
- // length and we can just skip it. It's more important when writing.
+ Error operator()(BinaryStreamRef Stream, uint32_t &Length,
+ codeview::DebugSubsectionRecord &Info) {
if (auto EC = codeview::DebugSubsectionRecord::initialize(
Stream, Info, codeview::CodeViewContainer::Pdb))
return EC;
- Length = Info.getRecordLength();
+ Length = alignTo(Info.getRecordLength(), 4);
return Error::success();
}
};
diff --git a/include/llvm/DebugInfo/CodeView/DebugSubsectionVisitor.h b/include/llvm/DebugInfo/CodeView/DebugSubsectionVisitor.h
index 55bef491c97e..d4a3d9195a36 100644
--- a/include/llvm/DebugInfo/CodeView/DebugSubsectionVisitor.h
+++ b/include/llvm/DebugInfo/CodeView/DebugSubsectionVisitor.h
@@ -10,6 +10,8 @@
#ifndef LLVM_DEBUGINFO_CODEVIEW_MODULEDEBUGFRAGMENTVISITOR_H
#define LLVM_DEBUGINFO_CODEVIEW_MODULEDEBUGFRAGMENTVISITOR_H
+#include "llvm/DebugInfo/CodeView/CodeView.h"
+#include "llvm/DebugInfo/CodeView/DebugSubsectionRecord.h"
#include "llvm/Support/Error.h"
#include <cstdint>
@@ -20,9 +22,65 @@ namespace codeview {
class DebugChecksumsSubsectionRef;
class DebugSubsectionRecord;
class DebugInlineeLinesSubsectionRef;
+class DebugCrossModuleExportsSubsectionRef;
+class DebugCrossModuleImportsSubsectionRef;
+class DebugFrameDataSubsectionRef;
class DebugLinesSubsectionRef;
+class DebugStringTableSubsectionRef;
+class DebugSymbolRVASubsectionRef;
+class DebugSymbolsSubsectionRef;
class DebugUnknownSubsectionRef;
+struct DebugSubsectionState {
+public:
+ // If no subsections are known about initially, we find as much as we can.
+ DebugSubsectionState();
+
+ // If only a string table subsection is given, we find a checksums subsection.
+ explicit DebugSubsectionState(const DebugStringTableSubsectionRef &Strings);
+
+ // If both subsections are given, we don't need to find anything.
+ DebugSubsectionState(const DebugStringTableSubsectionRef &Strings,
+ const DebugChecksumsSubsectionRef &Checksums);
+
+ template <typename T> void initialize(T &&FragmentRange) {
+ for (const DebugSubsectionRecord &R : FragmentRange) {
+ if (Strings && Checksums)
+ return;
+ if (R.kind() == DebugSubsectionKind::FileChecksums) {
+ initializeChecksums(R);
+ continue;
+ }
+ if (R.kind() == DebugSubsectionKind::StringTable && !Strings) {
+ // While in practice we should never encounter a string table even
+ // though the string table is already initialized, in theory it's
+ // possible. PDBs are supposed to have one global string table and
+ // then this subsection should not appear. Whereas object files are
+ // supposed to have this subsection appear exactly once. However,
+ // for testing purposes it's nice to be able to test this subsection
+ // independently of one format or the other, so for some tests we
+ // manually construct a PDB that contains this subsection in addition
+ // to a global string table.
+ initializeStrings(R);
+ continue;
+ }
+ }
+ }
+
+ const DebugStringTableSubsectionRef &strings() const { return *Strings; }
+ const DebugChecksumsSubsectionRef &checksums() const { return *Checksums; }
+
+private:
+ void initializeStrings(const DebugSubsectionRecord &SR);
+ void initializeChecksums(const DebugSubsectionRecord &FCR);
+
+ std::unique_ptr<DebugStringTableSubsectionRef> OwnedStrings;
+ std::unique_ptr<DebugChecksumsSubsectionRef> OwnedChecksums;
+
+ const DebugStringTableSubsectionRef *Strings = nullptr;
+ const DebugChecksumsSubsectionRef *Checksums = nullptr;
+};
+
class DebugSubsectionVisitor {
public:
virtual ~DebugSubsectionVisitor() = default;
@@ -30,34 +88,72 @@ public:
virtual Error visitUnknown(DebugUnknownSubsectionRef &Unknown) {
return Error::success();
}
- virtual Error visitLines(DebugLinesSubsectionRef &Lines) {
- return Error::success();
- }
+ virtual Error visitLines(DebugLinesSubsectionRef &Lines,
+ const DebugSubsectionState &State) = 0;
+ virtual Error visitFileChecksums(DebugChecksumsSubsectionRef &Checksums,
+ const DebugSubsectionState &State) = 0;
+ virtual Error visitInlineeLines(DebugInlineeLinesSubsectionRef &Inlinees,
+ const DebugSubsectionState &State) = 0;
+ virtual Error
+ visitCrossModuleExports(DebugCrossModuleExportsSubsectionRef &CSE,
+ const DebugSubsectionState &State) = 0;
+ virtual Error
+ visitCrossModuleImports(DebugCrossModuleImportsSubsectionRef &CSE,
+ const DebugSubsectionState &State) = 0;
- virtual Error visitFileChecksums(DebugChecksumsSubsectionRef &Checksums) {
- return Error::success();
- }
+ virtual Error visitStringTable(DebugStringTableSubsectionRef &ST,
+ const DebugSubsectionState &State) = 0;
- virtual Error visitInlineeLines(DebugInlineeLinesSubsectionRef &Inlinees) {
- return Error::success();
- }
+ virtual Error visitSymbols(DebugSymbolsSubsectionRef &CSE,
+ const DebugSubsectionState &State) = 0;
- virtual Error finished() { return Error::success(); }
+ virtual Error visitFrameData(DebugFrameDataSubsectionRef &FD,
+ const DebugSubsectionState &State) = 0;
+ virtual Error visitCOFFSymbolRVAs(DebugSymbolRVASubsectionRef &RVAs,
+ const DebugSubsectionState &State) = 0;
};
Error visitDebugSubsection(const DebugSubsectionRecord &R,
- DebugSubsectionVisitor &V);
+ DebugSubsectionVisitor &V,
+ const DebugSubsectionState &State);
+namespace detail {
template <typename T>
-Error visitDebugSubsections(T &&FragmentRange, DebugSubsectionVisitor &V) {
- for (const auto &L : FragmentRange) {
- if (auto EC = visitDebugSubsection(L, V))
+Error visitDebugSubsections(T &&FragmentRange, DebugSubsectionVisitor &V,
+ DebugSubsectionState &State) {
+ State.initialize(std::forward<T>(FragmentRange));
+
+ for (const DebugSubsectionRecord &L : FragmentRange) {
+ if (auto EC = visitDebugSubsection(L, V, State))
return EC;
}
- if (auto EC = V.finished())
- return EC;
return Error::success();
}
+} // namespace detail
+
+template <typename T>
+Error visitDebugSubsections(T &&FragmentRange, DebugSubsectionVisitor &V) {
+ DebugSubsectionState State;
+ return detail::visitDebugSubsections(std::forward<T>(FragmentRange), V,
+ State);
+}
+
+template <typename T>
+Error visitDebugSubsections(T &&FragmentRange, DebugSubsectionVisitor &V,
+ const DebugStringTableSubsectionRef &Strings) {
+ DebugSubsectionState State(Strings);
+ return detail::visitDebugSubsections(std::forward<T>(FragmentRange), V,
+ State);
+}
+
+template <typename T>
+Error visitDebugSubsections(T &&FragmentRange, DebugSubsectionVisitor &V,
+ const DebugStringTableSubsectionRef &Strings,
+ const DebugChecksumsSubsectionRef &Checksums) {
+ DebugSubsectionState State(Strings, Checksums);
+ return detail::visitDebugSubsections(std::forward<T>(FragmentRange), V,
+ State);
+}
} // end namespace codeview
diff --git a/include/llvm/DebugInfo/CodeView/DebugSymbolRVASubsection.h b/include/llvm/DebugInfo/CodeView/DebugSymbolRVASubsection.h
new file mode 100644
index 000000000000..ad58a293cb09
--- /dev/null
+++ b/include/llvm/DebugInfo/CodeView/DebugSymbolRVASubsection.h
@@ -0,0 +1,59 @@
+//===- DebugSymbolRVASubsection.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_DEBUGSYMBOLRVASUBSECTION_H
+#define LLVM_DEBUGINFO_CODEVIEW_DEBUGSYMBOLRVASUBSECTION_H
+
+#include "llvm/DebugInfo/CodeView/DebugSubsection.h"
+#include "llvm/Support/BinaryStreamArray.h"
+#include "llvm/Support/BinaryStreamReader.h"
+#include "llvm/Support/Error.h"
+
+namespace llvm {
+namespace codeview {
+
+class DebugSymbolRVASubsectionRef final : public DebugSubsectionRef {
+public:
+ typedef FixedStreamArray<support::ulittle32_t> ArrayType;
+
+ DebugSymbolRVASubsectionRef();
+
+ static bool classof(const DebugSubsectionRef *S) {
+ return S->kind() == DebugSubsectionKind::CoffSymbolRVA;
+ }
+
+ ArrayType::Iterator begin() const { return RVAs.begin(); }
+ ArrayType::Iterator end() const { return RVAs.end(); }
+
+ Error initialize(BinaryStreamReader &Reader);
+
+private:
+ ArrayType RVAs;
+};
+
+class DebugSymbolRVASubsection final : public DebugSubsection {
+public:
+ DebugSymbolRVASubsection();
+
+ static bool classof(const DebugSubsection *S) {
+ return S->kind() == DebugSubsectionKind::CoffSymbolRVA;
+ }
+
+ Error commit(BinaryStreamWriter &Writer) const override;
+ uint32_t calculateSerializedSize() const override;
+
+ void addRVA(uint32_t RVA) { RVAs.push_back(support::ulittle32_t(RVA)); }
+
+private:
+ std::vector<support::ulittle32_t> RVAs;
+};
+} // namespace codeview
+} // namespace llvm
+
+#endif
diff --git a/include/llvm/DebugInfo/CodeView/DebugSymbolsSubsection.h b/include/llvm/DebugInfo/CodeView/DebugSymbolsSubsection.h
index 3d1eb27ba270..dfda7deb6cb4 100644
--- a/include/llvm/DebugInfo/CodeView/DebugSymbolsSubsection.h
+++ b/include/llvm/DebugInfo/CodeView/DebugSymbolsSubsection.h
@@ -27,6 +27,9 @@ public:
Error initialize(BinaryStreamReader Reader);
+ CVSymbolArray::Iterator begin() const { return Records.begin(); }
+ CVSymbolArray::Iterator end() const { return Records.end(); }
+
private:
CVSymbolArray Records;
};
diff --git a/include/llvm/DebugInfo/CodeView/EnumTables.h b/include/llvm/DebugInfo/CodeView/EnumTables.h
index 10d1c581a196..013e440613fc 100644
--- a/include/llvm/DebugInfo/CodeView/EnumTables.h
+++ b/include/llvm/DebugInfo/CodeView/EnumTables.h
@@ -11,8 +11,8 @@
#define LLVM_DEBUGINFO_CODEVIEW_ENUMTABLES_H
#include "llvm/ADT/ArrayRef.h"
+#include "llvm/BinaryFormat/COFF.h"
#include "llvm/DebugInfo/CodeView/CodeView.h"
-#include "llvm/Support/COFF.h"
#include "llvm/Support/ScopedPrinter.h"
#include <stdint.h>
diff --git a/include/llvm/DebugInfo/CodeView/TypeSerializer.h b/include/llvm/DebugInfo/CodeView/TypeSerializer.h
index 1dee86a1da79..f785d4509547 100644
--- a/include/llvm/DebugInfo/CodeView/TypeSerializer.h
+++ b/include/llvm/DebugInfo/CodeView/TypeSerializer.h
@@ -86,6 +86,8 @@ public:
void reset();
+ BumpPtrAllocator &getAllocator() { return RecordStorage; }
+
ArrayRef<ArrayRef<uint8_t>> records() const;
TypeIndex insertRecordBytes(ArrayRef<uint8_t> &Record);
TypeIndex insertRecord(const RemappedType &Record);
diff --git a/include/llvm/DebugInfo/CodeView/TypeTableBuilder.h b/include/llvm/DebugInfo/CodeView/TypeTableBuilder.h
index 907ed1010e5b..1069dcd45334 100644
--- a/include/llvm/DebugInfo/CodeView/TypeTableBuilder.h
+++ b/include/llvm/DebugInfo/CodeView/TypeTableBuilder.h
@@ -37,8 +37,9 @@ private:
TypeSerializer Serializer;
public:
- explicit TypeTableBuilder(BumpPtrAllocator &Allocator)
- : Allocator(Allocator), Serializer(Allocator) {}
+ explicit TypeTableBuilder(BumpPtrAllocator &Allocator,
+ bool WriteUnique = true)
+ : Allocator(Allocator), Serializer(Allocator, WriteUnique) {}
TypeTableBuilder(const TypeTableBuilder &) = delete;
TypeTableBuilder &operator=(const TypeTableBuilder &) = delete;
diff --git a/include/llvm/DebugInfo/DIContext.h b/include/llvm/DebugInfo/DIContext.h
index 2ab1c9508522..2e82a774cc23 100644
--- a/include/llvm/DebugInfo/DIContext.h
+++ b/include/llvm/DebugInfo/DIContext.h
@@ -135,6 +135,7 @@ enum DIDumpType {
DIDT_GnuPubnames,
DIDT_GnuPubtypes,
DIDT_Str,
+ DIDT_StrOffsets,
DIDT_StrDwo,
DIDT_StrOffsetsDwo,
DIDT_AppleNames,
@@ -152,6 +153,7 @@ struct DIDumpOptions {
DIDumpType DumpType = DIDT_All;
bool DumpEH = false;
bool SummarizeTypes = false;
+ bool Brief = false;
};
class DIContext {
diff --git a/include/llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h b/include/llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h
index 7324f6e3eb38..e363cff15803 100644
--- a/include/llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h
+++ b/include/llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h
@@ -10,11 +10,11 @@
#ifndef LLVM_DEBUGINFO_DWARFABBREVIATIONDECLARATION_H
#define LLVM_DEBUGINFO_DWARFABBREVIATIONDECLARATION_H
-#include "llvm/ADT/iterator_range.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/iterator_range.h"
+#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/Support/DataExtractor.h"
-#include "llvm/Support/Dwarf.h"
#include <cassert>
#include <cstddef>
#include <cstdint>
diff --git a/include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h b/include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h
index f95a013d7552..72793e97b60d 100644
--- a/include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h
+++ b/include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h
@@ -11,9 +11,9 @@
#define LLVM_DEBUGINFO_DWARFACCELERATORTABLE_H
#include "llvm/ADT/SmallVector.h"
+#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/DebugInfo/DWARF/DWARFRelocMap.h"
#include "llvm/Support/DataExtractor.h"
-#include "llvm/Support/Dwarf.h"
#include <cstdint>
#include <utility>
diff --git a/include/llvm/DebugInfo/DWARF/DWARFAttribute.h b/include/llvm/DebugInfo/DWARF/DWARFAttribute.h
index c3953b62d780..f0672bb0ca75 100644
--- a/include/llvm/DebugInfo/DWARF/DWARFAttribute.h
+++ b/include/llvm/DebugInfo/DWARF/DWARFAttribute.h
@@ -10,8 +10,8 @@
#ifndef LLVM_DEBUGINFO_DWARFATTRIBUTE_H
#define LLVM_DEBUGINFO_DWARFATTRIBUTE_H
+#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/DebugInfo/DWARF/DWARFFormValue.h"
-#include "llvm/Support/Dwarf.h"
#include <cstdint>
namespace llvm {
diff --git a/include/llvm/DebugInfo/DWARF/DWARFCompileUnit.h b/include/llvm/DebugInfo/DWARF/DWARFCompileUnit.h
index 46c0b7f4ce60..b4e4721e3d51 100644
--- a/include/llvm/DebugInfo/DWARF/DWARFCompileUnit.h
+++ b/include/llvm/DebugInfo/DWARF/DWARFCompileUnit.h
@@ -19,8 +19,8 @@ class DWARFCompileUnit : public DWARFUnit {
public:
DWARFCompileUnit(DWARFContext &Context, const DWARFSection &Section,
const DWARFDebugAbbrev *DA, const DWARFSection *RS,
- StringRef SS, StringRef SOS, const DWARFSection *AOS,
- StringRef LS, bool LE, bool IsDWO,
+ StringRef SS, const DWARFSection &SOS,
+ const DWARFSection *AOS, StringRef LS, bool LE, bool IsDWO,
const DWARFUnitSectionBase &UnitSection,
const DWARFUnitIndex::Entry *Entry)
: DWARFUnit(Context, Section, DA, RS, SS, SOS, AOS, LS, LE, IsDWO,
@@ -29,7 +29,7 @@ public:
// VTable anchor.
~DWARFCompileUnit() override;
- void dump(raw_ostream &OS);
+ void dump(raw_ostream &OS, DIDumpOptions DumpOpts);
static const DWARFSectionKind Section = DW_SECT_INFO;
};
diff --git a/include/llvm/DebugInfo/DWARF/DWARFContext.h b/include/llvm/DebugInfo/DWARF/DWARFContext.h
index 519ecf618558..c72604a12bfd 100644
--- a/include/llvm/DebugInfo/DWARF/DWARFContext.h
+++ b/include/llvm/DebugInfo/DWARF/DWARFContext.h
@@ -11,12 +11,12 @@
#define LLVM_DEBUGINFO_DWARF_DWARFCONTEXT_H
#include "llvm/ADT/DenseMap.h"
-#include "llvm/ADT/iterator_range.h"
#include "llvm/ADT/MapVector.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/iterator_range.h"
#include "llvm/DebugInfo/DIContext.h"
#include "llvm/DebugInfo/DWARF/DWARFCompileUnit.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h"
@@ -72,6 +72,9 @@ class DWARFContext : public DIContext {
std::unique_ptr<DWARFDebugAbbrev> AbbrevDWO;
std::unique_ptr<DWARFDebugLocDWO> LocDWO;
+ /// The maximum DWARF version of all units.
+ unsigned MaxVersion;
+
struct DWOFile {
object::OwningBinary<object::ObjectFile> File;
std::unique_ptr<DWARFContext> Context;
@@ -97,7 +100,7 @@ class DWARFContext : public DIContext {
void parseDWOTypeUnits();
public:
- DWARFContext() : DIContext(CK_DWARF) {}
+ DWARFContext() : DIContext(CK_DWARF), MaxVersion(0) {}
DWARFContext(DWARFContext &) = delete;
DWARFContext &operator=(DWARFContext &) = delete;
@@ -178,6 +181,13 @@ public:
/// Get a DIE given an exact offset.
DWARFDie getDIEForOffset(uint32_t Offset);
+ unsigned getMaxVersion() const { return MaxVersion; }
+
+ void setMaxVersionIfGreater(unsigned Version) {
+ if (Version > MaxVersion)
+ MaxVersion = Version;
+ }
+
const DWARFUnitIndex &getCUIndex();
DWARFGdbIndex &getGdbIndex();
const DWARFUnitIndex &getTUIndex();
@@ -237,6 +247,11 @@ public:
virtual StringRef getGnuPubNamesSection() = 0;
virtual StringRef getGnuPubTypesSection() = 0;
+ /// DWARF v5
+ /// @{
+ virtual const DWARFSection &getStringOffsetSection() = 0;
+ /// @}
+
// Sections for DWARF5 split dwarf proposal.
virtual const DWARFSection &getInfoDWOSection() = 0;
virtual const TypeSectionMap &getTypesDWOSections() = 0;
@@ -244,7 +259,7 @@ public:
virtual const DWARFSection &getLineDWOSection() = 0;
virtual const DWARFSection &getLocDWOSection() = 0;
virtual StringRef getStringDWOSection() = 0;
- virtual StringRef getStringOffsetDWOSection() = 0;
+ virtual const DWARFSection &getStringOffsetDWOSection() = 0;
virtual const DWARFSection &getRangeDWOSection() = 0;
virtual const DWARFSection &getAddrSection() = 0;
virtual const DWARFSection& getAppleNamesSection() = 0;
@@ -295,6 +310,11 @@ class DWARFContextInMemory : public DWARFContext {
StringRef GnuPubNamesSection;
StringRef GnuPubTypesSection;
+ /// DWARF v5
+ /// @{
+ DWARFSection StringOffsetSection;
+ /// @}
+
// Sections for DWARF5 split dwarf proposal.
DWARFSection InfoDWOSection;
TypeSectionMap TypesDWOSections;
@@ -302,7 +322,7 @@ class DWARFContextInMemory : public DWARFContext {
DWARFSection LineDWOSection;
DWARFSection LocDWOSection;
StringRef StringDWOSection;
- StringRef StringOffsetDWOSection;
+ DWARFSection StringOffsetDWOSection;
DWARFSection RangeDWOSection;
DWARFSection AddrSection;
DWARFSection AppleNamesSection;
@@ -353,6 +373,11 @@ public:
const DWARFSection& getAppleNamespacesSection() override { return AppleNamespacesSection; }
const DWARFSection& getAppleObjCSection() override { return AppleObjCSection; }
+ // DWARF v5
+ const DWARFSection &getStringOffsetSection() override {
+ return StringOffsetSection;
+ }
+
// Sections for DWARF5 split dwarf proposal.
const DWARFSection &getInfoDWOSection() override { return InfoDWOSection; }
@@ -365,7 +390,7 @@ public:
const DWARFSection &getLocDWOSection() override { return LocDWOSection; }
StringRef getStringDWOSection() override { return StringDWOSection; }
- StringRef getStringOffsetDWOSection() override {
+ const DWARFSection &getStringOffsetDWOSection() override {
return StringOffsetDWOSection;
}
diff --git a/include/llvm/DebugInfo/DWARF/DWARFDebugInfoEntry.h b/include/llvm/DebugInfo/DWARF/DWARFDebugInfoEntry.h
index fc2423a2708b..5c591b3de491 100644
--- a/include/llvm/DebugInfo/DWARF/DWARFDebugInfoEntry.h
+++ b/include/llvm/DebugInfo/DWARF/DWARFDebugInfoEntry.h
@@ -10,8 +10,8 @@
#ifndef LLVM_DEBUGINFO_DWARFDEBUGINFOENTRY_H
#define LLVM_DEBUGINFO_DWARFDEBUGINFOENTRY_H
+#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h"
-#include "llvm/Support/Dwarf.h"
#include <cstdint>
namespace llvm {
diff --git a/include/llvm/DebugInfo/DWARF/DWARFDebugPubTable.h b/include/llvm/DebugInfo/DWARF/DWARFDebugPubTable.h
index 9d36bb7ad211..a309fd104f93 100644
--- a/include/llvm/DebugInfo/DWARF/DWARFDebugPubTable.h
+++ b/include/llvm/DebugInfo/DWARF/DWARFDebugPubTable.h
@@ -12,7 +12,7 @@
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/StringRef.h"
-#include "llvm/Support/Dwarf.h"
+#include "llvm/BinaryFormat/Dwarf.h"
#include <cstdint>
#include <vector>
diff --git a/include/llvm/DebugInfo/DWARF/DWARFDebugRangeList.h b/include/llvm/DebugInfo/DWARF/DWARFDebugRangeList.h
index b436711ae6ed..437060bc8fec 100644
--- a/include/llvm/DebugInfo/DWARF/DWARFDebugRangeList.h
+++ b/include/llvm/DebugInfo/DWARF/DWARFDebugRangeList.h
@@ -10,8 +10,8 @@
#ifndef LLVM_DEBUGINFO_DWARF_DWARFDEBUGRANGELIST_H
#define LLVM_DEBUGINFO_DWARF_DWARFDEBUGRANGELIST_H
-#include "llvm/Support/DataExtractor.h"
#include "llvm/DebugInfo/DWARF/DWARFRelocMap.h"
+#include "llvm/Support/DataExtractor.h"
#include <cassert>
#include <cstdint>
diff --git a/include/llvm/DebugInfo/DWARF/DWARFDie.h b/include/llvm/DebugInfo/DWARF/DWARFDie.h
index fa41b9e293c0..b216491b615a 100644
--- a/include/llvm/DebugInfo/DWARF/DWARFDie.h
+++ b/include/llvm/DebugInfo/DWARF/DWARFDie.h
@@ -11,14 +11,14 @@
#define LLVM_DEBUGINFO_DWARFDIE_H
#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/Optional.h"
#include "llvm/ADT/iterator.h"
#include "llvm/ADT/iterator_range.h"
-#include "llvm/ADT/Optional.h"
+#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/DebugInfo/DIContext.h"
#include "llvm/DebugInfo/DWARF/DWARFAttribute.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugInfoEntry.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugRangeList.h"
-#include "llvm/Support/Dwarf.h"
#include <cassert>
#include <cstdint>
#include <iterator>
@@ -120,7 +120,8 @@ public:
/// \param recurseDepth the depth to recurse to when dumping this DIE and its
/// children.
/// \param indent the number of characters to indent each line that is output.
- void dump(raw_ostream &OS, unsigned recurseDepth, unsigned indent = 0) const;
+ void dump(raw_ostream &OS, unsigned recurseDepth, unsigned indent = 0,
+ DIDumpOptions DumpOpts = DIDumpOptions()) const;
/// Extract the specified attribute from this DIE.
///
diff --git a/include/llvm/DebugInfo/DWARF/DWARFFormValue.h b/include/llvm/DebugInfo/DWARF/DWARFFormValue.h
index 3a781dde8929..d6a3b52f2fe1 100644
--- a/include/llvm/DebugInfo/DWARF/DWARFFormValue.h
+++ b/include/llvm/DebugInfo/DWARF/DWARFFormValue.h
@@ -13,8 +13,8 @@
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/None.h"
#include "llvm/ADT/Optional.h"
+#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/Support/DataExtractor.h"
-#include "llvm/Support/Dwarf.h"
#include <cstdint>
namespace llvm {
diff --git a/include/llvm/DebugInfo/DWARF/DWARFTypeUnit.h b/include/llvm/DebugInfo/DWARF/DWARFTypeUnit.h
index c77d946c070a..2041d40eb53a 100644
--- a/include/llvm/DebugInfo/DWARF/DWARFTypeUnit.h
+++ b/include/llvm/DebugInfo/DWARF/DWARFTypeUnit.h
@@ -31,7 +31,7 @@ private:
public:
DWARFTypeUnit(DWARFContext &Context, const DWARFSection &Section,
const DWARFDebugAbbrev *DA, const DWARFSection *RS,
- StringRef SS, StringRef SOS, const DWARFSection *AOS,
+ StringRef SS, const DWARFSection &SOS, const DWARFSection *AOS,
StringRef LS, bool LE, bool IsDWO,
const DWARFUnitSectionBase &UnitSection,
const DWARFUnitIndex::Entry *Entry)
diff --git a/include/llvm/DebugInfo/DWARF/DWARFUnit.h b/include/llvm/DebugInfo/DWARF/DWARFUnit.h
index d0f7bd0d623f..945b8999ff22 100644
--- a/include/llvm/DebugInfo/DWARF/DWARFUnit.h
+++ b/include/llvm/DebugInfo/DWARF/DWARFUnit.h
@@ -10,11 +10,12 @@
#ifndef LLVM_DEBUGINFO_DWARF_DWARFUNIT_H
#define LLVM_DEBUGINFO_DWARF_DWARFUNIT_H
-#include "llvm/ADT/iterator_range.h"
#include "llvm/ADT/Optional.h"
-#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/iterator_range.h"
+#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugInfoEntry.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugRangeList.h"
#include "llvm/DebugInfo/DWARF/DWARFDie.h"
@@ -24,14 +25,13 @@
#include "llvm/Object/Binary.h"
#include "llvm/Object/ObjectFile.h"
#include "llvm/Support/DataExtractor.h"
-#include "llvm/Support/Dwarf.h"
#include <algorithm>
#include <cassert>
#include <cstddef>
#include <cstdint>
+#include <map>
#include <memory>
#include <vector>
-#include <map>
namespace llvm {
@@ -57,8 +57,9 @@ protected:
virtual void parseImpl(DWARFContext &Context, const DWARFSection &Section,
const DWARFDebugAbbrev *DA, const DWARFSection *RS,
- StringRef SS, StringRef SOS, const DWARFSection *AOS,
- StringRef LS, bool isLittleEndian, bool isDWO) = 0;
+ StringRef SS, const DWARFSection &SOS,
+ const DWARFSection *AOS, StringRef LS,
+ bool isLittleEndian, bool isDWO) = 0;
};
const DWARFUnitIndex &getDWARFUnitIndex(DWARFContext &Context,
@@ -89,7 +90,7 @@ public:
private:
void parseImpl(DWARFContext &Context, const DWARFSection &Section,
const DWARFDebugAbbrev *DA, const DWARFSection *RS,
- StringRef SS, StringRef SOS, const DWARFSection *AOS,
+ StringRef SS, const DWARFSection &SOS, const DWARFSection *AOS,
StringRef LS, bool LE, bool IsDWO) override {
if (Parsed)
return;
@@ -119,7 +120,8 @@ class DWARFUnit {
uint32_t RangeSectionBase;
StringRef LineSection;
StringRef StringSection;
- StringRef StringOffsetSection;
+ const DWARFSection &StringOffsetSection;
+ uint64_t StringOffsetSectionBase = 0;
const DWARFSection *AddrOffsetSection;
uint32_t AddrOffsetSectionBase;
bool isLittleEndian;
@@ -162,8 +164,8 @@ protected:
public:
DWARFUnit(DWARFContext &Context, const DWARFSection &Section,
const DWARFDebugAbbrev *DA, const DWARFSection *RS, StringRef SS,
- StringRef SOS, const DWARFSection *AOS, StringRef LS, bool LE,
- bool IsDWO, const DWARFUnitSectionBase &UnitSection,
+ const DWARFSection &SOS, const DWARFSection *AOS, StringRef LS,
+ bool LE, bool IsDWO, const DWARFUnitSectionBase &UnitSection,
const DWARFUnitIndex::Entry *IndexEntry = nullptr);
virtual ~DWARFUnit();
@@ -172,7 +174,9 @@ public:
StringRef getLineSection() const { return LineSection; }
StringRef getStringSection() const { return StringSection; }
- StringRef getStringOffsetSection() const { return StringOffsetSection; }
+ const DWARFSection &getStringOffsetSection() const {
+ return StringOffsetSection;
+ }
void setAddrOffsetSection(const DWARFSection *AOS, uint32_t Base) {
AddrOffsetSection = AOS;
@@ -189,7 +193,8 @@ public:
bool getAddrOffsetSectionItem(uint32_t Index, uint64_t &Result) const;
// FIXME: Result should be uint64_t in DWARF64.
- bool getStringOffsetSectionItem(uint32_t Index, uint32_t &Result) const;
+ bool getStringOffsetSectionItem(uint32_t Index, uint64_t &Result) const;
+ uint64_t getStringOffsetSectionRelocation(uint32_t Index) const;
DataExtractor getDebugInfoExtractor() const {
return DataExtractor(InfoSection.Data, isLittleEndian, AddrSize);
@@ -200,6 +205,9 @@ public:
}
const RelocAddrMap *getRelocMap() const { return &InfoSection.Relocs; }
+ const RelocAddrMap &getStringOffsetsRelocMap() const {
+ return StringOffsetSection.Relocs;
+ }
bool extract(DataExtractor debug_info, uint32_t* offset_ptr);
diff --git a/include/llvm/DebugInfo/MSF/MappedBlockStream.h b/include/llvm/DebugInfo/MSF/MappedBlockStream.h
index 36dce393fc66..02f3cb09b004 100644
--- a/include/llvm/DebugInfo/MSF/MappedBlockStream.h
+++ b/include/llvm/DebugInfo/MSF/MappedBlockStream.h
@@ -17,7 +17,6 @@
#include "llvm/DebugInfo/MSF/MSFStreamLayout.h"
#include "llvm/Support/Allocator.h"
#include "llvm/Support/BinaryStream.h"
-#include "llvm/Support/BinaryStream.h"
#include "llvm/Support/BinaryStreamRef.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/Error.h"
diff --git a/include/llvm/DebugInfo/PDB/DIA/DIAEnumDebugStreams.h b/include/llvm/DebugInfo/PDB/DIA/DIAEnumDebugStreams.h
index 941e16a35fac..ffae6645e94b 100644
--- a/include/llvm/DebugInfo/PDB/DIA/DIAEnumDebugStreams.h
+++ b/include/llvm/DebugInfo/PDB/DIA/DIAEnumDebugStreams.h
@@ -11,6 +11,7 @@
#define LLVM_DEBUGINFO_PDB_DIA_DIAENUMDEBUGSTREAMS_H
#include "DIASupport.h"
+#include "llvm/DebugInfo/PDB/IPDBDataStream.h"
#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
namespace llvm {
diff --git a/include/llvm/DebugInfo/PDB/DIA/DIAEnumLineNumbers.h b/include/llvm/DebugInfo/PDB/DIA/DIAEnumLineNumbers.h
index 106b84cecfff..08f0de124ede 100644
--- a/include/llvm/DebugInfo/PDB/DIA/DIAEnumLineNumbers.h
+++ b/include/llvm/DebugInfo/PDB/DIA/DIAEnumLineNumbers.h
@@ -12,6 +12,7 @@
#include "DIASupport.h"
#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
+#include "llvm/DebugInfo/PDB/IPDBLineNumber.h"
namespace llvm {
namespace pdb {
diff --git a/include/llvm/DebugInfo/PDB/DIA/DIAEnumSourceFiles.h b/include/llvm/DebugInfo/PDB/DIA/DIAEnumSourceFiles.h
index 6c00d6a5e29d..e69d18f5ba37 100644
--- a/include/llvm/DebugInfo/PDB/DIA/DIAEnumSourceFiles.h
+++ b/include/llvm/DebugInfo/PDB/DIA/DIAEnumSourceFiles.h
@@ -12,6 +12,7 @@
#include "DIASupport.h"
#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
+#include "llvm/DebugInfo/PDB/IPDBSourceFile.h"
namespace llvm {
namespace pdb {
diff --git a/include/llvm/DebugInfo/PDB/DIA/DIAEnumSymbols.h b/include/llvm/DebugInfo/PDB/DIA/DIAEnumSymbols.h
index b206ff59a6a4..f779cd1f4be3 100644
--- a/include/llvm/DebugInfo/PDB/DIA/DIAEnumSymbols.h
+++ b/include/llvm/DebugInfo/PDB/DIA/DIAEnumSymbols.h
@@ -12,6 +12,7 @@
#include "DIASupport.h"
#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
+#include "llvm/DebugInfo/PDB/PDBSymbol.h"
namespace llvm {
namespace pdb {
diff --git a/include/llvm/DebugInfo/PDB/Native/DbiModuleDescriptor.h b/include/llvm/DebugInfo/PDB/Native/DbiModuleDescriptor.h
index 7e77f5a3eef9..8200f51e3da9 100644
--- a/include/llvm/DebugInfo/PDB/Native/DbiModuleDescriptor.h
+++ b/include/llvm/DebugInfo/PDB/Native/DbiModuleDescriptor.h
@@ -56,9 +56,8 @@ private:
} // end namespace pdb
template <> struct VarStreamArrayExtractor<pdb::DbiModuleDescriptor> {
- typedef void ContextType;
- static Error extract(BinaryStreamRef Stream, uint32_t &Length,
- pdb::DbiModuleDescriptor &Info) {
+ Error operator()(BinaryStreamRef Stream, uint32_t &Length,
+ pdb::DbiModuleDescriptor &Info) {
if (auto EC = pdb::DbiModuleDescriptor::initialize(Stream, Info))
return EC;
Length = Info.getRecordLength();
diff --git a/include/llvm/DebugInfo/PDB/Native/DbiStream.h b/include/llvm/DebugInfo/PDB/Native/DbiStream.h
index dc35f8c72cd9..7123e88cd642 100644
--- a/include/llvm/DebugInfo/PDB/Native/DbiStream.h
+++ b/include/llvm/DebugInfo/PDB/Native/DbiStream.h
@@ -96,7 +96,8 @@ private:
FixedStreamArray<support::ulittle16_t> DbgStreams;
- PdbRaw_DbiSecContribVer SectionContribVersion;
+ PdbRaw_DbiSecContribVer SectionContribVersion =
+ PdbRaw_DbiSecContribVer::DbiSecContribVer60;
FixedStreamArray<SectionContrib> SectionContribs;
FixedStreamArray<SectionContrib2> SectionContribs2;
FixedStreamArray<SecMapEntry> SectionMap;
diff --git a/include/llvm/DebugInfo/PDB/PDBSymbol.h b/include/llvm/DebugInfo/PDB/PDBSymbol.h
index b114b7afb0b0..9e883d2f99a7 100644
--- a/include/llvm/DebugInfo/PDB/PDBSymbol.h
+++ b/include/llvm/DebugInfo/PDB/PDBSymbol.h
@@ -89,6 +89,8 @@ public:
template <typename T> std::unique_ptr<T> findOneChild() const {
auto Enumerator(findAllChildren<T>());
+ if (!Enumerator)
+ return nullptr;
return Enumerator->getNext();
}
@@ -97,6 +99,8 @@ public:
template <typename T>
std::unique_ptr<ConcreteSymbolEnumerator<T>> findAllChildren() const {
auto BaseIter = RawSymbol->findChildren(T::Tag);
+ if (!BaseIter)
+ return nullptr;
return llvm::make_unique<ConcreteSymbolEnumerator<T>>(std::move(BaseIter));
}
std::unique_ptr<IPDBEnumSymbols> findAllChildren(PDB_SymType Type) const;