2016-12-07 22:26:32 +01:00
|
|
|
//===- DWARFYAML.cpp - DWARF YAMLIO implementation ------------------------===//
|
|
|
|
//
|
2019-01-19 09:50:56 +01:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2016-12-07 22:26:32 +01:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file defines classes for handling the YAML representation of DWARF Debug
|
|
|
|
// Info.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "llvm/ObjectYAML/DWARFYAML.h"
|
2020-06-05 06:15:34 +02:00
|
|
|
#include "llvm/BinaryFormat/Dwarf.h"
|
2020-08-21 13:01:35 +02:00
|
|
|
#include "llvm/Support/Errc.h"
|
|
|
|
#include "llvm/Support/Error.h"
|
2016-12-07 22:26:32 +01:00
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
|
2016-12-08 18:46:57 +01:00
|
|
|
bool DWARFYAML::Data::isEmpty() const {
|
2020-08-15 14:09:37 +02:00
|
|
|
return getNonEmptySectionNames().empty();
|
2016-12-07 22:26:32 +01:00
|
|
|
}
|
|
|
|
|
2020-07-26 10:01:22 +02:00
|
|
|
SetVector<StringRef> DWARFYAML::Data::getNonEmptySectionNames() const {
|
2020-05-29 04:51:37 +02:00
|
|
|
SetVector<StringRef> SecNames;
|
2020-09-01 03:57:03 +02:00
|
|
|
if (DebugStrings)
|
2020-05-29 04:51:37 +02:00
|
|
|
SecNames.insert("debug_str");
|
2020-07-31 06:56:10 +02:00
|
|
|
if (DebugAranges)
|
2020-06-04 02:53:40 +02:00
|
|
|
SecNames.insert("debug_aranges");
|
2020-09-08 13:55:14 +02:00
|
|
|
if (DebugRanges)
|
2020-06-07 09:47:14 +02:00
|
|
|
SecNames.insert("debug_ranges");
|
2020-06-09 17:40:40 +02:00
|
|
|
if (!DebugLines.empty())
|
|
|
|
SecNames.insert("debug_line");
|
2020-09-07 10:16:38 +02:00
|
|
|
if (DebugAddr)
|
2020-06-16 04:50:49 +02:00
|
|
|
SecNames.insert("debug_addr");
|
2020-08-21 04:11:33 +02:00
|
|
|
if (!DebugAbbrev.empty())
|
2020-06-17 10:10:58 +02:00
|
|
|
SecNames.insert("debug_abbrev");
|
2020-06-20 06:09:22 +02:00
|
|
|
if (!CompileUnits.empty())
|
|
|
|
SecNames.insert("debug_info");
|
2020-06-23 14:39:38 +02:00
|
|
|
if (PubNames)
|
|
|
|
SecNames.insert("debug_pubnames");
|
2020-06-23 14:41:21 +02:00
|
|
|
if (PubTypes)
|
|
|
|
SecNames.insert("debug_pubtypes");
|
2020-07-03 12:13:49 +02:00
|
|
|
if (GNUPubNames)
|
|
|
|
SecNames.insert("debug_gnu_pubnames");
|
|
|
|
if (GNUPubTypes)
|
|
|
|
SecNames.insert("debug_gnu_pubtypes");
|
2020-07-16 16:32:31 +02:00
|
|
|
if (DebugStrOffsets)
|
|
|
|
SecNames.insert("debug_str_offsets");
|
2020-07-20 04:42:27 +02:00
|
|
|
if (DebugRnglists)
|
|
|
|
SecNames.insert("debug_rnglists");
|
2020-08-03 17:19:42 +02:00
|
|
|
if (DebugLoclists)
|
|
|
|
SecNames.insert("debug_loclists");
|
2020-05-29 04:51:37 +02:00
|
|
|
return SecNames;
|
|
|
|
}
|
|
|
|
|
2020-08-29 08:53:08 +02:00
|
|
|
Expected<DWARFYAML::Data::AbbrevTableInfo>
|
|
|
|
DWARFYAML::Data::getAbbrevTableInfoByID(uint64_t ID) const {
|
|
|
|
if (AbbrevTableInfoMap.empty()) {
|
|
|
|
uint64_t AbbrevTableOffset = 0;
|
2020-08-21 13:01:35 +02:00
|
|
|
for (auto &AbbrevTable : enumerate(DebugAbbrev)) {
|
|
|
|
// If the abbrev table's ID isn't specified, we use the index as its ID.
|
|
|
|
uint64_t AbbrevTableID =
|
|
|
|
AbbrevTable.value().ID.getValueOr(AbbrevTable.index());
|
2020-08-29 08:53:08 +02:00
|
|
|
auto It = AbbrevTableInfoMap.insert(
|
|
|
|
{AbbrevTableID, AbbrevTableInfo{/*Index=*/AbbrevTable.index(),
|
|
|
|
/*Offset=*/AbbrevTableOffset}});
|
2020-08-21 13:01:35 +02:00
|
|
|
if (!It.second)
|
|
|
|
return createStringError(
|
|
|
|
errc::invalid_argument,
|
|
|
|
"the ID (%" PRIu64 ") of abbrev table with index %zu has been used "
|
|
|
|
"by abbrev table with index %" PRIu64,
|
2020-08-29 08:53:08 +02:00
|
|
|
AbbrevTableID, AbbrevTable.index(), It.first->second.Index);
|
|
|
|
|
|
|
|
AbbrevTableOffset +=
|
|
|
|
getAbbrevTableContentByIndex(AbbrevTable.index()).size();
|
2020-08-21 13:01:35 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-29 08:53:08 +02:00
|
|
|
auto It = AbbrevTableInfoMap.find(ID);
|
|
|
|
if (It == AbbrevTableInfoMap.end())
|
2020-08-21 13:01:35 +02:00
|
|
|
return createStringError(errc::invalid_argument,
|
|
|
|
"cannot find abbrev table whose ID is %" PRIu64,
|
|
|
|
ID);
|
|
|
|
return It->second;
|
|
|
|
}
|
|
|
|
|
2016-12-07 22:26:32 +01:00
|
|
|
namespace yaml {
|
|
|
|
|
2016-12-22 23:44:27 +01:00
|
|
|
void MappingTraits<DWARFYAML::Data>::mapping(IO &IO, DWARFYAML::Data &DWARF) {
|
2020-07-03 11:56:02 +02:00
|
|
|
void *OldContext = IO.getContext();
|
|
|
|
DWARFYAML::DWARFContext DWARFCtx;
|
|
|
|
IO.setContext(&DWARFCtx);
|
2016-12-07 22:26:32 +01:00
|
|
|
IO.mapOptional("debug_str", DWARF.DebugStrings);
|
2020-08-21 04:11:33 +02:00
|
|
|
IO.mapOptional("debug_abbrev", DWARF.DebugAbbrev);
|
2020-07-31 06:56:10 +02:00
|
|
|
IO.mapOptional("debug_aranges", DWARF.DebugAranges);
|
2020-09-08 13:55:14 +02:00
|
|
|
IO.mapOptional("debug_ranges", DWARF.DebugRanges);
|
2020-05-29 13:56:32 +02:00
|
|
|
IO.mapOptional("debug_pubnames", DWARF.PubNames);
|
|
|
|
IO.mapOptional("debug_pubtypes", DWARF.PubTypes);
|
2020-07-03 11:56:02 +02:00
|
|
|
DWARFCtx.IsGNUPubSec = true;
|
2020-05-29 13:56:32 +02:00
|
|
|
IO.mapOptional("debug_gnu_pubnames", DWARF.GNUPubNames);
|
|
|
|
IO.mapOptional("debug_gnu_pubtypes", DWARF.GNUPubTypes);
|
2016-12-22 23:44:27 +01:00
|
|
|
IO.mapOptional("debug_info", DWARF.CompileUnits);
|
2017-01-10 07:22:49 +01:00
|
|
|
IO.mapOptional("debug_line", DWARF.DebugLines);
|
2020-06-16 04:50:49 +02:00
|
|
|
IO.mapOptional("debug_addr", DWARF.DebugAddr);
|
2020-07-16 16:32:31 +02:00
|
|
|
IO.mapOptional("debug_str_offsets", DWARF.DebugStrOffsets);
|
2020-07-20 04:42:27 +02:00
|
|
|
IO.mapOptional("debug_rnglists", DWARF.DebugRnglists);
|
2020-08-03 17:19:42 +02:00
|
|
|
IO.mapOptional("debug_loclists", DWARF.DebugLoclists);
|
2020-07-03 11:56:02 +02:00
|
|
|
IO.setContext(OldContext);
|
2016-12-07 22:26:32 +01:00
|
|
|
}
|
|
|
|
|
2020-08-21 04:11:33 +02:00
|
|
|
void MappingTraits<DWARFYAML::AbbrevTable>::mapping(
|
|
|
|
IO &IO, DWARFYAML::AbbrevTable &AbbrevTable) {
|
2020-08-21 13:01:35 +02:00
|
|
|
IO.mapOptional("ID", AbbrevTable.ID);
|
2020-08-21 04:11:33 +02:00
|
|
|
IO.mapOptional("Table", AbbrevTable.Table);
|
|
|
|
}
|
|
|
|
|
2016-12-22 23:44:27 +01:00
|
|
|
void MappingTraits<DWARFYAML::Abbrev>::mapping(IO &IO,
|
|
|
|
DWARFYAML::Abbrev &Abbrev) {
|
2020-06-18 07:02:08 +02:00
|
|
|
IO.mapOptional("Code", Abbrev.Code);
|
2016-12-07 22:26:32 +01:00
|
|
|
IO.mapRequired("Tag", Abbrev.Tag);
|
|
|
|
IO.mapRequired("Children", Abbrev.Children);
|
2020-08-25 16:37:40 +02:00
|
|
|
IO.mapOptional("Attributes", Abbrev.Attributes);
|
2016-12-07 22:26:32 +01:00
|
|
|
}
|
|
|
|
|
2016-12-08 18:46:57 +01:00
|
|
|
void MappingTraits<DWARFYAML::AttributeAbbrev>::mapping(
|
|
|
|
IO &IO, DWARFYAML::AttributeAbbrev &AttAbbrev) {
|
2016-12-07 22:26:32 +01:00
|
|
|
IO.mapRequired("Attribute", AttAbbrev.Attribute);
|
|
|
|
IO.mapRequired("Form", AttAbbrev.Form);
|
2017-03-07 00:22:49 +01:00
|
|
|
if(AttAbbrev.Form == dwarf::DW_FORM_implicit_const)
|
|
|
|
IO.mapRequired("Value", AttAbbrev.Value);
|
2016-12-07 22:26:32 +01:00
|
|
|
}
|
|
|
|
|
2016-12-09 01:26:44 +01:00
|
|
|
void MappingTraits<DWARFYAML::ARangeDescriptor>::mapping(
|
|
|
|
IO &IO, DWARFYAML::ARangeDescriptor &Descriptor) {
|
|
|
|
IO.mapRequired("Address", Descriptor.Address);
|
|
|
|
IO.mapRequired("Length", Descriptor.Length);
|
|
|
|
}
|
|
|
|
|
|
|
|
void MappingTraits<DWARFYAML::ARange>::mapping(IO &IO,
|
2020-05-26 11:22:23 +02:00
|
|
|
DWARFYAML::ARange &ARange) {
|
2020-06-05 06:15:34 +02:00
|
|
|
IO.mapOptional("Format", ARange.Format, dwarf::DWARF32);
|
2020-07-30 11:42:18 +02:00
|
|
|
IO.mapOptional("Length", ARange.Length);
|
2020-05-26 11:22:23 +02:00
|
|
|
IO.mapRequired("Version", ARange.Version);
|
|
|
|
IO.mapRequired("CuOffset", ARange.CuOffset);
|
2020-07-30 11:39:39 +02:00
|
|
|
IO.mapOptional("AddressSize", ARange.AddrSize);
|
|
|
|
IO.mapOptional("SegmentSelectorSize", ARange.SegSize, 0);
|
2020-08-02 15:37:11 +02:00
|
|
|
IO.mapOptional("Descriptors", ARange.Descriptors);
|
2016-12-09 01:26:44 +01:00
|
|
|
}
|
|
|
|
|
2020-04-24 04:25:12 +02:00
|
|
|
void MappingTraits<DWARFYAML::RangeEntry>::mapping(
|
|
|
|
IO &IO, DWARFYAML::RangeEntry &Descriptor) {
|
|
|
|
IO.mapRequired("LowOffset", Descriptor.LowOffset);
|
|
|
|
IO.mapRequired("HighOffset", Descriptor.HighOffset);
|
|
|
|
}
|
|
|
|
|
|
|
|
void MappingTraits<DWARFYAML::Ranges>::mapping(IO &IO,
|
2020-05-14 07:01:57 +02:00
|
|
|
DWARFYAML::Ranges &DebugRanges) {
|
2020-06-11 02:36:06 +02:00
|
|
|
IO.mapOptional("Offset", DebugRanges.Offset);
|
2020-06-14 06:00:46 +02:00
|
|
|
IO.mapOptional("AddrSize", DebugRanges.AddrSize);
|
2020-05-14 07:01:57 +02:00
|
|
|
IO.mapRequired("Entries", DebugRanges.Entries);
|
2020-04-24 04:25:12 +02:00
|
|
|
}
|
|
|
|
|
2016-12-19 23:22:12 +01:00
|
|
|
void MappingTraits<DWARFYAML::PubEntry>::mapping(IO &IO,
|
|
|
|
DWARFYAML::PubEntry &Entry) {
|
|
|
|
IO.mapRequired("DieOffset", Entry.DieOffset);
|
2020-07-03 11:56:02 +02:00
|
|
|
if (static_cast<DWARFYAML::DWARFContext *>(IO.getContext())->IsGNUPubSec)
|
2016-12-19 23:22:12 +01:00
|
|
|
IO.mapRequired("Descriptor", Entry.Descriptor);
|
|
|
|
IO.mapRequired("Name", Entry.Name);
|
|
|
|
}
|
|
|
|
|
|
|
|
void MappingTraits<DWARFYAML::PubSection>::mapping(
|
|
|
|
IO &IO, DWARFYAML::PubSection &Section) {
|
2020-08-13 12:37:58 +02:00
|
|
|
IO.mapOptional("Format", Section.Format, dwarf::DWARF32);
|
2016-12-19 23:22:12 +01:00
|
|
|
IO.mapRequired("Length", Section.Length);
|
|
|
|
IO.mapRequired("Version", Section.Version);
|
|
|
|
IO.mapRequired("UnitOffset", Section.UnitOffset);
|
|
|
|
IO.mapRequired("UnitSize", Section.UnitSize);
|
|
|
|
IO.mapRequired("Entries", Section.Entries);
|
|
|
|
}
|
|
|
|
|
2016-12-22 23:44:27 +01:00
|
|
|
void MappingTraits<DWARFYAML::Unit>::mapping(IO &IO, DWARFYAML::Unit &Unit) {
|
2020-08-06 10:37:52 +02:00
|
|
|
IO.mapOptional("Format", Unit.Format, dwarf::DWARF32);
|
2020-07-23 17:00:19 +02:00
|
|
|
IO.mapOptional("Length", Unit.Length);
|
2020-08-06 10:37:52 +02:00
|
|
|
IO.mapRequired("Version", Unit.Version);
|
|
|
|
if (Unit.Version >= 5)
|
2017-03-07 19:50:58 +01:00
|
|
|
IO.mapRequired("UnitType", Unit.Type);
|
2020-08-21 13:01:35 +02:00
|
|
|
IO.mapOptional("AbbrevTableID", Unit.AbbrevTableID);
|
2020-08-29 08:53:08 +02:00
|
|
|
IO.mapOptional("AbbrOffset", Unit.AbbrOffset);
|
2020-08-12 15:47:27 +02:00
|
|
|
IO.mapOptional("AddrSize", Unit.AddrSize);
|
2016-12-22 23:44:27 +01:00
|
|
|
IO.mapOptional("Entries", Unit.Entries);
|
|
|
|
}
|
|
|
|
|
|
|
|
void MappingTraits<DWARFYAML::Entry>::mapping(IO &IO, DWARFYAML::Entry &Entry) {
|
|
|
|
IO.mapRequired("AbbrCode", Entry.AbbrCode);
|
2020-08-06 14:41:12 +02:00
|
|
|
IO.mapOptional("Values", Entry.Values);
|
2016-12-22 23:44:27 +01:00
|
|
|
}
|
|
|
|
|
2017-01-10 07:22:49 +01:00
|
|
|
void MappingTraits<DWARFYAML::FormValue>::mapping(
|
|
|
|
IO &IO, DWARFYAML::FormValue &FormValue) {
|
2016-12-22 23:44:27 +01:00
|
|
|
IO.mapOptional("Value", FormValue.Value);
|
2017-01-10 07:22:49 +01:00
|
|
|
if (!FormValue.CStr.empty() || !IO.outputting())
|
2016-12-22 23:44:27 +01:00
|
|
|
IO.mapOptional("CStr", FormValue.CStr);
|
2017-01-10 07:22:49 +01:00
|
|
|
if (!FormValue.BlockData.empty() || !IO.outputting())
|
2016-12-22 23:44:27 +01:00
|
|
|
IO.mapOptional("BlockData", FormValue.BlockData);
|
|
|
|
}
|
|
|
|
|
2017-01-10 07:22:49 +01:00
|
|
|
void MappingTraits<DWARFYAML::File>::mapping(IO &IO, DWARFYAML::File &File) {
|
|
|
|
IO.mapRequired("Name", File.Name);
|
|
|
|
IO.mapRequired("DirIdx", File.DirIdx);
|
|
|
|
IO.mapRequired("ModTime", File.ModTime);
|
|
|
|
IO.mapRequired("Length", File.Length);
|
|
|
|
}
|
|
|
|
|
|
|
|
void MappingTraits<DWARFYAML::LineTableOpcode>::mapping(
|
|
|
|
IO &IO, DWARFYAML::LineTableOpcode &LineTableOpcode) {
|
|
|
|
IO.mapRequired("Opcode", LineTableOpcode.Opcode);
|
|
|
|
if (LineTableOpcode.Opcode == dwarf::DW_LNS_extended_op) {
|
2020-09-24 08:11:47 +02:00
|
|
|
IO.mapOptional("ExtLen", LineTableOpcode.ExtLen);
|
2017-01-10 07:22:49 +01:00
|
|
|
IO.mapRequired("SubOpcode", LineTableOpcode.SubOpcode);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!LineTableOpcode.UnknownOpcodeData.empty() || !IO.outputting())
|
|
|
|
IO.mapOptional("UnknownOpcodeData", LineTableOpcode.UnknownOpcodeData);
|
|
|
|
if (!LineTableOpcode.UnknownOpcodeData.empty() || !IO.outputting())
|
|
|
|
IO.mapOptional("StandardOpcodeData", LineTableOpcode.StandardOpcodeData);
|
|
|
|
if (!LineTableOpcode.FileEntry.Name.empty() || !IO.outputting())
|
|
|
|
IO.mapOptional("FileEntry", LineTableOpcode.FileEntry);
|
|
|
|
if (LineTableOpcode.Opcode == dwarf::DW_LNS_advance_line || !IO.outputting())
|
|
|
|
IO.mapOptional("SData", LineTableOpcode.SData);
|
|
|
|
IO.mapOptional("Data", LineTableOpcode.Data);
|
|
|
|
}
|
|
|
|
|
|
|
|
void MappingTraits<DWARFYAML::LineTable>::mapping(
|
|
|
|
IO &IO, DWARFYAML::LineTable &LineTable) {
|
2020-06-13 16:04:51 +02:00
|
|
|
IO.mapOptional("Format", LineTable.Format, dwarf::DWARF32);
|
2020-08-26 14:34:36 +02:00
|
|
|
IO.mapOptional("Length", LineTable.Length);
|
2017-01-10 07:22:49 +01:00
|
|
|
IO.mapRequired("Version", LineTable.Version);
|
2020-08-26 14:34:36 +02:00
|
|
|
IO.mapOptional("PrologueLength", LineTable.PrologueLength);
|
2017-01-10 07:22:49 +01:00
|
|
|
IO.mapRequired("MinInstLength", LineTable.MinInstLength);
|
|
|
|
if(LineTable.Version >= 4)
|
|
|
|
IO.mapRequired("MaxOpsPerInst", LineTable.MaxOpsPerInst);
|
|
|
|
IO.mapRequired("DefaultIsStmt", LineTable.DefaultIsStmt);
|
|
|
|
IO.mapRequired("LineBase", LineTable.LineBase);
|
|
|
|
IO.mapRequired("LineRange", LineTable.LineRange);
|
2020-10-09 05:09:29 +02:00
|
|
|
IO.mapOptional("OpcodeBase", LineTable.OpcodeBase);
|
|
|
|
IO.mapOptional("StandardOpcodeLengths", LineTable.StandardOpcodeLengths);
|
2020-09-18 14:20:58 +02:00
|
|
|
IO.mapOptional("IncludeDirs", LineTable.IncludeDirs);
|
|
|
|
IO.mapOptional("Files", LineTable.Files);
|
|
|
|
IO.mapOptional("Opcodes", LineTable.Opcodes);
|
2017-01-10 07:22:49 +01:00
|
|
|
}
|
|
|
|
|
2020-06-16 04:50:49 +02:00
|
|
|
void MappingTraits<DWARFYAML::SegAddrPair>::mapping(
|
|
|
|
IO &IO, DWARFYAML::SegAddrPair &SegAddrPair) {
|
|
|
|
IO.mapOptional("Segment", SegAddrPair.Segment, 0);
|
|
|
|
IO.mapOptional("Address", SegAddrPair.Address, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void MappingTraits<DWARFYAML::AddrTableEntry>::mapping(
|
|
|
|
IO &IO, DWARFYAML::AddrTableEntry &AddrTable) {
|
|
|
|
IO.mapOptional("Format", AddrTable.Format, dwarf::DWARF32);
|
|
|
|
IO.mapOptional("Length", AddrTable.Length);
|
|
|
|
IO.mapRequired("Version", AddrTable.Version);
|
|
|
|
IO.mapOptional("AddressSize", AddrTable.AddrSize);
|
|
|
|
IO.mapOptional("SegmentSelectorSize", AddrTable.SegSelectorSize, 0);
|
|
|
|
IO.mapOptional("Entries", AddrTable.SegAddrPairs);
|
|
|
|
}
|
|
|
|
|
2020-07-16 16:32:31 +02:00
|
|
|
void MappingTraits<DWARFYAML::StringOffsetsTable>::mapping(
|
|
|
|
IO &IO, DWARFYAML::StringOffsetsTable &StrOffsetsTable) {
|
|
|
|
IO.mapOptional("Format", StrOffsetsTable.Format, dwarf::DWARF32);
|
|
|
|
IO.mapOptional("Length", StrOffsetsTable.Length);
|
|
|
|
IO.mapOptional("Version", StrOffsetsTable.Version, 5);
|
|
|
|
IO.mapOptional("Padding", StrOffsetsTable.Padding, 0);
|
|
|
|
IO.mapOptional("Offsets", StrOffsetsTable.Offsets);
|
|
|
|
}
|
|
|
|
|
2020-08-03 17:19:42 +02:00
|
|
|
void MappingTraits<DWARFYAML::DWARFOperation>::mapping(
|
|
|
|
IO &IO, DWARFYAML::DWARFOperation &DWARFOperation) {
|
|
|
|
IO.mapRequired("Operator", DWARFOperation.Operator);
|
|
|
|
IO.mapOptional("Values", DWARFOperation.Values);
|
|
|
|
}
|
|
|
|
|
2020-07-20 04:42:27 +02:00
|
|
|
void MappingTraits<DWARFYAML::RnglistEntry>::mapping(
|
|
|
|
IO &IO, DWARFYAML::RnglistEntry &RnglistEntry) {
|
|
|
|
IO.mapRequired("Operator", RnglistEntry.Operator);
|
|
|
|
IO.mapOptional("Values", RnglistEntry.Values);
|
|
|
|
}
|
|
|
|
|
2020-08-03 17:19:42 +02:00
|
|
|
void MappingTraits<DWARFYAML::LoclistEntry>::mapping(
|
|
|
|
IO &IO, DWARFYAML::LoclistEntry &LoclistEntry) {
|
|
|
|
IO.mapRequired("Operator", LoclistEntry.Operator);
|
|
|
|
IO.mapOptional("Values", LoclistEntry.Values);
|
|
|
|
IO.mapOptional("DescriptionsLength", LoclistEntry.DescriptionsLength);
|
|
|
|
IO.mapOptional("Descriptions", LoclistEntry.Descriptions);
|
|
|
|
}
|
|
|
|
|
2020-07-23 04:25:01 +02:00
|
|
|
template <typename EntryType>
|
|
|
|
void MappingTraits<DWARFYAML::ListEntries<EntryType>>::mapping(
|
|
|
|
IO &IO, DWARFYAML::ListEntries<EntryType> &ListEntries) {
|
|
|
|
IO.mapOptional("Entries", ListEntries.Entries);
|
2020-07-28 16:10:44 +02:00
|
|
|
IO.mapOptional("Content", ListEntries.Content);
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename EntryType>
|
2020-10-20 15:01:01 +02:00
|
|
|
std::string MappingTraits<DWARFYAML::ListEntries<EntryType>>::validate(
|
2020-07-28 16:10:44 +02:00
|
|
|
IO &IO, DWARFYAML::ListEntries<EntryType> &ListEntries) {
|
|
|
|
if (ListEntries.Entries && ListEntries.Content)
|
|
|
|
return "Entries and Content can't be used together";
|
2020-10-20 15:01:01 +02:00
|
|
|
return "";
|
2020-07-20 04:42:27 +02:00
|
|
|
}
|
|
|
|
|
2020-07-23 04:25:01 +02:00
|
|
|
template <typename EntryType>
|
|
|
|
void MappingTraits<DWARFYAML::ListTable<EntryType>>::mapping(
|
|
|
|
IO &IO, DWARFYAML::ListTable<EntryType> &ListTable) {
|
|
|
|
IO.mapOptional("Format", ListTable.Format, dwarf::DWARF32);
|
|
|
|
IO.mapOptional("Length", ListTable.Length);
|
|
|
|
IO.mapOptional("Version", ListTable.Version, 5);
|
|
|
|
IO.mapOptional("AddressSize", ListTable.AddrSize);
|
|
|
|
IO.mapOptional("SegmentSelectorSize", ListTable.SegSelectorSize, 0);
|
|
|
|
IO.mapOptional("OffsetEntryCount", ListTable.OffsetEntryCount);
|
|
|
|
IO.mapOptional("Offsets", ListTable.Offsets);
|
|
|
|
IO.mapOptional("Lists", ListTable.Lists);
|
2020-07-20 04:42:27 +02:00
|
|
|
}
|
|
|
|
|
2017-07-01 03:35:55 +02:00
|
|
|
} // end namespace yaml
|
2016-12-07 22:26:32 +01:00
|
|
|
|
2017-07-01 03:35:55 +02:00
|
|
|
} // end namespace llvm
|