summaryrefslogtreecommitdiff
path: root/include/llvm/ObjectYAML/DWARFYAML.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/ObjectYAML/DWARFYAML.h')
-rw-r--r--include/llvm/ObjectYAML/DWARFYAML.h52
1 files changed, 43 insertions, 9 deletions
diff --git a/include/llvm/ObjectYAML/DWARFYAML.h b/include/llvm/ObjectYAML/DWARFYAML.h
index d031b5ac404c..ec34de1f0881 100644
--- a/include/llvm/ObjectYAML/DWARFYAML.h
+++ b/include/llvm/ObjectYAML/DWARFYAML.h
@@ -13,7 +13,6 @@
///
//===----------------------------------------------------------------------===//
-
#ifndef LLVM_OBJECTYAML_DWARFYAML_H
#define LLVM_OBJECTYAML_DWARFYAML_H
@@ -23,9 +22,30 @@
namespace llvm {
namespace DWARFYAML {
+struct InitialLength {
+ uint32_t TotalLength;
+ uint64_t TotalLength64;
+
+ bool isDWARF64() const { return TotalLength == UINT32_MAX; }
+
+ uint64_t getLength() const {
+ return isDWARF64() ? TotalLength64 : TotalLength;
+ }
+
+ void setLength(uint64_t Len) {
+ if (Len >= (uint64_t)UINT32_MAX) {
+ TotalLength64 = Len;
+ TotalLength = UINT32_MAX;
+ } else {
+ TotalLength = Len;
+ }
+ }
+};
+
struct AttributeAbbrev {
llvm::dwarf::Attribute Attribute;
llvm::dwarf::Form Form;
+ llvm::yaml::Hex64 Value; // Some DWARF5 attributes have values
};
struct Abbrev {
@@ -41,7 +61,7 @@ struct ARangeDescriptor {
};
struct ARange {
- uint32_t Length;
+ InitialLength Length;
uint16_t Version;
uint32_t CuOffset;
uint8_t AddrSize;
@@ -58,7 +78,7 @@ struct PubEntry {
struct PubSection {
PubSection() : IsGNUStyle(false) {}
- uint32_t Length;
+ InitialLength Length;
uint16_t Version;
uint32_t UnitOffset;
uint32_t UnitSize;
@@ -78,8 +98,9 @@ struct Entry {
};
struct Unit {
- uint32_t Length;
+ InitialLength Length;
uint16_t Version;
+ llvm::dwarf::UnitType Type; // Added in DWARF 5
uint32_t AbbrOffset;
uint8_t AddrSize;
std::vector<Entry> Entries;
@@ -104,8 +125,7 @@ struct LineTableOpcode {
};
struct LineTable {
- uint32_t TotalLength;
- uint64_t TotalLength64;
+ InitialLength Length;
uint16_t Version;
uint64_t PrologueLength;
uint8_t MinInstLength;
@@ -130,7 +150,7 @@ struct Data {
PubSection GNUPubNames;
PubSection GNUPubTypes;
-
+
std::vector<Unit> CompileUnits;
std::vector<LineTable> DebugLines;
@@ -141,7 +161,7 @@ struct Data {
} // namespace llvm::DWARFYAML
} // namespace llvm
-LLVM_YAML_IS_SEQUENCE_VECTOR(uint8_t)
+LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(uint8_t)
LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::yaml::Hex64)
LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::StringRef)
LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::yaml::Hex8)
@@ -203,7 +223,7 @@ template <> struct MappingTraits<DWARFYAML::FormValue> {
template <> struct MappingTraits<DWARFYAML::File> {
static void mapping(IO &IO, DWARFYAML::File &File);
};
-
+
template <> struct MappingTraits<DWARFYAML::LineTableOpcode> {
static void mapping(IO &IO, DWARFYAML::LineTableOpcode &LineTableOpcode);
};
@@ -212,6 +232,10 @@ template <> struct MappingTraits<DWARFYAML::LineTable> {
static void mapping(IO &IO, DWARFYAML::LineTable &LineTable);
};
+template <> struct MappingTraits<DWARFYAML::InitialLength> {
+ static void mapping(IO &IO, DWARFYAML::InitialLength &DWARF);
+};
+
#define HANDLE_DW_TAG(unused, name) \
io.enumCase(value, "DW_TAG_" #name, dwarf::DW_TAG_##name);
@@ -262,6 +286,16 @@ template <> struct ScalarEnumerationTraits<dwarf::Form> {
}
};
+#define HANDLE_DW_UT(unused, name) \
+ io.enumCase(value, "DW_UT_" #name, dwarf::DW_UT_##name);
+
+template <> struct ScalarEnumerationTraits<dwarf::UnitType> {
+ static void enumeration(IO &io, dwarf::UnitType &value) {
+#include "llvm/Support/Dwarf.def"
+ io.enumFallback<Hex8>(value);
+ }
+};
+
template <> struct ScalarEnumerationTraits<dwarf::Constants> {
static void enumeration(IO &io, dwarf::Constants &value) {
io.enumCase(value, "DW_CHILDREN_no", dwarf::DW_CHILDREN_no);