PR25058 - Better support fn DIEs referring to symbols using DW_AT_ranges
authorDodji Seketeli <dodji@redhat.com>
Fri, 4 Oct 2019 08:05:42 +0000 (10:05 +0200)
committerDodji Seketeli <dodji@redhat.com>
Fri, 4 Oct 2019 08:05:42 +0000 (10:05 +0200)
commit5b9f5efab2910641a9eefe3bcab39ad121bea5e8
treec9105886169d56e7e79cbc574d4d764f40d2a9ec
parent2f7248f340a860085d7684121dc50ffd33f9293a
PR25058 - Better support fn DIEs referring to symbols using DW_AT_ranges

In the previous commit 2f7248f, we were just taking the first address
referred to by the DW_AT_ranges attribute as being the address of the
symbol of the function we are looking at.  But there can be cases
where this is not true, as explained at
https://sourceware.org/bugzilla/show_bug.cgi?id=25058#c7.

We really need to get the first address that represents an exported
and defined function symbol, which is pointed to by the DW_AT_ranges
attribute.

And this is what this patch does.

* src/abg-dwarf-reader.cc
(read_context::get_first_exported_fn_address_from_DW_AT_ranges):
Rename read_context::get_first_address_from_DW_AT_ranges into
this.  Walk through the addresses referred to by the DW_AT_ranges
attribute until we find one that is for an exported function
symbol, rather than just picking the first address of the set.
(read_context::get_function_address): Adjust.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
src/abg-dwarf-reader.cc