aboutsummaryrefslogtreecommitdiff
path: root/gcc/dumpfile.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2020-05-25 16:10:12 +0200
committerRichard Biener <rguenther@suse.de>2020-05-27 11:07:37 +0200
commitf61f9b28793d94060ce858e5f8a080db91785779 (patch)
tree209e3957dcd0f54f72ea7ba599123b063db4430a /gcc/dumpfile.c
parentbaff22c48bdee9cb644b7336bf6f20f799531507 (diff)
downloadgcc-f61f9b28793d94060ce858e5f8a080db91785779.zip
gcc-f61f9b28793d94060ce858e5f8a080db91785779.tar.gz
gcc-f61f9b28793d94060ce858e5f8a080db91785779.tar.bz2
Add debug (slp_tree) and dump infrastructure for this
This adds an alternate debug_dump_context similar to the one for selftests but for interactive debugging routines. This allows to share code between user-visible dumping via the dump_* API and those debugging routines. The primary driver was SLP node dumping which wasn't accessible from inside a gdb session up to now. 2020-05-27 Richard Biener <rguenther@suse.de> * dump-context.h (debug_dump_context): New class. (dump_context): Make it friend. * dumpfile.c (debug_dump_context::debug_dump_context): Implement. (debug_dump_context::~debug_dump_context): Likewise. * tree-vect-slp.c: Include dump-context.h. (vect_print_slp_tree): Dump a single SLP node. (debug): New overload for slp_tree. (vect_print_slp_graph): Rename from vect_print_slp_tree and use that. (vect_analyze_slp_instance): Adjust.
Diffstat (limited to 'gcc/dumpfile.c')
-rw-r--r--gcc/dumpfile.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/gcc/dumpfile.c b/gcc/dumpfile.c
index 5471878..5d61946 100644
--- a/gcc/dumpfile.c
+++ b/gcc/dumpfile.c
@@ -2078,6 +2078,34 @@ enable_rtl_dump_file (void)
return num_enabled > 0;
}
+/* debug_dump_context's ctor. Temporarily override the dump_context
+ (to forcibly enable output to stderr). */
+
+debug_dump_context::debug_dump_context ()
+: m_context (),
+ m_saved (&dump_context::get ()),
+ m_saved_flags (dump_flags),
+ m_saved_pflags (pflags),
+ m_saved_file (dump_file)
+{
+ set_dump_file (stderr);
+ dump_context::s_current = &m_context;
+ pflags = dump_flags = MSG_ALL_KINDS | MSG_ALL_PRIORITIES;
+ dump_context::get ().refresh_dumps_are_enabled ();
+}
+
+/* debug_dump_context's dtor. Restore the saved dump_context. */
+
+debug_dump_context::~debug_dump_context ()
+{
+ set_dump_file (m_saved_file);
+ dump_context::s_current = m_saved;
+ dump_flags = m_saved_flags;
+ pflags = m_saved_pflags;
+ dump_context::get ().refresh_dumps_are_enabled ();
+}
+
+
#if CHECKING_P
namespace selftest {