summaryrefslogtreecommitdiffstats
path: root/llvm/tools/obj2yaml/dwarf2yaml.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/tools/obj2yaml/dwarf2yaml.cpp')
-rw-r--r--llvm/tools/obj2yaml/dwarf2yaml.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/llvm/tools/obj2yaml/dwarf2yaml.cpp b/llvm/tools/obj2yaml/dwarf2yaml.cpp
index ca55702be96..0fd646e23b9 100644
--- a/llvm/tools/obj2yaml/dwarf2yaml.cpp
+++ b/llvm/tools/obj2yaml/dwarf2yaml.cpp
@@ -67,11 +67,44 @@ void dumpDebugARanges(DWARFContextInMemory &DCtx, DWARFYAML::Data &Y) {
}
}
+void dumpPubSection(DWARFContextInMemory &DCtx, DWARFYAML::PubSection &Y,
+ StringRef Section) {
+ DataExtractor PubSectionData(Section, DCtx.isLittleEndian(), 0);
+ uint32_t Offset = 0;
+ Y.Length = PubSectionData.getU32(&Offset);
+ Y.Version = PubSectionData.getU16(&Offset);
+ Y.UnitOffset = PubSectionData.getU32(&Offset);
+ Y.UnitSize = PubSectionData.getU32(&Offset);
+ while (Offset < Y.Length) {
+ DWARFYAML::PubEntry NewEntry;
+ NewEntry.DieOffset = PubSectionData.getU32(&Offset);
+ if (Y.IsGNUStyle)
+ NewEntry.Descriptor = PubSectionData.getU8(&Offset);
+ NewEntry.Name = PubSectionData.getCStr(&Offset);
+ Y.Entries.push_back(NewEntry);
+ }
+}
+
+void dumpDebugPubSections(DWARFContextInMemory &DCtx, DWARFYAML::Data &Y) {
+ Y.PubNames.IsGNUStyle = false;
+ dumpPubSection(DCtx, Y.PubNames, DCtx.getPubNamesSection());
+
+ Y.PubTypes.IsGNUStyle = false;
+ dumpPubSection(DCtx, Y.PubTypes, DCtx.getPubTypesSection());
+
+ Y.GNUPubNames.IsGNUStyle = true;
+ dumpPubSection(DCtx, Y.GNUPubNames, DCtx.getGnuPubNamesSection());
+
+ Y.GNUPubTypes.IsGNUStyle = true;
+ dumpPubSection(DCtx, Y.GNUPubTypes, DCtx.getGnuPubTypesSection());
+}
+
std::error_code dwarf2yaml(DWARFContextInMemory &DCtx,
DWARFYAML::Data &Y) {
dumpDebugAbbrev(DCtx, Y);
dumpDebugStrings(DCtx, Y);
dumpDebugARanges(DCtx, Y);
+ dumpDebugPubSections(DCtx, Y);
return obj2yaml_error::success;
}
OpenPOWER on IntegriCloud