From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id BIVwMLeayGAuZgAAWB0awg (envelope-from ) for ; Tue, 15 Jun 2021 08:19:03 -0400 Received: by simark.ca (Postfix, from userid 112) id B76401F163; Tue, 15 Jun 2021 08:19:03 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id AEE0D1E939 for ; Tue, 15 Jun 2021 08:19:02 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1A67D3893645 for ; Tue, 15 Jun 2021 12:19:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1A67D3893645 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1623759542; bh=OK9MoCgOpHiUibyqh6f9MvcJZ5pYHhnPHOfCeJhDiJk=; h=Date:To:In-Reply-To:Subject:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=hF9eIacZmocdP9sskqhHPWg9X4b+4A371Otcizg/VaAEn50xR5UEPBAkoovNXaDqm leAOV+fb/JQ0Mglowu42fh0hO1wB8uvWo99XCLBe5Nk6b90v87cAXjWaKsjYfJzJhR JdpGk3am+YECozjmOxa6zkqjloFcxp2of+cUidFw= Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by sourceware.org (Postfix) with ESMTPS id D81D63857420 for ; Tue, 15 Jun 2021 12:18:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D81D63857420 Received: from fencepost.gnu.org ([2001:470:142:3::e]:51638) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lt81d-00037P-VP; Tue, 15 Jun 2021 08:18:37 -0400 Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:3681 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lt81d-00034f-IY; Tue, 15 Jun 2021 08:18:37 -0400 Date: Tue, 15 Jun 2021 15:18:36 +0300 Message-Id: <83tulz48yr.fsf@gnu.org> To: Pedro Alves In-Reply-To: <2af9e861-69f2-80c5-606b-2936b6d2d212@palves.net> (message from Pedro Alves on Mon, 14 Jun 2021 18:55:17 +0100) Subject: Re: [PATCH 00/17] Interrupting programs that block/ignore SIGINT References: <20210603190243.2609886-1-pedro@palves.net> <835yyuwwuu.fsf@gnu.org> <2af9e861-69f2-80c5-606b-2936b6d2d212@palves.net> X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Eli Zaretskii via Gdb-patches Reply-To: Eli Zaretskii Cc: gdb-patches@sourceware.org Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" > From: Pedro Alves > Cc: gdb-patches@sourceware.org > Date: Mon, 14 Jun 2021 18:55:17 +0100 > > On 2021-06-03 8:51 p.m., Eli Zaretskii wrote: > >> From: Pedro Alves > >> Date: Thu, 3 Jun 2021 20:02:26 +0100 > >> > >> Currently, on GNU/Linux, it is not possible to interrupt with Ctrl-C > >> programs that block or ignore SIGINT, with e.g., sigprocmask or > >> signal(SIGINT, SIG_IGN). You type Ctrl-C, but nothing happens. > > > > I'm not sure I understand why this is a problem. If a debuggee blocks > > or ignores SIGINT, then SIGINT cannot be used to stop it, neither when > > it runs outside the debugger nor when it runs under a debugger. There > > are enough other methods to stop such a debuggee (e.g., send it a > > different signal), but basically such a program clearly tells that it > > doesn't want to be interrupted by SIGINT, period. > > It sounds like you're taking the view that Ctrl-C should be seen by the > inferior first, and behave exactly as if you were not debugging > the program? > > My view is that, as a user, I see Ctrl-C as the standard way across configurations > to interrupt programs so I can inspect them. When I type Ctrl-C, I'm telling > GDB that I want to stop the program. Actually, my original problem was caused by your use of "interrupt a program", when what you actually meant (AFAIU now) was "stop the program". This was what originally set me off: the above text you posted as the preamble for your patch reads like it's saying that something is wrong with the situation where programs that don't want to be interrupted by Ctrl-C can't be interrupted by SIGINT under GDB. Thus my reaction. However, thinking about the issue some more, now that I understand what you meant, I do indeed think that programs which block or ignore SIGINT should not be stopped by Ctrl-C under GDB. The reason is simple: SIGINT is just another fatal signal. Any fatal signal delivered to a program being debugged will not stop the program if the program blocks or ignores that signal, right? So why should SIGINT be special? IOW, Are you sure your expectations are not based on old habits, where "normally" Ctrl-C can be used to stop a debuggee, and thus it is a convenient means of doing so? I wonder how many others here think like you and how many think like me. If I'm the odd one out, then I won't continue talking about this aspect of your patches. I'm glad you found a way of making the effects of these changes less surprising, but I still have a couple of issues with the changes, which I will raise in response to your v2.