[Ada] Robustify traceback symbolization from dwarf info
authorOlivier Hainque <hainque@adacore.com>
Mon, 21 May 2018 14:50:38 +0000 (14:50 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Mon, 21 May 2018 14:50:38 +0000 (14:50 +0000)
commit0f090200e7ee7d1ee9d6b84b482618dcba14d92f
treec72e689de22676a2278a8bc7919c766d5a8d6fa8
parentb029cc6e6b65a4ee55fa2b8790092f6edaee2e71
[Ada] Robustify traceback symbolization from dwarf info

Symbolization of traceback entries from dwarf info is
failing in multiple cases for addresses originating from
shared libraries.

Part of the problem is a confusion across different functions
regarding the kind of "address" at hand, sometimes full process
runtime addresses (e.g. in traceback entries), sometimes module
relative (e.g. in dwarf info segments).

This change fixes this by introducing the use of distinct types
for the two kinds of addresses, resorting to System.Address
for runtime addresses and to Storage_Elements.Storage_Offset
for module relative values. The accompanying code changes
tidy a few places where we can now use standard operators
to combine offets & addresses, and include a few corrections
of consistency problems at spots where comparisons were done
between runtime addresses and relative offsets.

2018-05-21  Olivier Hainque  <hainque@adacore.com>

gcc/ada/

* libgnat/s-dwalin.ads (Dwarf_Context): Change type of Load_Address to
Address, and type of Low, High to Storage_Offset.
(Low): Rename as Low_Address and convey that the return value is a
runtime reference accounting for a load address.
* libgnat/s-dwalin.adb (Read_Aranges_Entry): Adjust to the
address/offset type changes.
(Aranges_Lookup): Likewise.
(Symbolic_Address): Likewise.
(Symbolic_Traceback): Likewise.
(Dump_Cache): Likewise.
(Is_Inside): Likewise.
(Open): Likewise.
(Set_Load_Address): Likewise.
(Low_Address): Likewise, and account for C.Load_Address.
* libgnat/s-trasym__dwarf.adb (Lt): Use Low_Address instead of Low.
(Multi_Module_Symbolic_Traceback): Compare address in traceback
with module Low_Address instead of Low.

From-SVN: r260450
gcc/ada/ChangeLog
gcc/ada/libgnat/s-dwalin.adb
gcc/ada/libgnat/s-dwalin.ads
gcc/ada/libgnat/s-trasym__dwarf.adb