/* Top level stuff for GDB, the GNU debugger.
- Copyright (C) 1999-2017 Free Software Foundation, Inc.
+ Copyright (C) 1999-2018 Free Software Foundation, Inc.
Written by Elena Zannoni <ezannoni@cygnus.com> of Cygnus Solutions.
#include "cli/cli-script.h" /* for reset_command_nest_depth */
#include "main.h"
#include "gdbthread.h"
-#include "observer.h"
+#include "observable.h"
#include "continuations.h"
#include "gdbcmd.h" /* for dont_repeat() */
#include "annotate.h"
static void async_disconnect (gdb_client_data);
#endif
static void async_float_handler (gdb_client_data);
-#ifdef STOP_SIGNAL
-static void async_stop_sig (gdb_client_data);
+#ifdef SIGTSTP
+static void async_sigtstp_handler (gdb_client_data);
#endif
static void async_sigterm_handler (gdb_client_data arg);
static struct async_signal_handler *sigquit_token;
#endif
static struct async_signal_handler *sigfpe_token;
-#ifdef STOP_SIGNAL
+#ifdef SIGTSTP
static struct async_signal_handler *sigtstp_token;
#endif
static struct async_signal_handler *async_sigterm_token;
/* Give observers a chance of changing the prompt. E.g., the python
`gdb.prompt_hook' is installed as an observer. */
- observer_notify_before_prompt (get_prompt ());
+ gdb::observers::before_prompt.notify (get_prompt ());
prompt = get_prompt ();
else
{
/* Simply delete the UI. */
- delete_ui (ui);
+ delete ui;
}
}
else
a whole command. */
void
-command_handler (char *command)
+command_handler (const char *command)
{
struct ui *ui = current_ui;
- char *c;
+ const char *c;
if (ui->instream == ui->stdin_stream)
reinitialize_more_filter ();
}
#define SERVER_COMMAND_PREFIX "server "
- if (startswith (cmd, SERVER_COMMAND_PREFIX))
+ server_command = startswith (cmd, SERVER_COMMAND_PREFIX);
+ if (server_command)
{
/* Note that we don't set `saved_command_line'. Between this
and the check in dont_repeat, this insures that repeating
hung up but GDB is still alive. In such a case, we just quit
gdb killing the inferior program too. */
printf_unfiltered ("quit\n");
- execute_command ((char *) "quit", 1);
+ execute_command ("quit", 1);
}
else if (cmd == NULL)
{
sigfpe_token =
create_async_signal_handler (async_float_handler, NULL);
-#ifdef STOP_SIGNAL
+#ifdef SIGTSTP
sigtstp_token =
- create_async_signal_handler (async_stop_sig, NULL);
+ create_async_signal_handler (async_sigtstp_handler, NULL);
#endif
}
}
#endif
-#ifdef STOP_SIGNAL
+#ifdef SIGTSTP
void
-handle_stop_sig (int sig)
+handle_sigtstp (int sig)
{
mark_async_signal_handler (sigtstp_token);
- signal (sig, handle_stop_sig);
+ signal (sig, handle_sigtstp);
}
static void
-async_stop_sig (gdb_client_data arg)
+async_sigtstp_handler (gdb_client_data arg)
{
char *prompt = get_prompt ();
-#if STOP_SIGNAL == SIGTSTP
signal (SIGTSTP, SIG_DFL);
#if HAVE_SIGPROCMASK
{
sigsetmask (0);
#endif
raise (SIGTSTP);
- signal (SIGTSTP, handle_stop_sig);
-#else
- signal (STOP_SIGNAL, handle_stop_sig);
-#endif
+ signal (SIGTSTP, handle_sigtstp);
printf_unfiltered ("%s", prompt);
gdb_flush (gdb_stdout);
nothing. */
dont_repeat ();
}
-#endif /* STOP_SIGNAL */
+#endif /* SIGTSTP */
/* Tell the event loop what to do if SIGFPE is received.
See event-signal.c. */