summaryrefslogtreecommitdiff
path: root/third_party/llvm-project/dwarf2yaml.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/llvm-project/dwarf2yaml.cpp')
-rw-r--r--third_party/llvm-project/dwarf2yaml.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/third_party/llvm-project/dwarf2yaml.cpp b/third_party/llvm-project/dwarf2yaml.cpp
index 7f160f7e5..eed340964 100644
--- a/third_party/llvm-project/dwarf2yaml.cpp
+++ b/third_party/llvm-project/dwarf2yaml.cpp
@@ -116,7 +116,10 @@ void dumpDebugRanges(DWARFContext &DCtx, DWARFYAML::Data &Y) { // XXX BINARYEN
}
void dumpDebugLoc(DWARFContext &DCtx, DWARFYAML::Data &Y) { // XXX BINARYEN
- uint8_t savedAddressByteSize = 4;
+ // This blindly grabs the first CU, which should be ok since they all have
+ // the same address size?
+ auto CU = DCtx.normal_units().begin()->get();
+ uint8_t savedAddressByteSize = CU->getFormParams().AddrSize; // XXX BINARYEN
DWARFDataExtractor locsData(DCtx.getDWARFObj(), DCtx.getDWARFObj().getLocSection(),
DCtx.isLittleEndian(), savedAddressByteSize);
uint64_t offset = 0;
@@ -126,7 +129,7 @@ void dumpDebugLoc(DWARFContext &DCtx, DWARFYAML::Data &Y) { // XXX BINARYEN
auto list = locList.parseOneLocationList(locsData, &offset);
if (!list) {
errs() << "debug_loc error\n";
- break;
+ exit(1);
}
for (auto& entry : list.get().Entries) {
DWARFYAML::Loc loc;
@@ -426,9 +429,10 @@ std::error_code dwarf2yaml(DWARFContext &DCtx, DWARFYAML::Data &Y) {
dumpDebugStrings(DCtx, Y);
dumpDebugARanges(DCtx, Y);
dumpDebugRanges(DCtx, Y); // XXX BINARYEN
- dumpDebugLoc(DCtx, Y); // XXX BINARYEN
dumpDebugPubSections(DCtx, Y);
dumpDebugInfo(DCtx, Y);
+ // dumpDebugLoc relies on the address size being known from dumpDebugInfo.
+ dumpDebugLoc(DCtx, Y); // XXX BINARYEN
dumpDebugLines(DCtx, Y);
return obj2yaml_error::success;
}