DWARF: Fix address range support in mixed 4+5 scenario
authorPavel Labath <pavel@labath.sk>
Wed, 29 May 2019 09:22:36 +0000 (09:22 +0000)
committerPavel Labath <pavel@labath.sk>
Wed, 29 May 2019 09:22:36 +0000 (09:22 +0000)
commit78cfe1e6feecebeeb7928cb1ffa1e2a64f5ed976
treeb493dca46572756b8119ff0b09fdf10e5fcb8516
parenta0a20f38ec5b8a6e56e94ce8d238d7ced71de065
DWARF: Fix address range support in mixed 4+5 scenario

Summary:
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.

Reviewers: JDevlieghere, aprantl, clayborg

Subscribers: lldb-commits

Differential Revision: https://reviews.llvm.org/D62302

llvm-svn: 361938
lldb/lit/SymbolFile/DWARF/debug_ranges-missing-section.s [new file with mode: 0644]
lldb/lit/SymbolFile/DWARF/debug_ranges_and_rnglists.test
lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h