@@ -78,6 +78,7 @@ extern void verbatim (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2);
extern bool emit_diagnostic (diagnostic_t, location_t, int,
const char *, ...) ATTRIBUTE_GCC_DIAG(4,5);
extern bool seen_error (void);
+extern void dump_backtrace (void);
#ifdef BUFSIZ
/* N.B. Unlike all the others, fnotice is just gettext+fprintf, and
@@ -1111,6 +1111,19 @@ fatal_error (const char *gmsgid, ...)
gcc_unreachable ();
}
+/* Intended for compiler developers to trace the compiler's call stack
+ to stderr without affecting compilation state. The trace generated
+ here is the same as would occur with an ICE. */
+DEBUG_FUNCTION void
+dump_backtrace (void)
+{
+ struct backtrace_state *state =
+ backtrace_create_state (NULL, 0, bt_err_callback, NULL);
+ int count = 0;
+ if (state != NULL)
+ backtrace_full (state, 2, bt_callback, bt_err_callback, (void *) &count);
+}
+
/* An internal consistency check has failed. We make no attempt to
continue. Note that unless there is debugging value to be had from
a more specific message, or some other good reason, you should use