PR25058 - Support decl DIEs referring to symbols using DW_AT_ranges
authorDodji Seketeli <dodji@redhat.com>
Thu, 3 Oct 2019 15:15:28 +0000 (17:15 +0200)
committerDodji Seketeli <dodji@redhat.com>
Thu, 3 Oct 2019 15:42:30 +0000 (17:42 +0200)
commit2f7248f340a860085d7684121dc50ffd33f9293a
tree2434cfbbb0f648e619472090d830cd2c6cb96397
parent1f53d1faa90f119d946f6fc7db9c09c2af767cb5
PR25058 - Support decl DIEs referring to symbols using DW_AT_ranges

Usually, function DIEs (DW_TAG_subprogram) refer to the address of the
underlying ELF symbol by using the DW_AT_low_pc attribute.  However,
there are cases where it does so by using the DW_AT_ranges attribute.
In those cases, the first address of the sequence defined in the value
of that attribute is the address of the ELF symbol.

The problem is that the DWARF reader of Libabigail fails to get the
address of the underlying ELF symbol when the DW_AT_low_pc attribute
is missing.  Rather, it should then look at the value of the
DW_AT_ranges attribute instead.

This is what this patch does.

* src/abg-dwarf-reader.cc
(read_context::get_first_address_from_DW_AT_ranges): Define new
member function.
(read_context::get_function_address): Use the new
read_context::get_first_address_from_DW_AT_ranges here.
* tests/data/test-diff-dwarf/PR25058-liblttng-ctl-report-1.txt:
New reference test output.
* tests/data/test-diff-dwarf/PR25058-liblttng-ctl.so: New test
input binary.
* tests/data/test-diff-dwarf/PR25058-liblttng-ctl2.10.so: New test
input binary.
* tests/data/Makefile.am: Add the new test materials above to
source distribution.
* tests/test-diff-dwarf.cc (in_out_specs): Add the new input test
input binary files to this test harness.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
src/abg-dwarf-reader.cc
tests/data/Makefile.am
tests/data/test-diff-dwarf/PR25058-liblttng-ctl-report-1.txt [new file with mode: 0644]
tests/data/test-diff-dwarf/PR25058-liblttng-ctl.so [new file with mode: 0644]
tests/data/test-diff-dwarf/PR25058-liblttng-ctl2.10.so [new file with mode: 0644]
tests/test-diff-dwarf.cc