summaryrefslogtreecommitdiff
path: root/lib/ObjectYAML/DWARFYAML.cpp
diff options
context:
space:
mode:
authorChris Bieneman <beanz@apple.com>2016-12-22 22:44:27 +0000
committerChris Bieneman <beanz@apple.com>2016-12-22 22:44:27 +0000
commit7d466455bd76ac8f5bfa6034afa1f97c9786cfef (patch)
tree8dcd0ab8c6e2a71028a56efbb3f1ed31a794a84e /lib/ObjectYAML/DWARFYAML.cpp
parent869904bdc23b8171a97c4971de2ff30098b5ff70 (diff)
[ObjectYAML] Support for DWARF debug_info section
This patch adds support for YAML<->DWARF for debug_info sections. This re-lands r290147, reverted in 290148, re-landed in r290204 after fixing the issue that caused bots to fail (thank you UBSan!), and reverted again in r290209 due to failures on big endian systems. After adding support for preserving endianness, this should be good now. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290386 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ObjectYAML/DWARFYAML.cpp')
-rw-r--r--lib/ObjectYAML/DWARFYAML.cpp33
1 files changed, 29 insertions, 4 deletions
diff --git a/lib/ObjectYAML/DWARFYAML.cpp b/lib/ObjectYAML/DWARFYAML.cpp
index 3d647b0b0b1..42a448a7bdf 100644
--- a/lib/ObjectYAML/DWARFYAML.cpp
+++ b/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