From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 7RdXM6yw7WAjEwAAWB0awg (envelope-from ) for ; Tue, 13 Jul 2021 11:26:36 -0400 Received: by simark.ca (Postfix, from userid 112) id C07FC1EDEE; Tue, 13 Jul 2021 11:26:36 -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.0 required=5.0 tests=MAILING_LIST_MULTI 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 E4DF41E01B for ; Tue, 13 Jul 2021 11:26:35 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4D719383A816 for ; Tue, 13 Jul 2021 15:26:35 +0000 (GMT) Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) by sourceware.org (Postfix) with ESMTPS id 0BF2C386197D for ; Tue, 13 Jul 2021 15:26:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0BF2C386197D Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f45.google.com with SMTP id i2-20020a05600c3542b02902058529ea07so2618905wmq.3 for ; Tue, 13 Jul 2021 08:26:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=LAizMSLwblVkhc3oK5Eh6pQrwzJV3hYAMtCg8L8cX8Y=; b=WCMlsXuoSZmFQNfG8GLxWDEyLhszflFw7z3jr99LTpjj5p5gnYri772HcFnj1sKkdE Nilv/KP5JAZknnP2OxfxfuMGsuvVHKLMhH+bJ/mYDDQj97nWYURQ3UfQeZdN0K0exBie EANyufwkqE/3qgEEuBRVAZKYS9o0t72ucHNw6F0bJ4/vgHBfyb8n3bJsBWl6iluNG7cJ nMWuw6+Vw6HpHGddKcTFFA6dvIPYUyBGZ/sac4jWDBGUO/+4mdkxNVibFjRI4r4Hw5q8 yeQyV6rFOe9nzEts2WYxOhA6qw1vWDZjBr8MPek3UvDLOs6KDjBaUMONLtIeR6H0wq7T BmLQ== X-Gm-Message-State: AOAM532slCgNTqe3VebapIMh6a78rCpleNBkGE622r9ggFCcW/twpZMP BYRZe7n5ykjHgc7wB5h7Um/kUVUg6dAKOg== X-Google-Smtp-Source: ABdhPJw7W5jJoqbp5Hi2DfREpO6QiajNSCEYoRqer9rssXPwhhH6IVhBIqNUGBgLv9iL+xdVUIEArA== X-Received: by 2002:a7b:ce95:: with SMTP id q21mr1946wmj.101.1626189982218; Tue, 13 Jul 2021 08:26:22 -0700 (PDT) Received: from ?IPv6:2001:8a0:f932:6a00:46bc:d03b:7b3a:2227? ([2001:8a0:f932:6a00:46bc:d03b:7b3a:2227]) by smtp.gmail.com with ESMTPSA id s4sm5473599wmh.41.2021.07.13.08.26.20 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 13 Jul 2021 08:26:21 -0700 (PDT) Subject: Re: [PATCH v2 15/16] GNU/Linux: Interrupt/Ctrl-C with SIGSTOP instead of SIGINT [PR gdb/9425, PR gdb/14559] From: Pedro Alves To: "Maciej W. Rozycki" References: <20210614212410.1612666-1-pedro@palves.net> <20210614212410.1612666-16-pedro@palves.net> Message-ID: <44009d77-b901-4200-d8c8-851ae07fbebc@palves.net> Date: Tue, 13 Jul 2021 16:26:20 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit 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: , Cc: gdb-patches@sourceware.org Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" Hi Maciej, On 2021-07-09 12:05 a.m., Maciej W. Rozycki wrote: > On Mon, 14 Jun 2021, Pedro Alves wrote: > >> This commit has a user-visible behavior change in all-stop mode -- >> when you interrupt the program with Ctrl-C, instead of: >> >> Thread 1 "threads" received signal SIGINT, Interrupt. >> >> You'll get: >> >> Thread 1 "threads" stopped. >> >> Which is what you already got with the "interrupt" command in non-stop >> mode. >> >> If you really want to pass a SIGINT to the program, you can then issue: >> >> (gdb) signal SIGINT > > Can you still do: > > (gdb) handle SIGINT nostop noprint noignore > > instead to make SIGINT go through to the debuggee right away without GDB > getting bothered in any way? I've had a need to use such a setup numerous > times (normally you can still hit ^Z or ^\ to get GDB interrupted with > SIGTSTP or SIGQUIT respectively instead). > Yes, in the sense that if a SIGINT it sent to the inferior, it will go through to the debuggee right away. However, if you press Ctrl-C in GDB (which is probably what you're asking), then it will stop the program regardless of "handle SIGINT". I've been thinking that to handle scenarios like these and Eli's emacs scenario, GDB could gain some command to configure it's own interrupt key. The inferior's terminal would still inherit the terminal settings that GDB had when it was started up, so the terminal's interrupt key as configured when GDB started (usually ^c) would still raise a SIGINT in the inferior. So in your scenario you'd do "set interrupt-key ^g" or some such, like: (gdb) handle SIGINT nostop noprint noignore (gdb) set interrupt-key ^g With the above, ctrl-c would result in a SIGINT in the inferior and ctrl-g would always stop the program, no matter what the program does with signal masks/dispositions.