[DWARF parser] Fix broken address ranges construction.
authorAlexey Samsonov <vonosmas@gmail.com>
Thu, 12 Jun 2014 23:58:49 +0000 (23:58 +0000)
committerAlexey Samsonov <vonosmas@gmail.com>
Thu, 12 Jun 2014 23:58:49 +0000 (23:58 +0000)
commit0670cfaf01bc70c159132836be62c8b91e18dedb
treea2ca45ce8c200ae8c09ec91690aff769e9f74ca9
parent70e005a1719978a134b0d65a38828b41338263fb
[DWARF parser] Fix broken address ranges construction.

Previous algorithm for constructing [Address ranges]->[Compile Units]
mapping was wrong. It somewhat relied on the assumption that address ranges
for different compile units may not overlap. It is not so.
For example, two compile units may contain the definition of the same
linkonce_odr function. These definitions will be merged at link-time,
resulting in equivalent .debug_ranges entries for both these units

Instead of sorting and merging original address ranges (from .debug_ranges
and .debug_aranges), implement a different approach: save endpoints
of all ranges, and then use a sweep-line approach to construct
the desired mapping. If we find that certain address maps to
several compilation units, we just pick any of them.

llvm-svn: 210860
llvm/lib/DebugInfo/DWARFDebugAranges.cpp
llvm/lib/DebugInfo/DWARFDebugAranges.h
llvm/test/DebugInfo/Inputs/arange-overlap.cc [new file with mode: 0644]
llvm/test/DebugInfo/Inputs/arange-overlap.elf-x86_64 [new file with mode: 0755]
llvm/test/DebugInfo/llvm-symbolizer.test