This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[tree-ssa] Draw the CFG
- From: Pop Sébastian <pop at gauvain dot u-strasbg dot fr>
- To: dnovillo at redhat dot com, gcc-patches at gcc dot gnu dot org
- Date: Mon, 14 Apr 2003 01:39:50 +0200
- Subject: [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