diff options
| author | Chris Bieneman <beanz@apple.com> | 2016-12-20 21:35:31 +0000 |
|---|---|---|
| committer | Chris Bieneman <beanz@apple.com> | 2016-12-20 21:35:31 +0000 |
| commit | ffc4aef54295132446403c3c1633b29b8507d7ea (patch) | |
| tree | ad900fb4663b859deac6a8febf5d04e0f5f0e00c /llvm/lib/ObjectYAML | |
| parent | 151c4568581f1d6aea266aceb99f7cc683bfc10c (diff) | |
| download | bcm5719-llvm-ffc4aef54295132446403c3c1633b29b8507d7ea.tar.gz bcm5719-llvm-ffc4aef54295132446403c3c1633b29b8507d7ea.zip | |
[ObjectYAML] Support for DWARF debug_info section
This patch adds support for YAML<->DWARF for debug_info sections.
This re-lands r290147, after fixing the issue that caused bots to fail (thank you UBSan!).
llvm-svn: 290204
Diffstat (limited to 'llvm/lib/ObjectYAML')
| -rw-r--r-- | llvm/lib/ObjectYAML/DWARFYAML.cpp | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/llvm/lib/ObjectYAML/DWARFYAML.cpp b/llvm/lib/ObjectYAML/DWARFYAML.cpp index 3d647b0b0b1..42a448a7bdf 100644 --- a/llvm/lib/ObjectYAML/DWARFYAML.cpp +++ b/llvm/lib/ObjectYAML/DWARFYAML.cpp @@ -22,8 +22,9 @@ bool DWARFYAML::Data::isEmpty() const { namespace yaml { -void MappingTraits<DWARFYAML::Data>::mapping( - IO &IO, DWARFYAML::Data &DWARF) { +void MappingTraits<DWARFYAML::Data>::mapping(IO &IO, DWARFYAML::Data &DWARF) { + auto oldContext = IO.getContext(); + IO.setContext(&DWARF); IO.mapOptional("debug_str", DWARF.DebugStrings); IO.mapOptional("debug_abbrev", DWARF.AbbrevDecls); if(!DWARF.ARanges.empty() || !IO.outputting()) @@ -36,10 +37,12 @@ void MappingTraits<DWARFYAML::Data>::mapping( IO.mapOptional("debug_gnu_pubnames", DWARF.GNUPubNames); if(!DWARF.GNUPubTypes.Entries.empty() || !IO.outputting()) IO.mapOptional("debug_gnu_pubtypes", DWARF.GNUPubTypes); + IO.mapOptional("debug_info", DWARF.CompileUnits); + IO.setContext(&oldContext); } -void MappingTraits<DWARFYAML::Abbrev>::mapping( - IO &IO, DWARFYAML::Abbrev &Abbrev) { +void MappingTraits<DWARFYAML::Abbrev>::mapping(IO &IO, + DWARFYAML::Abbrev &Abbrev) { IO.mapRequired("Code", Abbrev.Code); IO.mapRequired("Tag", Abbrev.Tag); IO.mapRequired("Children", Abbrev.Children); @@ -90,6 +93,28 @@ void MappingTraits<DWARFYAML::PubSection>::mapping( IO.setContext(OldContext); } +void MappingTraits<DWARFYAML::Unit>::mapping(IO &IO, DWARFYAML::Unit &Unit) { + IO.mapRequired("Length", Unit.Length); + IO.mapRequired("Version", Unit.Version); + IO.mapRequired("AbbrOffset", Unit.AbbrOffset); + IO.mapRequired("AddrSize", Unit.AddrSize); + IO.mapOptional("Entries", Unit.Entries); +} + +void MappingTraits<DWARFYAML::Entry>::mapping(IO &IO, DWARFYAML::Entry &Entry) { + IO.mapRequired("AbbrCode", Entry.AbbrCode); + IO.mapRequired("Values", Entry.Values); +} + +void MappingTraits<DWARFYAML::FormValue>::mapping(IO &IO, + DWARFYAML::FormValue &FormValue) { + IO.mapOptional("Value", FormValue.Value); + if(!FormValue.CStr.empty() || !IO.outputting()) + IO.mapOptional("CStr", FormValue.CStr); + if(!FormValue.BlockData.empty() || !IO.outputting()) + IO.mapOptional("BlockData", FormValue.BlockData); +} + } // namespace llvm::yaml } // namespace llvm |

