//===- DWARFYAML.h - DWARF YAMLIO implementation ----------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// /// /// \file /// \brief This file declares classes for handling the YAML representation /// of DWARF Debug Info. /// //===----------------------------------------------------------------------===// #ifndef LLVM_OBJECTYAML_DWARFYAML_H #define LLVM_OBJECTYAML_DWARFYAML_H #include "llvm/ObjectYAML/YAML.h" #include "llvm/Support/Dwarf.h" namespace llvm { namespace DWARFYAML { struct AttributeAbbrev { llvm::dwarf::Attribute Attribute; llvm::dwarf::Form Form; }; struct Abbrev { llvm::yaml::Hex32 Code; llvm::dwarf::Tag Tag; llvm::dwarf::Constants Children; std::vector Attributes; }; struct ARangeDescriptor { llvm::yaml::Hex64 Address; uint64_t Length; }; struct ARange { uint32_t Length; uint16_t Version; uint32_t CuOffset; uint8_t AddrSize; uint8_t SegSize; std::vector Descriptors; }; struct PubEntry { llvm::yaml::Hex32 DieOffset; llvm::yaml::Hex8 Descriptor; StringRef Name; }; struct PubSection { PubSection() : IsGNUStyle(false) {} uint32_t Length; uint16_t Version; uint32_t UnitOffset; uint32_t UnitSize; bool IsGNUStyle; std::vector Entries; }; struct FormValue { llvm::yaml::Hex64 Value; StringRef CStr; std::vector BlockData; }; struct Entry { llvm::yaml::Hex32 AbbrCode; std::vector Values; }; struct Unit { uint32_t Length; uint16_t Version; uint32_t AbbrOffset; uint8_t AddrSize; std::vector Entries; }; struct File { StringRef Name; uint64_t DirIdx; uint64_t ModTime; uint64_t Length; }; struct LineTableOpcode { dwarf::LineNumberOps Opcode; uint64_t ExtLen; dwarf::LineNumberExtendedOps SubOpcode; uint64_t Data; int64_t SData; File FileEntry; std::vector UnknownOpcodeData; std::vector StandardOpcodeData; }; struct LineTable { uint32_t TotalLength; uint64_t TotalLength64; uint16_t Version; uint64_t PrologueLength; uint8_t MinInstLength; uint8_t MaxOpsPerInst; uint8_t DefaultIsStmt; uint8_t LineBase; uint8_t LineRange; uint8_t OpcodeBase; std::vector StandardOpcodeLengths; std::vector IncludeDirs; std::vector Files; std::vector Opcodes; }; struct Data { bool IsLittleEndian; std::vector AbbrevDecls; std::vector DebugStrings; std::vector ARanges; PubSection PubNames; PubSection PubTypes; PubSection GNUPubNames; PubSection GNUPubTypes; std::vector CompileUnits; std::vector DebugLines; bool isEmpty() const; }; } // namespace llvm::DWARFYAML } // namespace llvm LLVM_YAML_IS_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) LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::DWARFYAML::AttributeAbbrev) LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::DWARFYAML::Abbrev) LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::DWARFYAML::ARangeDescriptor) LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::DWARFYAML::ARange) LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::DWARFYAML::PubEntry) LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::DWARFYAML::Unit) LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::DWARFYAML::FormValue) LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::DWARFYAML::Entry) LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::DWARFYAML::File) LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::DWARFYAML::LineTable) LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::DWARFYAML::LineTableOpcode) namespace llvm { namespace yaml { template <> struct MappingTraits { static void mapping(IO &IO, DWARFYAML::Data &DWARF); }; template <> struct MappingTraits { static void mapping(IO &IO, DWARFYAML::Abbrev &Abbrev); }; template <> struct MappingTraits { static void mapping(IO &IO, DWARFYAML::AttributeAbbrev &AttAbbrev); }; template <> struct MappingTraits { static void mapping(IO &IO, DWARFYAML::ARangeDescriptor &Descriptor); }; template <> struct MappingTraits { static void mapping(IO &IO, DWARFYAML::ARange &Range); }; template <> struct MappingTraits { static void mapping(IO &IO, DWARFYAML::PubEntry &Entry); }; template <> struct MappingTraits { static void mapping(IO &IO, DWARFYAML::PubSection &Section); }; template <> struct MappingTraits { static void mapping(IO &IO, DWARFYAML::Unit &Unit); }; template <> struct MappingTraits { static void mapping(IO &IO, DWARFYAML::Entry &Entry); }; template <> struct MappingTraits { static void mapping(IO &IO, DWARFYAML::FormValue &FormValue); }; template <> struct MappingTraits { static void mapping(IO &IO, DWARFYAML::File &File); }; template <> struct MappingTraits { static void mapping(IO &IO, DWARFYAML::LineTableOpcode &LineTableOpcode); }; template <> struct MappingTraits { static void mapping(IO &IO, DWARFYAML::LineTable &LineTable); }; #define HANDLE_DW_TAG(unused, name) \ io.enumCase(value, "DW_TAG_" #name, dwarf::DW_TAG_##name); template <> struct ScalarEnumerationTraits { static void enumeration(IO &io, dwarf::Tag &value) { #include "llvm/Support/Dwarf.def" io.enumFallback(value); } }; #define HANDLE_DW_LNS(unused, name) \ io.enumCase(value, "DW_LNS_" #name, dwarf::DW_LNS_##name); template <> struct ScalarEnumerationTraits { static void enumeration(IO &io, dwarf::LineNumberOps &value) { #include "llvm/Support/Dwarf.def" io.enumFallback(value); } }; #define HANDLE_DW_LNE(unused, name) \ io.enumCase(value, "DW_LNE_" #name, dwarf::DW_LNE_##name); template <> struct ScalarEnumerationTraits { static void enumeration(IO &io, dwarf::LineNumberExtendedOps &value) { #include "llvm/Support/Dwarf.def" io.enumFallback(value); } }; #define HANDLE_DW_AT(unused, name) \ io.enumCase(value, "DW_AT_" #name, dwarf::DW_AT_##name); template <> struct ScalarEnumerationTraits { static void enumeration(IO &io, dwarf::Attribute &value) { #include "llvm/Support/Dwarf.def" io.enumFallback(value); } }; #define HANDLE_DW_FORM(unused, name) \ io.enumCase(value, "DW_FORM_" #name, dwarf::DW_FORM_##name); template <> struct ScalarEnumerationTraits { static void enumeration(IO &io, dwarf::Form &value) { #include "llvm/Support/Dwarf.def" io.enumFallback(value); } }; template <> struct ScalarEnumerationTraits { static void enumeration(IO &io, dwarf::Constants &value) { io.enumCase(value, "DW_CHILDREN_no", dwarf::DW_CHILDREN_no); io.enumCase(value, "DW_CHILDREN_yes", dwarf::DW_CHILDREN_yes); io.enumFallback(value); } }; } // namespace llvm::yaml } // namespace llvm #endif