1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
10 -- Copyright (C) 1992-1998 Free Software Foundation, Inc. --
12 -- GNAT is free software; you can redistribute it and/or modify it under --
13 -- terms of the GNU General Public License as published by the Free Soft- --
14 -- ware Foundation; either version 2, or (at your option) any later ver- --
15 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
16 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
17 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
18 -- for more details. You should have received a copy of the GNU General --
19 -- Public License distributed with GNAT; see file COPYING. If not, write --
20 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
21 -- MA 02111-1307, USA. --
23 -- GNAT was originally developed by the GNAT team at New York University. --
24 -- Extensive contributions were provided by Ada Core Technologies Inc. --
26 ------------------------------------------------------------------------------
28 with Atree; use Atree;
29 with Debug; use Debug;
30 with Sinfo; use Sinfo;
31 with Sinput; use Sinput;
32 with Output; use Output;
34 package body Debug_A is
36 Debug_A_Depth : Natural := 0;
37 -- Output for the debug A flag is preceded by a sequence of vertical bar
38 -- characters corresponding to the recursion depth of the actions being
39 -- recorded (analysis, expansion, resolution and evaluation of nodes)
40 -- This variable records the depth.
42 Max_Node_Ids : constant := 200;
43 -- Maximum number of Node_Id values that get stacked
45 Node_Ids : array (1 .. Max_Node_Ids) of Node_Id;
46 -- A stack used to keep track of Node_Id values for setting the value of
47 -- Current_Error_Node correctly. Note that if we have more than 200
48 -- recursion levels, we just don't reset the right value on exit, which
49 -- is not crucial, since this is only for debugging!
51 -----------------------
52 -- Local Subprograms --
53 -----------------------
55 procedure Debug_Output_Astring;
56 -- Outputs Debug_A_Depth number of vertical bars, used to preface messages
62 procedure Debug_A_Entry (S : String; N : Node_Id) is
67 Write_Str ("Node_Id = ");
70 Write_Location (Sloc (N));
72 Write_Str (Node_Kind'Image (Nkind (N)));
76 Debug_A_Depth := Debug_A_Depth + 1;
77 Current_Error_Node := N;
79 if Debug_A_Depth <= Max_Node_Ids then
80 Node_Ids (Debug_A_Depth) := N;
88 procedure Debug_A_Exit (S : String; N : Node_Id; Comment : String) is
90 Debug_A_Depth := Debug_A_Depth - 1;
92 if Debug_A_Depth in 1 .. Max_Node_Ids then
93 Current_Error_Node := Node_Ids (Debug_A_Depth);
99 Write_Str ("Node_Id = ");
106 --------------------------
107 -- Debug_Output_Astring --
108 --------------------------
110 procedure Debug_Output_Astring is
111 Vbars : String := "|||||||||||||||||||||||||";
112 -- Should be constant, removed because of GNAT 1.78 bug ???
115 if Debug_A_Depth > Vbars'Length then
116 for I in Vbars'Length .. Debug_A_Depth loop
123 Write_Str (Vbars (1 .. Debug_A_Depth));
125 end Debug_Output_Astring;