From b2784a9698ffdd6cd8434694c11336e9f7905be5 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Thu, 24 Sep 2020 16:29:49 +0200 Subject: [PATCH] Add cgraph_edge::debug function. gcc/ChangeLog: * cgraph.c (cgraph_edge::debug): New. * cgraph.h (cgraph_edge::debug): New. --- gcc/cgraph.c | 14 ++++++++++++++ gcc/cgraph.h | 3 +++ 2 files changed, 17 insertions(+) diff --git a/gcc/cgraph.c b/gcc/cgraph.c index eb5f1a56c26..f018020fa4b 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.30.2