This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug gdb/20485] New: sigprocmask in tracee affects tracer as well
- From: "jengelh at inai dot de" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: Wed, 17 Aug 2016 21:21:50 +0000
- Subject: [Bug gdb/20485] New: sigprocmask in tracee affects tracer as well
- Auto-submitted: auto-generated
https://sourceware.org/bugzilla/show_bug.cgi?id=20485
Bug ID: 20485
Summary: sigprocmask in tracee affects tracer as well
Product: gdb
Version: 7.11.1
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: gdb
Assignee: unassigned at sourceware dot org
Reporter: jengelh at inai dot de
Target Milestone: ---
Given this program:
#include <stdio.h>
#include <signal.h>
int main(void)
{
sigset_t m;
sigemptyset(&m);
sigaddset(&m, SIGINT);
sigprocmask(SIG_BLOCK, &m, NULL);
while (1)
;
return 0;
}
Platform: openSUSE Leap 42.1 amd64, gdb-7.11.1; also CentOS 7 amd64, gdb-7.6.1.
When started from and run under gdb, gdb itself is unresponsive to SIGINT via
Ctrl-C. Furthermore, when the program is started from a shell and separately
attached to with gdb, gdb itself, after issuing "continue", is also
unresponsive to SIGINT delivered via tty/Ctrl-C and via kill(1).
What I believe should have happened: gdb should have stopped the program and
return me to a (gdb) prompt.
An strace on gdb (4446) reveals that it forwards SIGINT to the tracee (3428)
for some reason:
[pid 4446] 23:18:21 poll([{fd=3, events=POLLIN}, {fd=7, events=POLLIN},
{fd=10, events=POLLIN}], 3, 4294967295 [wait]
<SIGINT sent to 4446>
) = ? ERESTART_RESTARTBLOCK (Interrupted by signal)
[pid 4446] 23:18:28 --- SIGINT {si_signo=SIGINT, si_code=SI_USER, si_pid=4780,
si_uid=0} ---
[pid 4446] 23:18:28 kill(3428, SIGINT) = 0
[pid 4446] 23:18:28 rt_sigreturn({mask=[]}) = -1 EINTR (Interrupted system
call)
[pid 4446] 23:18:28 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0
[pid 4446] 23:18:28 poll([{fd=3, events=POLLIN}, {fd=7, events=POLLIN},
{fd=10, events=POLLIN}], 3, 0) = 0 (Timeout)
[pid 4446] 23:18:28 poll([{fd=3, events=POLLIN}, {fd=7, events=POLLIN},
{fd=10, events=POLLIN}], 3, 4294967295<wait>
But it should not forward it! When asking gdb for the signal configuration:
(gdb) handle SIGINT
SIGINT is used by the debugger.
Are you sure you want to change it? (y or n) y
Signal Stop Print Pass to program Description
SIGINT Yes Yes No Interrupt
It says nopass right there.
--
You are receiving this mail because:
You are on the CC list for the bug.