diff options
author | George Rimar <grimar@accesssoftek.com> | 2018-10-22 11:30:54 +0000 |
---|---|---|
committer | George Rimar <grimar@accesssoftek.com> | 2018-10-22 11:30:54 +0000 |
commit | 4c7dd9cf0ad5d4de0281205c3e1017d21dbb6ba1 (patch) | |
tree | 719ad1ae6ab2a3cb7da279518aea4669494ae8a8 /llvm/lib/DebugInfo/DWARF/DWARFDie.cpp | |
parent | 674581afbbd180745474adf0dcfebfd97e62dde7 (diff) | |
download | bcm5719-llvm-4c7dd9cf0ad5d4de0281205c3e1017d21dbb6ba1.tar.gz bcm5719-llvm-4c7dd9cf0ad5d4de0281205c3e1017d21dbb6ba1.zip |
[llvm-dwarfdump] - Add the support of parsing .debug_loclists.
This teaches llvm-dwarfdump to dump the content of .debug_loclists sections.
It converts the DWARFDebugLocDWO class to DWARFDebugLoclists,
teaches llvm-dwarfdump about .debug_loclists section and
adds the implementation for parsing the DW_LLE_offset_pair entries.
Differential revision: https://reviews.llvm.org/D53364
llvm-svn: 344895
Diffstat (limited to 'llvm/lib/DebugInfo/DWARF/DWARFDie.cpp')
-rw-r--r-- | llvm/lib/DebugInfo/DWARF/DWARFDie.cpp | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp index b4413653290..76430b41f18 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp @@ -102,7 +102,7 @@ static void dumpLocation(raw_ostream &OS, DWARFFormValue &FormValue, FormValue.dump(OS, DumpOpts); if (FormValue.isFormClass(DWARFFormValue::FC_SectionOffset)) { uint32_t Offset = *FormValue.getAsSectionOffset(); - if (!U->isDWOUnit()) { + if (!U->isDWOUnit() && !U->getLocSection()->Data.empty()) { DWARFDebugLoc DebugLoc; DWARFDataExtractor Data(Obj, *U->getLocSection(), Ctx.isLittleEndian(), Obj.getAddressSize()); @@ -115,11 +115,23 @@ static void dumpLocation(raw_ostream &OS, DWARFFormValue &FormValue, Indent); } else OS << "error extracting location list."; - } else { - DataExtractor Data(U->getLocSectionData(), Ctx.isLittleEndian(), 0); - auto LL = DWARFDebugLocDWO::parseOneLocationList(Data, &Offset); + return; + } + + StringRef LoclistsSectionData = + U->isDWOUnit() ? U->getLocSectionData() : Obj.getLoclistsSection().Data; + if (!LoclistsSectionData.empty()) { + DataExtractor Data(LoclistsSectionData, Ctx.isLittleEndian(), + Obj.getAddressSize()); + auto LL = DWARFDebugLoclists::parseOneLocationList(Data, &Offset); + + uint64_t BaseAddr = 0; + if (Optional<SectionedAddress> BA = U->getBaseAddress()) + BaseAddr = BA->Address; + if (LL) - LL->dump(OS, Ctx.isLittleEndian(), Obj.getAddressSize(), MRI, Indent); + LL->dump(OS, BaseAddr, Ctx.isLittleEndian(), Obj.getAddressSize(), MRI, + Indent); else OS << "error extracting location list."; } |