[Ada] Restore hex addresses and improve symbolic backtraces
authorOlivier Hainque <hainque@adacore.com>
Wed, 2 Sep 2020 17:10:59 +0000 (19:10 +0200)
committerPierre-Marie de Rodat <derodat@adacore.com>
Mon, 26 Oct 2020 08:59:03 +0000 (04:59 -0400)
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

index abb499c..d8b15c5 100644 (file)
@@ -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 ???");