/* Top level stuff for GDB, the GNU debugger.
- Copyright (C) 1999-2016 Free Software Foundation, Inc.
+ Copyright (C) 1999-2017 Free Software Foundation, Inc.
Written by Elena Zannoni <ezannoni@cygnus.com> of Cygnus Solutions.
sjlj-based TRY/CATCH mechanism, which knows to handle multiple
levels of active setjmp/longjmp frames, needed in order to handle
the readline callback recursing, as happens with e.g., secondary
- prompts / queries, through gdb_readline_wrapper. */
+ prompts / queries, through gdb_readline_wrapper. This must be
+ noexcept in order to avoid problems with mixing sjlj and
+ (sjlj-based) C++ exceptions. */
-static void
-gdb_rl_callback_read_char_wrapper (gdb_client_data client_data)
+static struct gdb_exception
+gdb_rl_callback_read_char_wrapper_noexcept () noexcept
{
struct gdb_exception gdb_expt = exception_none;
}
END_CATCH_SJLJ
+ return gdb_expt;
+}
+
+static void
+gdb_rl_callback_read_char_wrapper (gdb_client_data client_data)
+{
+ struct gdb_exception gdb_expt
+ = gdb_rl_callback_read_char_wrapper_noexcept ();
+
/* Rethrow using the normal EH mechanism. */
if (gdb_expt.reason < 0)
throw_exception (gdb_expt);
/* GDB's readline callback handler. Calls the current INPUT_HANDLER,
and propagates GDB exceptions/errors thrown from INPUT_HANDLER back
- across readline. See gdb_rl_callback_read_char_wrapper. */
+ across readline. See gdb_rl_callback_read_char_wrapper. This must
+ be noexcept in order to avoid problems with mixing sjlj and
+ (sjlj-based) C++ exceptions. */
static void
-gdb_rl_callback_handler (char *rl)
+gdb_rl_callback_handler (char *rl) noexcept
{
struct gdb_exception gdb_rl_expt = exception_none;
struct ui *ui = current_ui;
struct ui *current_ui;
struct ui *ui_list;
-/* See top.h. */
-
-void
-restore_ui_cleanup (void *data)
-{
- current_ui = (struct ui *) data;
-}
-
-/* See top.h. */
-
-void
-switch_thru_all_uis_init (struct switch_thru_all_uis *state)
-{
- state->iter = ui_list;
- state->old_chain = make_cleanup (restore_ui_cleanup, current_ui);
-}
-
-/* See top.h. */
-
-int
-switch_thru_all_uis_cond (struct switch_thru_all_uis *state)
-{
- if (state->iter != NULL)
- {
- current_ui = state->iter;
- return 1;
- }
- else
- {
- do_cleanups (state->old_chain);
- return 0;
- }
-}
-
-/* See top.h. */
-
-void
-switch_thru_all_uis_next (struct switch_thru_all_uis *state)
-{
- state->iter = state->iter->next;
-}
-
/* Get a pointer to the current UI's line buffer. This is used to
construct a whole line of input from partial input. */
command_handler (char *command)
{
struct ui *ui = current_ui;
- struct cleanup *stat_chain;
char *c;
if (ui->instream == ui->stdin_stream)
reinitialize_more_filter ();
- stat_chain = make_command_stats_cleanup (1);
+ scoped_command_stats stat_reporter (true);
/* Do not execute commented lines. */
for (c = command; *c == ' ' || *c == '\t'; c++)
/* Do any commands attached to breakpoint we stopped at. */
bpstat_do_actions ();
}
-
- do_cleanups (stat_chain);
}
/* Append RL, an input line returned by readline or one of its
mess it up here. The sync stuff should really go away over
time. */
if (!batch_silent)
- gdb_stdout = stdio_fileopen (ui->outstream);
- gdb_stderr = stderr_fileopen (ui->errstream);
+ gdb_stdout = new stdio_file (ui->outstream);
+ gdb_stderr = new stderr_file (ui->errstream);
gdb_stdlog = gdb_stderr; /* for moment */
gdb_stdtarg = gdb_stderr; /* for moment */
gdb_stdtargerr = gdb_stderr; /* for moment */