diff --git a/gdb/ChangeLog b/gdb/ChangeLog index c569d568ff..80caa43f47 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,18 @@ +2017-11-06 Pedro Alves + + * event-top.c: Check SIGTSTP instead of STOP_SIGNAL thoughout. + (async_init_signals): Adjust. + (handle_stop_sig): Rename to ... + (handle_sigtstp): ... this. + (async_stop_sig): Rename to ... + (async_sigtstp_handler): ... this, and delete STOP_SIGNAL != + SIGTSTP path. + * event-top.h: Move signal.h include to the top. Check SIGTSTP + instead of STOP_SIGNAL thoughout. + (handle_stop_sig): Rename to ... + (handle_sigtstp): ... this. + * top.c (command_line_input): Replace STOP_SIGNAL -> SIGTSTP. + 2017-11-06 Pedro Alves * inflow.c (child_terminal_inferior, child_terminal_ours_1): No diff --git a/gdb/event-top.c b/gdb/event-top.c index 43e2a27163..73771894c9 100644 --- a/gdb/event-top.c +++ b/gdb/event-top.c @@ -68,8 +68,8 @@ static void async_do_nothing (gdb_client_data); 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); @@ -111,7 +111,7 @@ static struct async_signal_handler *sighup_token; 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; @@ -912,9 +912,9 @@ async_init_signals (void) 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 } @@ -1112,20 +1112,19 @@ async_disconnect (gdb_client_data arg) } #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 { @@ -1138,10 +1137,7 @@ async_stop_sig (gdb_client_data arg) 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); @@ -1149,7 +1145,7 @@ async_stop_sig (gdb_client_data arg) nothing. */ dont_repeat (); } -#endif /* STOP_SIGNAL */ +#endif /* SIGTSTP */ /* Tell the event loop what to do if SIGFPE is received. See event-signal.c. */ diff --git a/gdb/event-top.h b/gdb/event-top.h index 05241ad0a6..d069c568f9 100644 --- a/gdb/event-top.h +++ b/gdb/event-top.h @@ -22,6 +22,8 @@ #ifndef EVENT_TOP_H #define EVENT_TOP_H +#include + struct cmd_list_element; /* Exported functions from event-top.c. @@ -36,14 +38,10 @@ extern void change_line_handler (int); extern void command_line_handler (char *rl); extern void command_handler (char *command); -/* Signal to catch ^Z typed while reading a command: SIGTSTP or SIGCONT. */ -#ifndef STOP_SIGNAL -#include #ifdef SIGTSTP -#define STOP_SIGNAL SIGTSTP -extern void handle_stop_sig (int sig); -#endif +extern void handle_sigtstp (int sig); #endif + extern void handle_sigint (int sig); extern void handle_sigterm (int sig); extern void async_request_quit (void *arg); diff --git a/gdb/top.c b/gdb/top.c index 9f5dd58d21..f006c669a1 100644 --- a/gdb/top.c +++ b/gdb/top.c @@ -1184,9 +1184,9 @@ command_line_input (const char *prompt_arg, int repeat, /* Starting a new command line. */ cmd_line_buffer.used_size = 0; -#ifdef STOP_SIGNAL +#ifdef SIGTSTP if (job_control) - signal (STOP_SIGNAL, handle_stop_sig); + signal (SIGTSTP, handle_sigtstp); #endif while (1) @@ -1244,9 +1244,9 @@ command_line_input (const char *prompt_arg, int repeat, prompt = NULL; } -#ifdef STOP_SIGNAL +#ifdef SIGTSTP if (job_control) - signal (STOP_SIGNAL, SIG_DFL); + signal (SIGTSTP, SIG_DFL); #endif return cmd;