https://gcc.gnu.org/g:1d148e0401b599a3cae4183d3f33b7fa65c40464
commit r15-6354-g1d148e0401b599a3cae4183d3f33b7fa65c40464 Author: Simon Wright <si...@pushface.org> Date: Wed Dec 18 22:26:27 2024 +0100 Output the load address in backtraces for PIE executables on Darwin This aligns Darwin with Linux and Windows. gcc/ada/ PR target/117538 * libgnat/s-trasym.adb (Symbolic_Traceback): Prepend the load address of the executable if it is not null. Diff: --- gcc/ada/libgnat/s-trasym.adb | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/gcc/ada/libgnat/s-trasym.adb b/gcc/ada/libgnat/s-trasym.adb index 894fcf37ffde..e681035cf923 100644 --- a/gcc/ada/libgnat/s-trasym.adb +++ b/gcc/ada/libgnat/s-trasym.adb @@ -69,7 +69,25 @@ package body System.Traceback.Symbolic is end loop; Result (Last) := ASCII.LF; - return Result (1 .. Last); + + declare + function Executable_Load_Address return System.Address; + pragma Import + (C, Executable_Load_Address, + "__gnat_get_executable_load_address"); + + Load_Address : constant System.Address := + Executable_Load_Address; + begin + if Load_Address = System.Null_Address then + return Result (1 .. Last); + else + return "Load address: 0x" + & System.Address_Image (Load_Address) + & ASCII.LF + & Result (1 .. Last); + end if; + end; end; end if; end Symbolic_Traceback;