/* Exception (throw catch) mechanism, for GDB, the GNU debugger.
- Copyright (C) 1986-2018 Free Software Foundation, Inc.
+ Copyright (C) 1986-2019 Free Software Foundation, Inc.
This file is part of GDB.
stack, the NULL check is needed here because we can get here very
early during startup, before the target stack is first
initialized. */
- if (target_stack != NULL && target_supports_terminal_ours ())
+ if (current_top_target () != NULL && target_supports_terminal_ours ())
{
term_state.emplace ();
target_terminal::ours_for_output ();
}
static void
-print_exception (struct ui_file *file, struct gdb_exception e)
+print_exception (struct ui_file *file, const struct gdb_exception &e)
{
/* KLUGE: cagney/2005-01-13: Write the string out one line at a time
as that way the MI's behavior is preserved. */
const char *start;
const char *end;
- for (start = e.message; start != NULL; start = end)
+ for (start = e.what (); start != NULL; start = end)
{
end = strchr (start, '\n');
if (end == NULL)
}
void
-exception_print (struct ui_file *file, struct gdb_exception e)
+exception_print (struct ui_file *file, const struct gdb_exception &e)
{
if (e.reason < 0 && e.message != NULL)
{
}
void
-exception_fprintf (struct ui_file *file, struct gdb_exception e,
+exception_fprintf (struct ui_file *file, const struct gdb_exception &e,
const char *prefix, ...)
{
if (e.reason < 0 && e.message != NULL)
/* See exceptions.h. */
int
-exception_print_same (struct gdb_exception e1, struct gdb_exception e2)
+exception_print_same (const struct gdb_exception &e1,
+ const struct gdb_exception &e2)
{
- const char *msg1 = e1.message;
- const char *msg2 = e2.message;
-
- if (msg1 == NULL)
- msg1 = "";
- if (msg2 == NULL)
- msg2 = "";
+ const char *msg1 = e1.message == nullptr ? "" : e1.what ();
+ const char *msg2 = e2.message == nullptr ? "" : e2.what ();
return (e1.reason == e2.reason
&& e1.error == e2.error