Created
October 20, 2024 18:43
-
-
Save iains/f2a97ad58533eafb7942b8513bfecf65 to your computer and use it in GitHub Desktop.
some debug functions that can help in GDB.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| DEBUG_FUNCTION void | |
| coro_pretty_p_statements (tree stmts, const char *msg = NULL) | |
| { | |
| if (msg) | |
| fprintf (stderr, "%s", msg); | |
| cxx_pretty_printer pp; | |
| pp.set_output_stream (stderr); | |
| if (stmts) | |
| { | |
| pp_newline_and_indent (&pp, 0); | |
| pp.statement (stmts); | |
| } | |
| else | |
| pp_string (&pp, "<null>"); | |
| pp_newline_and_flush (&pp); | |
| } | |
| DEBUG_FUNCTION void | |
| coro_pretty_p_expression (tree expr, const char *msg = NULL) | |
| { | |
| if (msg) | |
| fprintf (stderr, "%s", msg); | |
| cxx_pretty_printer pp; | |
| pp.set_output_stream (stderr); | |
| if (expr) | |
| { | |
| pp_newline_and_indent (&pp, 0); | |
| pp.expression (expr); | |
| } | |
| else | |
| pp_string (&pp, "<null>"); | |
| pp_newline_and_flush (&pp); | |
| } | |
| DEBUG_FUNCTION void | |
| coro_pretty_p_decl (tree decl, const char *msg = NULL) | |
| { | |
| if (msg) | |
| fprintf (stderr, "%s", msg); | |
| cxx_pretty_printer pp; | |
| pp.set_output_stream (stderr); | |
| if (decl) | |
| { | |
| pp_newline_and_indent (&pp, 0); | |
| pp.declarator (decl); | |
| } | |
| else | |
| pp_string (&pp, "<null>"); | |
| pp_newline_and_flush (&pp); | |
| } | |
| DEBUG_FUNCTION void | |
| coro_pretty_p_type (tree type, const char *msg = NULL) | |
| { | |
| if (msg) | |
| fprintf (stderr, "%s", msg); | |
| cxx_pretty_printer pp; | |
| pp.set_output_stream (stderr); | |
| if (type) | |
| { | |
| pp_newline_and_indent (&pp, 0); | |
| pp.type_id (type); | |
| } | |
| else | |
| pp_string (&pp, "<null>"); | |
| pp_newline_and_flush (&pp); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment