From d111f09ee50cdf65bbcd8b6bd8c0e764431810ff Mon Sep 17 00:00:00 2001 From: Olivier Hainque Date: Wed, 2 Sep 2020 19:10:59 +0200 Subject: [PATCH] [Ada] Restore hex addresses and improve symbolic backtraces gcc/ada/ * libgnat/s-dwalin.adb (Symbolic_Traceback): Always emit the hex address at the beginning of an entry if suppression is not requested. Consistently output a "???" for the subprogram name when it is unknown. --- gcc/ada/libgnat/s-dwalin.adb | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/gcc/ada/libgnat/s-dwalin.adb b/gcc/ada/libgnat/s-dwalin.adb index abb499c35cb..d8b15c5dd66 100644 --- a/gcc/ada/libgnat/s-dwalin.adb +++ b/gcc/ada/libgnat/s-dwalin.adb @@ -1582,6 +1582,13 @@ package body System.Dwarf_Lines is Subprg_Name, Line_Num); + -- If we're not requested to suppress hex addresses, emit it now. + + if not Suppress_Hex then + Append_Address (Res, Addr_In_Traceback); + Append (Res, ' '); + end if; + if File_Name /= null then declare Last : constant Natural := String_Length (File_Name); @@ -1626,26 +1633,22 @@ package body System.Dwarf_Lines is (Res, String (Subprg_Name.Ptr (Off .. Subprg_Name.Len))); end if; - Append (Res, ' '); + else + Append (Res, "???"); end if; - Append (Res, "at "); + Append (Res, " at "); Append (Res, String (File_Name (1 .. Last))); Append (Res, ':'); Append (Res, Line_Image (2 .. Line_Image'Last)); end; else - if Suppress_Hex then - Append (Res, "..."); - else - Append_Address (Res, Addr_In_Traceback); - end if; - if Subprg_Name.Len > 0 then Off := Strip_Leading_Char (C.Obj.all, Subprg_Name); - Append (Res, ' '); Append (Res, String (Subprg_Name.Ptr (Off .. Subprg_Name.Len))); + else + Append (Res, "???"); end if; Append (Res, " at ???"); -- 2.30.2