* PATCH: Allow for systems that do not define SIGQUIT/SIGPIPE
@ 2005-03-16 16:33 Mark Mitchell
2005-03-16 16:43 ` Daniel Jacobowitz
0 siblings, 1 reply; 6+ messages in thread
From: Mark Mitchell @ 2005-03-16 16:33 UTC (permalink / raw)
To: gdb-patches
Windows does not have SIGQUIT or SIGPIPE.
Tested on x86_64-unknown-linux-gnu.
OK?
--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
2005-03-16 Mark Mitchell <mark@codesourcery.com>
* event-top.c (async_init_signals): Allow for systems that do not
define SIGQUIT.
* ser-tcp.c (net_open): Allow for systems that do not have SIGPIPE.
Index: event-top.c
===================================================================
RCS file: /cvs/src/src/gdb/event-top.c,v
retrieving revision 1.39
diff -c -5 -p -r1.39 event-top.c
*** event-top.c 12 Feb 2005 00:39:19 -0000 1.39
--- event-top.c 16 Mar 2005 16:07:44 -0000
*************** async_init_signals (void)
*** 893,902 ****
--- 893,903 ----
to the inferior and breakpoints will be ignored. */
#ifdef SIGTRAP
signal (SIGTRAP, SIG_DFL);
#endif
+ #ifdef SIGQUIT
/* If we initialize SIGQUIT to SIG_IGN, then the SIG_IGN will get
passed to the inferior, which we don't want. It would be
possible to do a "signal (SIGQUIT, SIG_DFL)" after we fork, but
on BSD4.3 systems using vfork, that can affect the
GDB process as well as the inferior (the signal handling tables
*************** async_init_signals (void)
*** 904,913 ****
--- 905,915 ----
a handler for SIGQUIT, when we call exec it will set the signal
to SIG_DFL for us. */
signal (SIGQUIT, handle_sigquit);
sigquit_token =
create_async_signal_handler (async_do_nothing, NULL);
+ #endif
#ifdef SIGHUP
if (signal (SIGHUP, handle_sighup) != SIG_IGN)
sighup_token =
create_async_signal_handler (async_disconnect, NULL);
else
Index: ser-tcp.c
===================================================================
RCS file: /cvs/src/src/gdb/ser-tcp.c,v
retrieving revision 1.17
diff -c -5 -p -r1.17 ser-tcp.c
*** ser-tcp.c 11 Feb 2005 04:06:04 -0000 1.17
--- ser-tcp.c 16 Mar 2005 16:07:44 -0000
*************** net_open (struct serial *scb, const char
*** 184,196 ****
--- 184,198 ----
tmp = 1;
setsockopt (scb->fd, IPPROTO_TCP, TCP_NODELAY,
(char *)&tmp, sizeof (tmp));
}
+ #ifdef SIGPIPE
/* If we don't do this, then GDB simply exits
when the remote side dies. */
signal (SIGPIPE, SIG_IGN);
+ #endif
return 0;
}
static void
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: PATCH: Allow for systems that do not define SIGQUIT/SIGPIPE 2005-03-16 16:33 PATCH: Allow for systems that do not define SIGQUIT/SIGPIPE Mark Mitchell @ 2005-03-16 16:43 ` Daniel Jacobowitz 2005-03-16 16:51 ` Mark Mitchell 2005-03-16 16:53 ` Mark Mitchell 0 siblings, 2 replies; 6+ messages in thread From: Daniel Jacobowitz @ 2005-03-16 16:43 UTC (permalink / raw) To: Mark Mitchell; +Cc: gdb-patches On Wed, Mar 16, 2005 at 08:33:03AM -0800, Mark Mitchell wrote: > > Windows does not have SIGQUIT or SIGPIPE. > > Tested on x86_64-unknown-linux-gnu. > > OK? You should probably #ifdef out handle_sigquit and its prototype also, or GCC will warn about it. Right? See the example for SIGWINCH. -- Daniel Jacobowitz CodeSourcery, LLC ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: PATCH: Allow for systems that do not define SIGQUIT/SIGPIPE 2005-03-16 16:43 ` Daniel Jacobowitz @ 2005-03-16 16:51 ` Mark Mitchell 2005-03-16 16:52 ` Daniel Jacobowitz 2005-03-16 16:53 ` Mark Mitchell 1 sibling, 1 reply; 6+ messages in thread From: Mark Mitchell @ 2005-03-16 16:51 UTC (permalink / raw) To: Daniel Jacobowitz; +Cc: gdb-patches Daniel Jacobowitz wrote: > On Wed, Mar 16, 2005 at 08:33:03AM -0800, Mark Mitchell wrote: > >>Windows does not have SIGQUIT or SIGPIPE. >> >>Tested on x86_64-unknown-linux-gnu. >> >>OK? > > > You should probably #ifdef out handle_sigquit and its prototype also, > or GCC will warn about it. Right? See the example for SIGWINCH. Actually, GCC doesn't warn because handle_sigquit references itself. :-) I'll make that change; OK, assuming it builds? -- Mark Mitchell CodeSourcery, LLC mark@codesourcery.com (916) 791-8304 ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: PATCH: Allow for systems that do not define SIGQUIT/SIGPIPE 2005-03-16 16:51 ` Mark Mitchell @ 2005-03-16 16:52 ` Daniel Jacobowitz 2005-03-16 17:08 ` Mark Mitchell 0 siblings, 1 reply; 6+ messages in thread From: Daniel Jacobowitz @ 2005-03-16 16:52 UTC (permalink / raw) To: Mark Mitchell; +Cc: gdb-patches On Wed, Mar 16, 2005 at 08:51:41AM -0800, Mark Mitchell wrote: > Daniel Jacobowitz wrote: > >On Wed, Mar 16, 2005 at 08:33:03AM -0800, Mark Mitchell wrote: > > > >>Windows does not have SIGQUIT or SIGPIPE. > >> > >>Tested on x86_64-unknown-linux-gnu. > >> > >>OK? > > > > > >You should probably #ifdef out handle_sigquit and its prototype also, > >or GCC will warn about it. Right? See the example for SIGWINCH. > > Actually, GCC doesn't warn because handle_sigquit references itself. :-) > > I'll make that change; OK, assuming it builds? Yes, is ok. -- Daniel Jacobowitz CodeSourcery, LLC ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: PATCH: Allow for systems that do not define SIGQUIT/SIGPIPE 2005-03-16 16:52 ` Daniel Jacobowitz @ 2005-03-16 17:08 ` Mark Mitchell 0 siblings, 0 replies; 6+ messages in thread From: Mark Mitchell @ 2005-03-16 17:08 UTC (permalink / raw) To: Daniel Jacobowitz; +Cc: gdb-patches [-- Attachment #1: Type: text/plain, Size: 285 bytes --] Daniel Jacobowitz wrote: >>Actually, GCC doesn't warn because handle_sigquit references itself. :-) >> >>I'll make that change; OK, assuming it builds? > > > Yes, is ok. Checked in; here was the final patch. -- Mark Mitchell CodeSourcery, LLC mark@codesourcery.com (916) 791-8304 [-- Attachment #2: gdb.signals --] [-- Type: text/plain, Size: 3691 bytes --] 2005-03-16 Mark Mitchell <mark@codesourcery.com> * event-top.c (handle_sigquit): Do not define for systems without SIGQUIT. (sigquit_token): Likewise. (async_init_signals): Allow for systems that do not define SIGQUIT. * ser-tcp.c (net_open): Allow for systems that do not have SIGPIPE. Index: event-top.c =================================================================== RCS file: /cvs/src/src/gdb/event-top.c,v retrieving revision 1.39 retrieving revision 1.40 diff -c -5 -p -r1.39 -r1.40 *** event-top.c 12 Feb 2005 00:39:19 -0000 1.39 --- event-top.c 16 Mar 2005 17:05:31 -0000 1.40 *************** static void async_do_nothing (gdb_client *** 53,63 **** --- 53,65 ---- static void async_disconnect (gdb_client_data arg); static void async_stop_sig (gdb_client_data arg); static void async_float_handler (gdb_client_data arg); /* Signal handlers. */ + #ifdef SIGQUIT static void handle_sigquit (int sig); + #endif static void handle_sighup (int sig); static void handle_sigfpe (int sig); #if defined(SIGWINCH) && defined(SIGWINCH_HANDLER) static void handle_sigwinch (int sig); #endif *************** struct prompts the_prompts; *** 131,141 **** --- 133,145 ---- invoke_async_signal_handler. */ void *sigint_token; #ifdef SIGHUP void *sighup_token; #endif + #ifdef SIGQUIT void *sigquit_token; + #endif void *sigfpe_token; #if defined(SIGWINCH) && defined(SIGWINCH_HANDLER) void *sigwinch_token; #endif #ifdef STOP_SIGNAL *************** async_init_signals (void) *** 893,902 **** --- 897,907 ---- to the inferior and breakpoints will be ignored. */ #ifdef SIGTRAP signal (SIGTRAP, SIG_DFL); #endif + #ifdef SIGQUIT /* If we initialize SIGQUIT to SIG_IGN, then the SIG_IGN will get passed to the inferior, which we don't want. It would be possible to do a "signal (SIGQUIT, SIG_DFL)" after we fork, but on BSD4.3 systems using vfork, that can affect the GDB process as well as the inferior (the signal handling tables *************** async_init_signals (void) *** 904,913 **** --- 909,919 ---- a handler for SIGQUIT, when we call exec it will set the signal to SIG_DFL for us. */ signal (SIGQUIT, handle_sigquit); sigquit_token = create_async_signal_handler (async_do_nothing, NULL); + #endif #ifdef SIGHUP if (signal (SIGHUP, handle_sighup) != SIG_IGN) sighup_token = create_async_signal_handler (async_disconnect, NULL); else *************** async_request_quit (gdb_client_data arg) *** 964,981 **** --- 970,989 ---- { quit_flag = 1; quit (); } + #ifdef SIGQUIT /* Tell the event loop what to do if SIGQUIT is received. See event-signal.c. */ static void handle_sigquit (int sig) { mark_async_signal_handler_wrapper (sigquit_token); signal (sig, handle_sigquit); } + #endif /* Called by the event loop in response to a SIGQUIT. */ static void async_do_nothing (gdb_client_data arg) { Index: ser-tcp.c =================================================================== RCS file: /cvs/src/src/gdb/ser-tcp.c,v retrieving revision 1.17 retrieving revision 1.18 diff -c -5 -p -r1.17 -r1.18 *** ser-tcp.c 11 Feb 2005 04:06:04 -0000 1.17 --- ser-tcp.c 16 Mar 2005 17:05:31 -0000 1.18 *************** net_open (struct serial *scb, const char *** 184,196 **** --- 184,198 ---- tmp = 1; setsockopt (scb->fd, IPPROTO_TCP, TCP_NODELAY, (char *)&tmp, sizeof (tmp)); } + #ifdef SIGPIPE /* If we don't do this, then GDB simply exits when the remote side dies. */ signal (SIGPIPE, SIG_IGN); + #endif return 0; } static void ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: PATCH: Allow for systems that do not define SIGQUIT/SIGPIPE 2005-03-16 16:43 ` Daniel Jacobowitz 2005-03-16 16:51 ` Mark Mitchell @ 2005-03-16 16:53 ` Mark Mitchell 1 sibling, 0 replies; 6+ messages in thread From: Mark Mitchell @ 2005-03-16 16:53 UTC (permalink / raw) To: Daniel Jacobowitz; +Cc: gdb-patches Daniel Jacobowitz wrote: > On Wed, Mar 16, 2005 at 08:33:03AM -0800, Mark Mitchell wrote: > >>Windows does not have SIGQUIT or SIGPIPE. >> >>Tested on x86_64-unknown-linux-gnu. >> >>OK? > > > You should probably #ifdef out handle_sigquit and its prototype also, > or GCC will warn about it. Right? See the example for SIGWINCH. (I'll #ifdef out sigquit_token too.) -- Mark Mitchell CodeSourcery, LLC mark@codesourcery.com (916) 791-8304 ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2005-03-16 17:08 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2005-03-16 16:33 PATCH: Allow for systems that do not define SIGQUIT/SIGPIPE Mark Mitchell 2005-03-16 16:43 ` Daniel Jacobowitz 2005-03-16 16:51 ` Mark Mitchell 2005-03-16 16:52 ` Daniel Jacobowitz 2005-03-16 17:08 ` Mark Mitchell 2005-03-16 16:53 ` Mark Mitchell
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox