procedure pe (N : Union_Id) renames pn;
+ ---------
+ -- pec --
+ ---------
+
+ procedure pec (From : Entity_Id) is
+ begin
+ Push_Output;
+ Set_Standard_Output;
+
+ Print_Entity_Chain (From);
+
+ Pop_Output;
+ end pec;
+
+ ----------
+ -- rpec --
+ ----------
+
+ procedure rpec (From : Entity_Id) is
+ begin
+ Push_Output;
+ Set_Standard_Output;
+
+ Print_Entity_Chain (From, Rev => True);
+
+ Pop_Output;
+ end rpec;
+
--------
-- pl --
--------
end if;
end Print_End_Span;
+ ------------------------
+ -- Print_Entity_Chain --
+ ------------------------
+
+ procedure Print_Entity_Chain (From : Entity_Id; Rev : Boolean := False) is
+ Ent : Entity_Id := From;
+ begin
+ Printing_Descendants := False;
+ Phase := Printing;
+
+ loop
+ declare
+ Next_Ent : constant Entity_Id :=
+ (if Rev then Prev_Entity (Ent) else Next_Entity (Ent));
+
+ Prefix_Char : constant Character :=
+ (if Present (Next_Ent) then '|' else ' ');
+ begin
+ Print_Node (Ent, "", Prefix_Char);
+
+ exit when No (Next_Ent);
+
+ Ent := Next_Ent;
+
+ Print_Char ('|');
+ Print_Eol;
+ end;
+ end loop;
+ end Print_Entity_Chain;
+
-----------------------
-- Print_Entity_Info --
-----------------------
-- Prints the subtree consisting of the given element list and all its
-- referenced descendants.
+ procedure Print_Entity_Chain (From : Entity_Id; Rev : Boolean := False);
+ -- Prints the entity chain From is on, starting from From. In other words,
+ -- prints From and then recursively follow the Next_Entity field. If Rev is
+ -- True, prints the chain backwards, i.e. follow the Last_Entity field
+ -- instead of Next_Entity.
+
-- The following debugging procedures are intended to be called from gdb.
-- Note that in several cases there are synonyms which represent historical
-- development, and we keep them because some people are used to them!
-- on the left and add a minus sign. This just saves some typing in the
-- debugger.
+ procedure pec (From : Entity_Id);
+ pragma Export (Ada, pec);
+ -- Print From and the entities that follow it on its entity chain
+
+ procedure rpec (From : Entity_Id);
+ pragma Export (Ada, rpec);
+ -- Like pec, but walk the entity chain backwards. The 'r' stands for
+ -- "reverse".
end Treepr;