[PATCH] DOT a function directly from a gdb session

Marek Polacek polacek@redhat.com
Wed Dec 12 13:54:00 GMT 2012


On Wed, Dec 12, 2012 at 01:53:53PM +0100, Richard Biener wrote:
> 
> This adds the function print_graph_cfg that you can call from a
> gdb session and directly pipes a dot representation of the
> function to 'dot -Tx11'.  The only change needed to the now very
> good dumping code is splitting out the actual worker without
> the FILE handling.

Thanks, I like it.  Just a little correction: from gdb session we want
probably call debug_dot_cfg (cfun).
Also, usually I get an ICE, e.g.:
(gdb) b cleanup_cfg
Breakpoint 1 at 0xe7f260: file /home/marek/src/gcc/gcc/cfgcleanup.c, line 2946.
(gdb) r
Starting program: /home/marek/rh/x/trunk/gcc/cc1plus -O2 -ftracer -fno-tree-dce -fno-tree-sra x.c -quiet

Breakpoint 1, cleanup_cfg (mode=16) at /home/marek/src/gcc/gcc/cfgcleanup.c:2946
2946	{
(gdb) call debug_dot_cfg(cfun)
Detaching after fork from child process 2458.
x.c: In function ‘int main()’:
x.c:9:1: internal compiler error: in pre_and_rev_post_order_compute, at cfganal.c:869
 }
 ^
0x78fb4c pre_and_rev_post_order_compute(int*, int*, bool)
	/home/marek/src/gcc/gcc/cfganal.c:869
0xebceb2 print_graph_cfg_1
	/home/marek/src/gcc/gcc/graph.c:186
0xebd2a1 debug_dot_cfg(function*)
	/home/marek/src/gcc/gcc/graph.c:259

When I can call debug_dot_cfg and when not?

	Marek



More information about the Gcc-patches mailing list