This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[PATCH RFA] Linux threads, SIGINT handling
- To: gdb-patches at sources dot redhat dot com
- Subject: [PATCH RFA] Linux threads, SIGINT handling
- From: Michael Snyder <msnyder at cygnus dot com>
- Date: Fri, 25 May 2001 12:18:37 -0700
- CC: kettenis at wins dot uva dot nl
- Organization: Red Hat
Mark,
When a user types ^C(break) at a tty on Linux, SIGINT is sent to every
thread in the process group (whether by the kernel or by the manager
thread, I do not know). The effect is that, if you type ^C once, you
have to say "continue" N times (once for every user thread).
This patch handles that problem by discarding the redundant SIGINT
events (ie. all of them except the one that was actually detected in
lin_lwp_wait).
Michael
2001-05-25 Michael Snyder <msnyder@redhat.com>
* lin-lwp.c (stop_wait_callback): Discard redundant SIGINT events.
Index: lin-lwp.c
===================================================================
RCS file: /cvs/src/src/gdb/lin-lwp.c,v
retrieving revision 1.20
diff -c -3 -p -r1.20 lin-lwp.c
*** lin-lwp.c 2001/05/15 00:13:47 1.20
--- lin-lwp.c 2001/05/25 19:07:30
*************** stop_wait_callback (struct lwp_info *lp,
*** 610,615 ****
--- 610,623 ----
- DECR_PC_AFTER_BREAK,
pid_to_ptid (pid));
}
+ else if (WSTOPSIG (status) == SIGINT)
+ {
+ /* Since SIGINT gets forwarded to the entire process group
+ (in the case where ^C/BREAK is typed at the tty/console),
+ just ignore all SIGINT events from all lwp's except for
+ the one that was caught by lin_lwp_wait. */
+ ; /* Don't save. Signal will disappear into oblivion. */
+ }
else
{
if (debug_lin_lwp)
*************** stop_wait_callback (struct lwp_info *lp,
*** 618,624 ****
strsignal (WSTOPSIG (status)), pid);
/* The thread was stopped with a signal other than
! SIGSTOP, and didn't accidentiliy trip a breakpoint.
Record the wait status. */
lp->status = status;
}
--- 626,632 ----
strsignal (WSTOPSIG (status)), pid);
/* The thread was stopped with a signal other than
! SIGSTOP, and didn't accidentally trip a breakpoint.
Record the wait status. */
lp->status = status;
}