On 05/07/2024 09:59, Richard Biener wrote:
> On Fri, 5 Jul 2024, Alex Coplan wrote:
> 
> > Hi,
> > 
> > This adds a debug function to dump the dominator tree in dot/graphviz
> > format.  The idea is that the function can be called in GDB, the output
> > copy/pasted into a .dot file and then rendered using graphviz.
> > 
> > Bootstrapped/regtested on aarch64-linux-gnu, OK for trunk?
> 
> Can you follow other APIs here and rename and use a FILE * arg?
> 
> DEBUG_FUNCTION void
> dot_dominance_tree (FILE *f, enum cdi_direction dir)
> ...
> 
> that way in gdb you can do
> 
> (gdb) p fopen ("/tmp/x.dot", "w")
> (gdb) p dot_dominance_tree ($1, CDI_DOMINATORS);
> (gdb0 p fclose ($1);
> 
> and then dot the file?  It's also easier to use this from a
> gdb python wrapper which can do the above as well.  In other
> places there's then an overload with a const char *fname argument
> doing the fopen/fclose itself.

Yes, that sounds much better (it would certainly be more useable in
bigger functions that way).  I'll give that a go (including the
convenience overload), thanks.

Alex

> 
> Thanks,
> Richard.
> 
> > Thanks,
> > Alex
> > 
> > gcc/ChangeLog:
> > 
> >     * dominance.cc (debug_dominance_tree_dot): New.
> > 
> 
> -- 
> Richard Biener <rguent...@suse.de>
> SUSE Software Solutions Germany GmbH,
> Frankenstrasse 146, 90461 Nuernberg, Germany;
> GF: Ivo Totev, Andrew McDonald, Werner Knoblich; (HRB 36809, AG Nuernberg)

Reply via email to