diff options
author | Pavel Labath <pavel@labath.sk> | 2024-08-12 11:08:38 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-12 11:08:38 +0200 |
commit | 8a1846dbdcc62675b51d245caabfe3c6ec6fd209 (patch) | |
tree | 5a079bc5f24ac4a4bf9845c8e2ee573fdcbb91fd /llvm/lib/ObjectYAML/DWARFYAML.cpp | |
parent | d12250ca7bea22ed12caf44fe80b203d83db75bb (diff) | |
download | llvm-8a1846dbdcc62675b51d245caabfe3c6ec6fd209.zip llvm-8a1846dbdcc62675b51d245caabfe3c6ec6fd209.tar.gz llvm-8a1846dbdcc62675b51d245caabfe3c6ec6fd209.tar.bz2 |
[dwarf2yaml] Correctly emit type and split unit headers (#102471)
(DWARFv5) split units have an extra `dwo_id` field in the header. Type
units have `type_signature` and `type_offset`.
Diffstat (limited to 'llvm/lib/ObjectYAML/DWARFYAML.cpp')
-rw-r--r-- | llvm/lib/ObjectYAML/DWARFYAML.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/llvm/lib/ObjectYAML/DWARFYAML.cpp b/llvm/lib/ObjectYAML/DWARFYAML.cpp index 5207671..c65a494 100644 --- a/llvm/lib/ObjectYAML/DWARFYAML.cpp +++ b/llvm/lib/ObjectYAML/DWARFYAML.cpp @@ -36,7 +36,7 @@ SetVector<StringRef> DWARFYAML::Data::getNonEmptySectionNames() const { SecNames.insert("debug_addr"); if (!DebugAbbrev.empty()) SecNames.insert("debug_abbrev"); - if (!CompileUnits.empty()) + if (!Units.empty()) SecNames.insert("debug_info"); if (PubNames) SecNames.insert("debug_pubnames"); @@ -101,7 +101,7 @@ void MappingTraits<DWARFYAML::Data>::mapping(IO &IO, DWARFYAML::Data &DWARF) { DWARFCtx.IsGNUPubSec = true; IO.mapOptional("debug_gnu_pubnames", DWARF.GNUPubNames); IO.mapOptional("debug_gnu_pubtypes", DWARF.GNUPubTypes); - IO.mapOptional("debug_info", DWARF.CompileUnits); + IO.mapOptional("debug_info", DWARF.Units); IO.mapOptional("debug_line", DWARF.DebugLines); IO.mapOptional("debug_addr", DWARF.DebugAddr); IO.mapOptional("debug_str_offsets", DWARF.DebugStrOffsets); @@ -216,6 +216,22 @@ void MappingTraits<DWARFYAML::Unit>::mapping(IO &IO, DWARFYAML::Unit &Unit) { IO.mapOptional("AbbrevTableID", Unit.AbbrevTableID); IO.mapOptional("AbbrOffset", Unit.AbbrOffset); IO.mapOptional("AddrSize", Unit.AddrSize); + if (Unit.Version >= 5) { + switch (Unit.Type) { + case dwarf::DW_UT_compile: + case dwarf::DW_UT_partial: + default: + break; + case dwarf::DW_UT_type: + case dwarf::DW_UT_split_type: + IO.mapRequired("TypeSignature", Unit.TypeSignatureOrDwoID); + IO.mapRequired("TypeOffset", Unit.TypeOffset); + break; + case dwarf::DW_UT_skeleton: + case dwarf::DW_UT_split_compile: + IO.mapRequired("DwoID", Unit.TypeSignatureOrDwoID); + } + } IO.mapOptional("Entries", Unit.Entries); } |