|
8 | 8 |
|
9 | 9 | #include "Error.h"
|
10 | 10 | #include "llvm/DebugInfo/DWARF/DWARFContext.h"
|
| 11 | +#include "llvm/DebugInfo/DWARF/DWARFDebugAddr.h" |
11 | 12 | #include "llvm/DebugInfo/DWARF/DWARFDebugArangeSet.h"
|
12 | 13 | #include "llvm/DebugInfo/DWARF/DWARFFormValue.h"
|
13 | 14 | #include "llvm/ObjectYAML/DWARFYAML.h"
|
@@ -89,6 +90,31 @@ void dumpDebugARanges(DWARFContext &DCtx, DWARFYAML::Data &Y) {
|
89 | 90 | }
|
90 | 91 | }
|
91 | 92 |
|
| 93 | +void dumpDebugAddr(DWARFContext &DCtx, DWARFYAML::Data &Y) { // XXX BINARYEN |
| 94 | + DWARFDebugAddrTable AddrTable; |
| 95 | + DWARFDataExtractor AddrData(DCtx.getDWARFObj(), |
| 96 | + DCtx.getDWARFObj().getAddrSection(), |
| 97 | + DCtx.isLittleEndian(), /*AddrSize=*/0); |
| 98 | + std::vector<DWARFYAML::AddrTable> AddrTables; |
| 99 | + uint64_t Offset = 0; |
| 100 | + while (AddrData.isValidOffset(Offset)) { |
| 101 | + // We ignore any errors that don't prevent parsing the section, since we can |
| 102 | + // still represent such sections. |
| 103 | + if (Error E = AddrTable.extract(AddrData, &Offset, DCtx.getMaxVersion(), DCtx.getDWARFObj().getAddressSize(), consumeError)) { |
| 104 | + errs() << toString(std::move(E)) << '\n'; |
| 105 | + break; |
| 106 | + } |
| 107 | + AddrTables.emplace_back(); |
| 108 | + for (uint64_t Addr : AddrTable.getAddressEntries()) { |
| 109 | + // Currently, the parser doesn't support parsing an address table with non |
| 110 | + // linear addresses (segment_selector_size != 0). The segment selectors |
| 111 | + // are specified to be zero. |
| 112 | + AddrTables.back().Addrs.push_back(Addr); |
| 113 | + } |
| 114 | + } |
| 115 | + Y.DebugAddr = std::move(AddrTables); |
| 116 | +} |
| 117 | + |
92 | 118 | void dumpDebugRanges(DWARFContext &DCtx, DWARFYAML::Data &Y) { // XXX BINARYEN
|
93 | 119 | uint8_t savedAddressByteSize = 4;
|
94 | 120 | DWARFDataExtractor rangesData(DCtx.getDWARFObj(), DCtx.getDWARFObj().getRangesSection(),
|
@@ -427,6 +453,7 @@ std::error_code dwarf2yaml(DWARFContext &DCtx, DWARFYAML::Data &Y) {
|
427 | 453 | dumpDebugARanges(DCtx, Y);
|
428 | 454 | dumpDebugRanges(DCtx, Y); // XXX BINARYEN
|
429 | 455 | dumpDebugLoc(DCtx, Y); // XXX BINARYEN
|
| 456 | + dumpDebugAddr(DCtx, Y); // XXX BINARYEN |
430 | 457 | dumpDebugPubSections(DCtx, Y);
|
431 | 458 | dumpDebugInfo(DCtx, Y);
|
432 | 459 | dumpDebugLines(DCtx, Y);
|
|
0 commit comments