From: Jan Hubicka <hubicka@ucw.cz>
To: "Martin Liška" <mliska@suse.cz>
Cc: gcc-patches@gcc.gnu.org, Martin Jambor <mjambor@suse.cz>
Subject: Re: [PATCH] Add cgraph_edge::debug function.
Date: Thu, 24 Sep 2020 17:52:40 +0200 [thread overview]
Message-ID: <20200924155240.GC81257@kam.mff.cuni.cz> (raw)
In-Reply-To: <6ac4094f-ac0a-f128-9594-e8470f2503f9@suse.cz>
> I see it handy to debug cgraph_edge and I've dumped it manually many times.
> Maybe it's time to come up with the function? Example output:
>
> (gdb) p e->debug()
> ag/9 -> h/3 (1 (adjusted),0.25 per call)
>
> ag/9 (ag) @0x7ffff773eca8
> Type: function definition analyzed
> Visibility: public
> next sharing asm name: 7
> References: table/5 (addr)
> Referring:
> Function ag/9 is inline copy in ap/4
> Clone of ag/7
> Availability: local
> Function flags: count:2 (adjusted) first_run:6 body local hot
> Called by: ai/8 (inlined) (indirect_inlining) (4 (adjusted),1.00 per call)
> Calls: h/3 (1 (adjusted),0.25 per call)
> h/3 (h) @0x7ffff772b438
> Type: function definition analyzed
> Visibility: externally_visible public
> References: ap/4 (addr)
> Referring:
> Availability: available
> Profile id: 1806506296
> Function flags: count:4 (precise) first_run:3 body hot
> Called by: ag/9 (1 (adjusted),0.25 per call) ag/7 (1 (adjusted),0.25 per call) ag/0 (2 (estimated locally, globally 0 adjusted),0.50 per call) bug/2 (1 (precise),1.00 per call) bug/2 (1 (precise),1.00 per call)
> Calls: ai/1 (4 (precise),1.00 per call)
>
> (gdb) p ie->debug()
> ai/1 -> (null) (speculative) (0 (adjusted),0.00 per call)
>
> ai/1 (ai) @0x7ffff772b168
> Type: function definition analyzed
> Visibility: prevailing_def_ironly
> previous sharing asm name: 8
> References: table/5 (addr) ap/4 (addr) (speculative) ag/0 (addr) (speculative)
> Referring:
> Function ai/1 is inline copy in h/3
> Availability: local
> Profile id: 1923518911
> Function flags: count:4 (precise) first_run:4 body local hot
> Called by: h/3 (inlined) (4 (precise),1.00 per call)
> Calls: ag/7 (speculative) (inlined) (2 (adjusted),0.50 per call) ap/4 (speculative) (2 (adjusted),0.50 per call) PyErr_Format/6 (0 (precise),0.00 per call)
> Indirect call(speculative) (0 (adjusted),0.00 per call) of param:1 (vptr maybe changed) Num speculative call targets: 2
>
> Ready to be installed?
> Thanks,
> Martin
>
> gcc/ChangeLog:
>
> * cgraph.c (cgraph_edge::debug): New.
> * cgraph.h (cgraph_edge::debug): New.
OK,
Honza
> ---
> gcc/cgraph.c | 14 ++++++++++++++
> gcc/cgraph.h | 3 +++
> 2 files changed, 17 insertions(+)
>
> diff --git a/gcc/cgraph.c b/gcc/cgraph.c
> index b43adaac7c0..46c3b124b1a 100644
> --- a/gcc/cgraph.c
> +++ b/gcc/cgraph.c
> @@ -2072,6 +2072,20 @@ cgraph_edge::dump_edge_flags (FILE *f)
> fprintf (f, "(can throw external) ");
> }
> +/* Dump edge to stderr. */
> +
> +void
> +cgraph_edge::debug (void)
> +{
> + fprintf (stderr, "%s -> %s ", caller->dump_asm_name (),
> + callee == NULL ? "(null)" : callee->dump_asm_name ());
> + dump_edge_flags (stderr);
> + fprintf (stderr, "\n\n");
> + caller->debug ();
> + if (callee != NULL)
> + callee->debug ();
> +}
> +
> /* Dump call graph node to file F. */
> void
> diff --git a/gcc/cgraph.h b/gcc/cgraph.h
> index 0211f08964f..96d6cf609fe 100644
> --- a/gcc/cgraph.h
> +++ b/gcc/cgraph.h
> @@ -2022,6 +2022,9 @@ private:
> /* Output flags of edge to a file F. */
> void dump_edge_flags (FILE *f);
> + /* Dump edge to stderr. */
> + void DEBUG_FUNCTION debug (void);
> +
> /* Verify that call graph edge corresponds to DECL from the associated
> statement. Return true if the verification should fail. */
> bool verify_corresponds_to_fndecl (tree decl);
> --
> 2.28.0
>
prev parent reply other threads:[~2020-09-24 15:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-24 14:31 Martin Liška
2020-09-24 15:52 ` Jan Hubicka [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200924155240.GC81257@kam.mff.cuni.cz \
--to=hubicka@ucw.cz \
--cc=gcc-patches@gcc.gnu.org \
--cc=mjambor@suse.cz \
--cc=mliska@suse.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).