#endif
}
+#ifdef GDB_PRINT_INTERNAL_BACKTRACE
#ifdef GDB_PRINT_INTERNAL_BACKTRACE_USING_LIBBACKTRACE
/* Callback used by libbacktrace if it encounters an error. */
sig_write (_("Backtrace might be incomplete.\n"));
}
+#else
+#error "unexpected internal backtrace policy"
#endif
+#endif /* GDB_PRINT_INTERNAL_BACKTRACE */
/* See bt-utils.h. */
if (current_ui == nullptr)
return;
+#ifdef GDB_PRINT_INTERNAL_BACKTRACE
const auto sig_write = [] (const char *msg) -> void
{
gdb_stderr->write_async_safe (msg, strlen (msg));
sig_write (_("----- Backtrace -----\n"));
-#ifdef GDB_PRINT_INTERNAL_BACKTRACE
if (gdb_stderr->fd () > -1)
gdb_internal_backtrace_1 ();
else
-#endif
sig_write (_("Backtrace unavailable\n"));
sig_write ("---------------------\n");
+#endif
}
/* Support for printing a backtrace when GDB hits an error. This is not
for printing backtraces of the inferior, but backtraces of GDB itself. */
+#ifndef BT_UTILS_H
+#define BT_UTILS_H
+
#ifdef HAVE_LIBBACKTRACE
# include "backtrace.h"
# include "backtrace-supported.h"
extern void gdb_internal_backtrace_set_cmd (const char *args, int from_tty,
cmd_list_element *c);
+
+#endif /* BT_UTILS_H */