From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 0S1KLrbuyWC3CQAAWB0awg (envelope-from ) for ; Wed, 16 Jun 2021 08:29:42 -0400 Received: by simark.ca (Postfix, from userid 112) id B62A41F163; Wed, 16 Jun 2021 08:29:42 -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 0BC2F1E939 for ; Wed, 16 Jun 2021 08:29:42 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B8A623894C3B for ; Wed, 16 Jun 2021 12:29:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B8A623894C3B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1623846581; bh=TsM8mULqaoN6tsqxO9lc3ZaD/dK+9DnDSXZ366tc8dM=; 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=HUsse7rnV52I4V6Sl7nXAT3X+sF3wdN2N7XPtMhZd1E8OThP0n8wce0YquSvzEHTq JWu6vwn07gFYsHw0AIU4ggLiLWjn+nvoJRco3HRaJvAZgRJid+huZYaSMC18Qyn2wr ieG/v4KP4Nl6pinlvRPbEtJvNAdpON8rhUZ2Ol4E= Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by sourceware.org (Postfix) with ESMTPS id 5F15538460A3 for ; Wed, 16 Jun 2021 12:29:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5F15538460A3 Received: from fencepost.gnu.org ([2001:470:142:3::e]:39222) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ltUfZ-0002AB-M7; Wed, 16 Jun 2021 08:29:21 -0400 Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:1178 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 1ltUfZ-0000rs-9z; Wed, 16 Jun 2021 08:29:21 -0400 Date: Wed, 16 Jun 2021 15:29:24 +0300 Message-Id: <837diu2dsr.fsf@gnu.org> To: Pedro Alves In-Reply-To: <17e0328a-0404-676a-e5e3-fc753e0db979@palves.net> (message from Pedro Alves on Wed, 16 Jun 2021 10:31:27 +0100) Subject: Re: [PATCH v2 16/16] Document pseudo-terminal and interrupting changes References: <20210614212410.1612666-1-pedro@palves.net> <20210614212410.1612666-17-pedro@palves.net> <83r1h34771.fsf@gnu.org> <17e0328a-0404-676a-e5e3-fc753e0db979@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: Wed, 16 Jun 2021 10:31:27 +0100 > > >> +On such systems, in some cases, like for example if you need to run > >> +your program and then detach it, and you want the program to remain > >> +associated with a terminal, you may prefer that @value{GDBN} starts > >> +your program using the same device for standard input and output as > >> +@value{GDBN} is using. > > IMHO, this is a misfeature. If the terminal from which GDB was run > > remains on the system, it would be an unpleasant surprise for the user > > that the program gets hit by SIGHUP when you detach. I think we > > should try to avoid this side effect, if that's feasible. > > > > Hmm, I'm not sure I follow what you're saying here, maybe I'm misunderstanding. > > We no longer get a SIGHUP on detach, that was fixed on v2. What the text is saying now is > different: because when you start your program with "run", the terminal the inferior is > associated with was created by GDB, when you "detach", GDB destroys the terminal. The > result is that the program you detached from loses its terminal. I understood that, and this is what I was calling "a misfeature" above. > From the detached > program's perspective, it's the same as with current GDB when you do "run", then "detach", > and then close the GDB terminal. _Technically_ it is the same. But from the user POV, it isn't, not unless the user closes the terminal from which he/she invoked GDB. As long as that terminal stays, the user might be surprised to see the program behaving as if the terminal was closed. > If you really need to do "run" and then "detach" for some reason, _and_ you want > your program to have a terminal, you should start the program with a specified > terminal, like: > > - start the program outside gdb, and then use "attach". Make sure the terminal > you started the program at remains alive. > > - use the "tty" command to tell GDB to start the program on some specified terminal > (which will outlive gdb and gdb's terminal) > > If you're sure gdb's terminal will stay around, and you want to tell GDB to start > the program on that terminal, you can use the "tty /dev/tty" command before starting > the program. I understand. Your description is clear. I'm saying that it would be good to avoid this side effect, if possible. If not, users will have to live with it.