This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[tree-ssa] Draw the CFG


Hi,

This patch allows you to write "p draw_tree_cfg ()" from gdb.
(... well, you have to use it at least once, otherwise its symbol 
is deleted, same problem as for the browse_tree function).
It is in my tree from December or so.  Thanks to Dan Berlin for 
the "system" call.  

Ok?

	* tree-cfg.c (draw_tree_cfg): New function.

Index: tree-cfg.c
===================================================================
RCS file: /home/pop/cvsroot/gcc-cvs/gcc/gcc/Attic/tree-cfg.c,v
retrieving revision 1.1.4.71
diff -u -3 -p -c -r1.1.4.71 tree-cfg.c
*** tree-cfg.c	9 Apr 2003 19:27:40 -0000	1.1.4.71
--- tree-cfg.c	13 Apr 2003 23:35:31 -0000
*************** tree_cfg2dot (file)
*** 1996,2002 ****
--- 1996,2021 ----
    fputs ("}\n\n", file);
  }
  
+ extern void draw_tree_cfg  PARAMS (());
  
+ /* Draw the flow graph.  */
+ 
+ void 
+ draw_tree_cfg ()
+ {
+   FILE *dump_file;
+   
+   if (n_basic_blocks > 0)
+     {
+       dump_file = fopen ("tree_cfg.dot", "w");
+       if (dump_file)
+ 	{
+ 	  tree_cfg2dot (dump_file);
+ 	  fclose (dump_file);
+ 	  system ("dotty tree_cfg.dot");
+ 	}
+     }
+ }
  
  /*---------------------------------------------------------------------------
  			     Miscellaneous helpers


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]