This patch improves the output of Treepr.pp. This routine is only for use in
gdb, so there is no test case available.

Tested on x86_64-pc-linux-gnu, committed on trunk

2011-12-05  Bob Duff  <d...@adacore.com>

        * treepr.adb (pn): Print something useful for
        Elmt_Ids. Add Write_Eol to 'when others' case, so the output
        will be seen immediately in gdb.

Index: treepr.adb
===================================================================
--- treepr.adb  (revision 182003)
+++ treepr.adb  (working copy)
@@ -273,7 +273,17 @@
          when Elist_Range =>
             Print_Tree_Elist (Elist_Id (N));
          when Elmt_Range =>
-            raise Program_Error;
+            declare
+               Id : constant Elmt_Id := Elmt_Id (N);
+            begin
+               if No (Id) then
+                  Write_Str ("No_Elmt");
+                  Write_Eol;
+               else
+                  Write_Str ("Elmt_Id --> ");
+                  Print_Tree_Node (Node (Id));
+               end if;
+            end;
          when Names_Range =>
             Namet.wn (Name_Id (N));
          when Strings_Range =>
@@ -285,6 +295,7 @@
          when others =>
             Write_Str ("Invalid Union_Id: ");
             Write_Int (Int (N));
+            Write_Eol;
       end case;
    end pn;
 

Reply via email to