Please use GitHub pull requests for new patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
llvm/tools/obj2yaml/dwarf2yaml.cpp
Show All 18 Lines | |||||
#include <algorithm> | #include <algorithm> | ||||
using namespace llvm; | using namespace llvm; | ||||
void dumpDebugAbbrev(DWARFContext &DCtx, DWARFYAML::Data &Y) { | void dumpDebugAbbrev(DWARFContext &DCtx, DWARFYAML::Data &Y) { | ||||
auto AbbrevSetPtr = DCtx.getDebugAbbrev(); | auto AbbrevSetPtr = DCtx.getDebugAbbrev(); | ||||
if (AbbrevSetPtr) { | if (AbbrevSetPtr) { | ||||
for (auto AbbrvDeclSet : *AbbrevSetPtr) { | for (auto AbbrvDeclSet : *AbbrevSetPtr) { | ||||
Y.DebugAbbrev.emplace_back(); | |||||
for (auto AbbrvDecl : AbbrvDeclSet.second) { | for (auto AbbrvDecl : AbbrvDeclSet.second) { | ||||
DWARFYAML::Abbrev Abbrv; | DWARFYAML::Abbrev Abbrv; | ||||
Abbrv.Code = AbbrvDecl.getCode(); | Abbrv.Code = AbbrvDecl.getCode(); | ||||
Abbrv.Tag = AbbrvDecl.getTag(); | Abbrv.Tag = AbbrvDecl.getTag(); | ||||
Abbrv.Children = AbbrvDecl.hasChildren() ? dwarf::DW_CHILDREN_yes | Abbrv.Children = AbbrvDecl.hasChildren() ? dwarf::DW_CHILDREN_yes | ||||
: dwarf::DW_CHILDREN_no; | : dwarf::DW_CHILDREN_no; | ||||
for (auto Attribute : AbbrvDecl.attributes()) { | for (auto Attribute : AbbrvDecl.attributes()) { | ||||
DWARFYAML::AttributeAbbrev AttAbrv; | DWARFYAML::AttributeAbbrev AttAbrv; | ||||
AttAbrv.Attribute = Attribute.Attr; | AttAbrv.Attribute = Attribute.Attr; | ||||
AttAbrv.Form = Attribute.Form; | AttAbrv.Form = Attribute.Form; | ||||
if (AttAbrv.Form == dwarf::DW_FORM_implicit_const) | if (AttAbrv.Form == dwarf::DW_FORM_implicit_const) | ||||
AttAbrv.Value = Attribute.getImplicitConstValue(); | AttAbrv.Value = Attribute.getImplicitConstValue(); | ||||
Abbrv.Attributes.push_back(AttAbrv); | Abbrv.Attributes.push_back(AttAbrv); | ||||
} | } | ||||
Y.AbbrevDecls.push_back(Abbrv); | Y.DebugAbbrev.back().Table.push_back(Abbrv); | ||||
} | } | ||||
} | } | ||||
jhenderson: Does this work? | |||||
Yes, I think it works. Higuoxing: Yes, I think it works. | |||||
} | } | ||||
} | } | ||||
void dumpDebugStrings(DWARFContext &DCtx, DWARFYAML::Data &Y) { | void dumpDebugStrings(DWARFContext &DCtx, DWARFYAML::Data &Y) { | ||||
StringRef RemainingTable = DCtx.getDWARFObj().getStrSection(); | StringRef RemainingTable = DCtx.getDWARFObj().getStrSection(); | ||||
while (RemainingTable.size() > 0) { | while (RemainingTable.size() > 0) { | ||||
auto SymbolPair = RemainingTable.split('\0'); | auto SymbolPair = RemainingTable.split('\0'); | ||||
RemainingTable = SymbolPair.second; | RemainingTable = SymbolPair.second; | ||||
▲ Show 20 Lines • Show All 355 Lines • Show Last 20 Lines |
Does this work?