From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29726 invoked by alias); 19 Nov 2018 19:07:33 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Received: (qmail 29714 invoked by uid 89); 19 Nov 2018 19:07:32 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=attaching, HX-HELO:sk:gproxy2, Hx-spam-relays-external:sk:gproxy2, Hx-spam-relays-external:69.89.18.3 X-HELO: gproxy2-pub.mail.unifiedlayer.com Received: from gproxy2-pub.mail.unifiedlayer.com (HELO gproxy2-pub.mail.unifiedlayer.com) (69.89.18.3) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 19 Nov 2018 19:07:31 +0000 Received: from cmgw12.unifiedlayer.com (unknown [10.9.0.12]) by gproxy2.mail.unifiedlayer.com (Postfix) with ESMTP id 3F8111E0A17 for ; Mon, 19 Nov 2018 12:07:30 -0700 (MST) Received: from box5008.bluehost.com ([50.116.64.19]) by cmsmtp with ESMTP id OotNgMnKMVl4fOotOgWx8u; Mon, 19 Nov 2018 12:07:30 -0700 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mad-scientist.us; s=default; h=Content-Transfer-Encoding:Mime-Version: Content-Type:References:In-Reply-To:Date:Cc:To:Reply-To:From:Subject: Message-ID:Sender:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=BAiEDDmwTbi27UwNZE8KPrgb4KDhpyIK0gZgOCFWeIs=; b=BbI+G/kyrlPa9gU9HUBfXCWAN9 aUdABfIUSfWf4/h15QHFNdKt6/gu8GJL/Lkf2ftqXUoz7l7IStAMNVjRBhij1CvcrSe/EzxcotEdJ EyNbvFcMEbJAehgxy4m/HhM6K; Received: from [50.226.24.42] (port=44998 helo=pdslaptop) by box5008.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1gOotN-0018hn-LE; Mon, 19 Nov 2018 12:07:29 -0700 Message-ID: <0aa97651789ea8cc5917b73435ab61db5670934a.camel@mad-scientist.net> Subject: Re: GDB (not) handling SIGINT...? From: Paul Smith Reply-To: paul@mad-scientist.net To: Pedro Alves , Simon Marchi Cc: gdb@sourceware.org Date: Mon, 19 Nov 2018 19:07:00 -0000 In-Reply-To: <276f4526-1873-0072-206c-c45bb47be3f6@redhat.com> References: <8003dfcd98e9a4d1e43f53220e0d446669944ead.camel@mad-scientist.net> <17a7ce8aa190956bd7a8ba9bd7cdea16@polymtl.ca> <8b205cb2ff59c49ab9f4ad98564dfea3f5d1586d.camel@mad-scientist.net> <276f4526-1873-0072-206c-c45bb47be3f6@redhat.com> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-SW-Source: 2018-11/txt/msg00014.txt.bz2 On Thu, 2018-11-15 at 16:24 +0000, Pedro Alves wrote: > If you're OK with hacking GDB, s/SIGINT/SIGSTOP/g in child_pass_ctrlc > should work reasonably OK, even though not perfect. I got around to trying this and it did work... except for one thing: when I wanted to continue I had to continue once for each thread in my program :-/. Actually it stopped thread 1 twice, once at first then again... This is GDB 8.2 on x86_64 GNU/Linux (Linux 4.15, GNU libc 2.27) Somewhat confusing. $ gdb -p 7351 ... Attaching to process 7351 [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". 0x00007f17b0b0826c in sigtimedwait () from /lib/x86_64-linux-gnu/libc.so.6 (gdb) c Continuing. ^C Thread 1 "foo" received signal SIGSTOP, Stopped (signal). 0x00007f17b0b0826c in sigtimedwait () from /lib/x86_64-linux-gnu/libc.so.6 (gdb) c Continuing. Thread 11 "foo" received signal SIGSTOP, Stopped (signal). [Switching to Thread 0x7f17a91fe700 (LWP 7369)] 0x00007f17b0ec69f3 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0 (gdb) Continuing. Thread 6 "foo" received signal SIGSTOP, Stopped (signal). [Switching to Thread 0x7f17acfff700 (LWP 7361)] 0x00007f17b0ec6f85 in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0 (gdb) Continuing. Thread 3 "foo" received signal SIGSTOP, Stopped (signal). [Switching to Thread 0x7f17af7ff700 (LWP 7356)] 0x00007f17b0be9bb7 in epoll_wait () from /lib/x86_64-linux-gnu/libc.so.6 (gdb) Continuing. Thread 9 "foo" received signal SIGSTOP, Stopped (signal). [Switching to Thread 0x7f17aa5ff700 (LWP 7367)] 0x00007f17b0ec69f3 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0 (gdb) Continuing. Thread 4 "foo" received signal SIGSTOP, Stopped (signal). [Switching to Thread 0x7f17ae7ff700 (LWP 7357)] 0x00007f17b0ec69f3 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0 (gdb) Continuing. Thread 7 "foo" received signal SIGSTOP, Stopped (signal). [Switching to Thread 0x7f17ac7fe700 (LWP 7362)] 0x00007f17b0ec6f85 in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0 (gdb) Continuing. Thread 1 "foo" received signal SIGSTOP, Stopped (signal). [Switching to Thread 0x7f17b3ccb8c0 (LWP 7351)] 0x00007f17b0b0826c in sigtimedwait () from /lib/x86_64-linux-gnu/libc.so.6 (gdb) Continuing. Thread 12 "foo" received signal SIGSTOP, Stopped (signal). [Switching to Thread 0x7f17a3fff700 (LWP 7370)] 0x00007f17b0ec6f85 in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0 (gdb) Continuing. Thread 2 "foo" received signal SIGSTOP, Stopped (signal). [Switching to Thread 0x7f17b03ed700 (LWP 7355)] 0x00007f17b0ec6f85 in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0 (gdb) Continuing. Thread 10 "foo" received signal SIGSTOP, Stopped (signal). [Switching to Thread 0x7f17a99ff700 (LWP 7368)] 0x00007f17b0eca82e in recv () from /lib/x86_64-linux-gnu/libpthread.so.0 (gdb) Continuing. Thread 8 "foo" received signal SIGSTOP, Stopped (signal). [Switching to Thread 0x7f17ab3ff700 (LWP 7363)] 0x00007f17b0ec69f3 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0 (gdb) Continuing. Thread 5 "foo" received signal SIGSTOP, Stopped (signal). [Switching to Thread 0x7f17adbff700 (LWP 7359)] 0x00007f17b0eca82e in recv () from /lib/x86_64-linux-gnu/libpthread.so.0 (gdb) Continuing. ... finally here the program is really running again ...