diff options
Diffstat (limited to 'packages/gdb/15.2/0000-readline-bring-in-signal.c-from-gdb-16-branch.patch')
-rw-r--r-- | packages/gdb/15.2/0000-readline-bring-in-signal.c-from-gdb-16-branch.patch | 173 |
1 files changed, 173 insertions, 0 deletions
diff --git a/packages/gdb/15.2/0000-readline-bring-in-signal.c-from-gdb-16-branch.patch b/packages/gdb/15.2/0000-readline-bring-in-signal.c-from-gdb-16-branch.patch new file mode 100644 index 00000000..914efb61 --- /dev/null +++ b/packages/gdb/15.2/0000-readline-bring-in-signal.c-from-gdb-16-branch.patch @@ -0,0 +1,173 @@ +From 6c96a41828a0f34cc4480c08a9c23e0ab2ed2cc0 Mon Sep 17 00:00:00 2001 +From: Chris Packham <judge.packham@gmail.com> +Date: Mon, 2 Jun 2025 15:15:05 +1200 +Subject: [PATCH] readline: bring in signal.c from gdb-16 branch + +Readline is updated in gdb-16. This has fixes for some build issues with +newer C23 compilers but is a little too big to just bring in on it's +own. Bring in signal.c from the gdb-16 branch to resolve the immediate +issues. +--- + readline/readline/signals.c | 71 +++++++++++++------------------------------- + 1 file changed, 22 insertions(+), 49 deletions(-) + +--- a/readline/readline/signals.c ++++ b/readline/readline/signals.c +@@ -1,6 +1,6 @@ + /* signals.c -- signal handling support for readline. */ + +-/* Copyright (C) 1987-2017 Free Software Foundation, Inc. ++/* Copyright (C) 1987-2021 Free Software Foundation, Inc. + + This file is part of the GNU Readline Library (Readline), a library + for reading lines of text with interactive input and history editing. +@@ -48,23 +48,11 @@ + + #if defined (HANDLE_SIGNALS) + +-#if !defined (RETSIGTYPE) +-# if defined (VOID_SIGHANDLER) +-# define RETSIGTYPE void +-# else +-# define RETSIGTYPE int +-# endif /* !VOID_SIGHANDLER */ +-#endif /* !RETSIGTYPE */ +- +-#if defined (VOID_SIGHANDLER) +-# define SIGHANDLER_RETURN return +-#else +-# define SIGHANDLER_RETURN return (0) +-#endif ++#define SIGHANDLER_RETURN return + + /* This typedef is equivalent to the one for Function; it allows us + to say SigHandler *foo = signal (SIGKILL, SIG_IGN); */ +-typedef RETSIGTYPE SigHandler (); ++typedef void SigHandler (int); + + #if defined (HAVE_POSIX_SIGNALS) + typedef struct sigaction sighandler_cxt; +@@ -78,12 +66,12 @@ + # define SA_RESTART 0 + #endif + +-static SigHandler *rl_set_sighandler PARAMS((int, SigHandler *, sighandler_cxt *)); +-static void rl_maybe_set_sighandler PARAMS((int, SigHandler *, sighandler_cxt *)); +-static void rl_maybe_restore_sighandler PARAMS((int, sighandler_cxt *)); ++static SigHandler *rl_set_sighandler (int, SigHandler *, sighandler_cxt *); ++static void rl_maybe_set_sighandler (int, SigHandler *, sighandler_cxt *); ++static void rl_maybe_restore_sighandler (int, sighandler_cxt *); + +-static RETSIGTYPE rl_signal_handler PARAMS((int)); +-static RETSIGTYPE _rl_handle_signal PARAMS((int)); ++static void rl_signal_handler (int); ++static void _rl_handle_signal (int); + + /* Exported variables for use by applications. */ + +@@ -136,7 +124,7 @@ + /* Readline signal handler functions. */ + + /* Called from RL_CHECK_SIGNALS() macro to run signal handling code. */ +-RETSIGTYPE ++void + _rl_signal_handler (int sig) + { + _rl_caught_signal = 0; /* XXX */ +@@ -163,7 +151,7 @@ + SIGHANDLER_RETURN; + } + +-static RETSIGTYPE ++static void + rl_signal_handler (int sig) + { + _rl_caught_signal = sig; +@@ -173,7 +161,7 @@ + /* This is called to handle a signal when it is safe to do so (out of the + signal handler execution path). Called by _rl_signal_handler for all the + signals readline catches except SIGWINCH. */ +-static RETSIGTYPE ++static void + _rl_handle_signal (int sig) + { + int block_sig; +@@ -222,6 +210,9 @@ + switch (sig) + { + case SIGINT: ++ /* We will end up blocking SIGTTOU while we are resetting the tty, so ++ watch out for this if it causes problems. We could prevent this by ++ setting block_sig to 1 without modifying SET. */ + _rl_reset_completion_state (); + rl_free_line_state (); + #if defined (READLINE_CALLBACKS) +@@ -242,8 +233,11 @@ + this even if we've been stopped on SIGTTOU, since we handle signals + when we have returned from the signal handler and the signal is no + longer blocked. */ +- sigaddset (&set, SIGTTOU); +- block_sig = 1; ++ if (block_sig == 0) ++ { ++ sigaddset (&set, SIGTTOU); ++ block_sig = 1; ++ } + # endif + #endif /* SIGTSTP */ + /* Any signals that should be blocked during cleanup should go here. */ +@@ -261,6 +255,8 @@ + case SIGTERM: + #if defined (SIGALRM) + case SIGALRM: ++ if (sig == SIGALRM) ++ _rl_timeout_handle_sigalrm (); + #endif + #if defined (SIGQUIT) + case SIGQUIT: +@@ -285,19 +281,6 @@ + + /* We don't have to bother unblocking the signal because we are not + running in a signal handler context. */ +-#if 0 +-#if defined (HAVE_POSIX_SIGNALS) +- /* Make sure this signal is not blocked when we resend it to the +- calling application. */ +- sigemptyset (&set); +- sigprocmask (SIG_BLOCK, (sigset_t *)NULL, &set); +- sigdelset (&set, sig); +-#else /* !HAVE_POSIX_SIGNALS */ +-# if defined (HAVE_BSD_SIGNALS) +- omask = sigblock (0); +-# endif /* HAVE_BSD_SIGNALS */ +-#endif /* !HAVE_POSIX_SIGNALS */ +-#endif + + #if defined (__EMX__) + signal (sig, SIG_ACK); +@@ -311,16 +294,6 @@ + + /* We don't need to modify the signal mask now that this is not run in + a signal handler context. */ +-#if 0 +- /* Let the signal that we just sent through if it is blocked. */ +-#if defined (HAVE_POSIX_SIGNALS) +- sigprocmask (SIG_SETMASK, &set, (sigset_t *)NULL); +-#else /* !HAVE_POSIX_SIGNALS */ +-# if defined (HAVE_BSD_SIGNALS) +- sigsetmask (omask & ~(sigmask (sig))); +-# endif /* HAVE_BSD_SIGNALS */ +-#endif /* !HAVE_POSIX_SIGNALS */ +-#endif + + rl_reset_after_signal (); + } +@@ -330,7 +303,7 @@ + } + + #if defined (SIGWINCH) +-static RETSIGTYPE ++static void + rl_sigwinch_handler (int sig) + { + SigHandler *oh; |