This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Add debug_function_graph_to_file
- From: Martin Jambor <mjambor at suse dot cz>
- To: Richard Biener <richard dot guenther at gmail dot com>
- Cc: Marek Polacek <polacek at redhat dot com>, Tom de Vries <Tom_deVries at mentor dot com>, "gcc-patches at gnu dot org" <gcc-patches at gnu dot org>
- Date: Thu, 18 Feb 2016 15:11:29 +0100
- Subject: Re: [PATCH] Add debug_function_graph_to_file
- Authentication-results: sourceware.org; auth=none
- References: <56C46FE1 dot 4040000 at mentor dot com> <CAFiYyc15LuWDHcGHGjv1z6AVtVoPXrfHBnfWAK=p9K=wzquE9g at mail dot gmail dot com> <20160217135114 dot GV3163 at redhat dot com> <CAFiYyc0CB4k7a9Fp9Yzg1Y959OyKB4KwPH89spSTJFNo1JpA4A at mail dot gmail dot com>
On Wed, Feb 17, 2016 at 03:00:00PM +0100, Richard Biener wrote:
> On Wed, Feb 17, 2016 at 2:51 PM, Marek Polacek <polacek@redhat.com> wrote:
> > On Wed, Feb 17, 2016 at 02:45:36PM +0100, Richard Biener wrote:
> >> OTOH I have in my local trees a more convenient form (attached).
> >>
> >> (gdb) call debug_dot_cfg (cfun, 1<<6)
> >>
> >> and a X window with the dotted graph opens.
> >
> > Is there any chance we could get this into the mainline? I'd love to use
> > this without having to patch my tree locally. If I remember correctly
> > there were some issues with unportable popen()?
>
> I think I never posted it for inclusion. The ??? would also need investigation,
> probably using a temporary file is easier (though would require manual
> cleaning).
>
> What does it take to write it in python instead?
It should be fairly easy. I played with python in gdb more than two
years ago and forgot most of it, but the following script still works
and still can use dot to generate and feh to immediately display call
graph from within gdb, the newly installed gdb command for that is
called symtab_visualize:
https://github.com/jamborm/gcc-util/blob/master/python/gdbsymtab.py
And I also think that using python is the way to go. The only
downside is that you only find out that gcc and the script are out of
sync when debugging no longer works and fails in mysterious ways and
fixing the python script can be a daunting task if you are not its
author or have long forgotten how it worked (or how the whole
gdb-python thing worked).
(And yes, I know it is bad I have my own gdb python scripts and don't
use gcc/gdbhooks.py. I forgot why that happened.)
Martin