The STOP_SIGNAL macro was originally added for Convex Unix
(https://en.wikipedia.org/wiki/Convex_Computer).
In:
git show
7a67dd45ca1c:gdb/m-convex.h
we see:
~~~
/* Use SIGCONT rather than SIGTSTP because convex Unix occasionally
turkeys SIGTSTP. I think. */
#define STOP_SIGNAL SIGCONT
~~~
That's gdb-3.5, 1990... In gdb/ChangeLog-3.x we see:
~~~
Tue Apr 18 13:43:37 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
Various changes involved in 1) getting gdb to work on the convex,
[...]
Made whatever signal indicates a stop configurable (via macro
STOP_SIGNAL).
(main): Setup use of above as a signal handler. Added check for
"-nw" in args already processed.
(command_line_input): SIGTSTP ==>STOP_SIGNAL.
~~~
Support for Convex Unix is long gone, and nothing else overrides
STOP_SIGNAL. So just use SIGTSTP directly, removing a little
obfuscation.
(I don't really understand why we override [1] readline's SIGTSTP
handler (only) when reading scripts (and then fail to restore it
properly, assuming SIG_DFL...), but I'll leave that for another pass.
[1] - Actually, starting with readline 6.3, readline is no longer
installing its handlers while GDB is in control...)
gdb/ChangeLog:
2017-11-06 Pedro Alves <palves@redhat.com>
* 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 <palves@redhat.com>
+
+ * 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 <palves@redhat.com>
* inflow.c (child_terminal_inferior, child_terminal_ours_1): No
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;
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. */
#ifndef EVENT_TOP_H
#define EVENT_TOP_H
+#include <signal.h>
+
struct cmd_list_element;
/* Exported functions from event-top.c.
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 <signal.h>
#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);
/* 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)
prompt = NULL;
}
-#ifdef STOP_SIGNAL
+#ifdef SIGTSTP
if (job_control)
- signal (STOP_SIGNAL, SIG_DFL);
+ signal (SIGTSTP, SIG_DFL);
#endif
return cmd;