aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2024-09-06 10:05:58 +0200
committerMarc Poulhiès <dkm@gcc.gnu.org>2024-10-08 10:37:12 +0200
commitd9b76deb580eb4fc5046d6c0263f420acaa444c9 (patch)
tree8681321c1f548ca5a2ec85a51d5aa765e7478ab3 /gcc
parent4aa366fcb2a1a1d359207c6826f04be696d5e547 (diff)
downloadgcc-d9b76deb580eb4fc5046d6c0263f420acaa444c9.zip
gcc-d9b76deb580eb4fc5046d6c0263f420acaa444c9.tar.gz
gcc-d9b76deb580eb4fc5046d6c0263f420acaa444c9.tar.bz2
ada: Print the load address in symbolic backtraces
The load address of PIE executables is printed in non-symbolic backtraces (-E binder switch) but it makes sense to print it in symbolic backtraces (-Es binder switch) too, because symbolic backtraces may degenerate into non-symbolic ones when the executable is stripped for example. gcc/ada/ChangeLog: * libgnat/s-trasym__dwarf.adb (LDAD_Header): New String constant. (Symbolic_Traceback): Print the load address of the executable at the beginning if it is not null.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/libgnat/s-trasym__dwarf.adb12
1 files changed, 11 insertions, 1 deletions
diff --git a/gcc/ada/libgnat/s-trasym__dwarf.adb b/gcc/ada/libgnat/s-trasym__dwarf.adb
index 1b36804..6182316 100644
--- a/gcc/ada/libgnat/s-trasym__dwarf.adb
+++ b/gcc/ada/libgnat/s-trasym__dwarf.adb
@@ -637,14 +637,24 @@ package body System.Traceback.Symbolic is
-- Symbolic_Traceback --
------------------------
+ LDAD_Header : constant String := "Load address: ";
+ -- Copied from Ada.Exceptions.Exception_Data
+
function Symbolic_Traceback
(Traceback : Tracebacks_Array;
Suppress_Hex : Boolean) return String
is
- Res : Bounded_String (Max_Length => Max_String_Length);
+ Load_Address : constant Address := Get_Executable_Load_Address;
+ Res : Bounded_String (Max_Length => Max_String_Length);
+
begin
System.Soft_Links.Lock_Task.all;
Init_Exec_Module;
+ if Load_Address /= Null_Address then
+ Append (Res, LDAD_Header);
+ Append_Address (Res, Load_Address);
+ Append (Res, ASCII.LF);
+ end if;
Symbolic_Traceback_No_Lock (Traceback, Suppress_Hex, Res);
System.Soft_Links.Unlock_Task.all;