From 4ee76a922aad743818d56f58630cf8da25602251 Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Wed, 4 Dec 2019 14:03:18 +0100 Subject: [llvm/DWARF] Return section offset from DWARFUnit::get{Loc,Rng}listOffset Summary: Currently these function return the raw content of the appropriate table header, which means they are relative to the DW_AT_{loc,rng}list_base, and one has to relocate them in order to do anything. This changes the functions to perform the relocation themselves, which seems more clearer, particularly as they are sitting right next to the find{Rng,Loc}listFromOffset functions, but one *cannot* simply take the result of these functions and take pass them there. The only effect of this patch is to change what value is dumped for the DW_AT_ranges attribute, which I think is for the better, as previously the values appeared to point into thin air. (The main reason I am looking at this is because I was trying to implement equivalent functionality in lldb's DWARFUnit, and was stumped by this behavior. Reviewers: dblaikie, JDevlieghere, aprantl Subscribers: hiraditya, llvm-commits, SouraVX Tags: #llvm Differential Revision: https://reviews.llvm.org/D71006 --- llvm/lib/DebugInfo/DWARF/DWARFDie.cpp | 2 +- llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'llvm/lib/DebugInfo') diff --git a/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp index 404bc13b178..4b86359c04e 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp @@ -91,7 +91,7 @@ static void dumpLocation(raw_ostream &OS, DWARFFormValue &FormValue, FormValue.dump(OS, DumpOpts); if (auto LoclistOffset = U->getLoclistOffset(Offset)) - Offset = *LoclistOffset + U->getLocSectionBase(); + Offset = *LoclistOffset; else return; } diff --git a/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp b/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp index b662e88816f..4ccda628093 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp @@ -629,7 +629,7 @@ DWARFUnit::findRnglistFromOffset(uint64_t Offset) { Expected DWARFUnit::findRnglistFromIndex(uint32_t Index) { if (auto Offset = getRnglistOffset(Index)) - return findRnglistFromOffset(*Offset + RangeSectionBase); + return findRnglistFromOffset(*Offset); if (RngListTable) return createStringError(errc::invalid_argument, -- cgit v1.2.3