[Lldb-commits] [PATCH] D62302: DWARF: Fix address range support in mixed 4+5 scenario

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu May 23 05:47:04 PDT 2019


labath created this revision.
labath added reviewers: JDevlieghere, aprantl, clayborg.
labath marked 2 inline comments as done.
labath added inline comments.


================
Comment at: source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp:706-713
-  case DW_AT_ranges: {
-    lldb::offset_t ranges_offset =
-        GetRangesOffset(dwarf2Data->DebugRanges(), form_value);
-    dw_addr_t base_addr = cu ? cu->GetBaseAddress() : 0;
-    DWARFDebugRanges::Dump(s, dwarf2Data->get_debug_ranges_data(),
-                           &ranges_offset, base_addr);
-  } break;
----------------
This is dead dumping code, which wasn't even correct for DWARF5.


================
Comment at: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp:3240-3260
-            if (form_value.Form() == DW_FORM_sec_offset) {
-              DWARFRangeList dwarf_scope_ranges;
-              const DWARFDebugRangesBase *debug_ranges = DebugRanges();
-              debug_ranges->FindRanges(die.GetCU(),
-                                       form_value.Unsigned(),
-                                       dwarf_scope_ranges);
-            } else {
----------------
This is also effectively dead, as `scope_ranges` is not being initialized with anything. Furthermore, I can find no evidence of clang ever emitting the DW_AT_start_scope attribute.


debug_ranges got renamed to debug_rnglists in DWARF 5. Prior to this
patch lldb was just picking the first section it could find in the file,
and using that for all address ranges lookups. This is not correct in
case the file contains a mixture of compile units with various standard
versions (not a completely unlikely scenario).

In this patch I make lldb support reading from both sections
simulaneously, and decide the correct section to use based on the
version number of the compile unit. SymbolFileDWARF::DebugRanges is
split into GetDebugRanges and GetDebugRngLists (the first one is renamed
mainly so we can catch all incorrect usages).

I tried to structure the code similarly to how llvm handles this logic
(hence DWARFUnit::FindRnglistFromOffset/Index), but the implementations
are still relatively far from each other.


https://reviews.llvm.org/D62302

Files:
  lit/SymbolFile/DWARF/debug_ranges_and_rnglists.test
  source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
  source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
  source/Plugins/SymbolFile/DWARF/DWARFUnit.h
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62302.200937.patch
Type: text/x-patch
Size: 13182 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190523/13d23bb7/attachment.bin>


More information about the lldb-commits mailing list