From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id +6GhEgDFyWDLBAAAWB0awg (envelope-from ) for ; Wed, 16 Jun 2021 05:31:44 -0400 Received: by simark.ca (Postfix, from userid 112) id 3C83B1F163; Wed, 16 Jun 2021 05:31:44 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-0.6 required=5.0 tests=MAILING_LIST_MULTI, RDNS_DYNAMIC autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (ip-8-43-85-97.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 3C1F91E54D for ; Wed, 16 Jun 2021 05:31:43 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DDAA1398B88F for ; Wed, 16 Jun 2021 09:31:42 +0000 (GMT) Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) by sourceware.org (Postfix) with ESMTPS id 322EF3876059 for ; Wed, 16 Jun 2021 09:31:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 322EF3876059 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-wr1-f44.google.com with SMTP id v9so1867827wrx.6 for ; Wed, 16 Jun 2021 02:31:31 -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=d384XQn0Dfl0vJIrKfxediloEf2nNbwM+S2EgJ5aGcA=; b=cnOINa+UutQpuTPZgwzRO2e9m3uSC/c/FdhVOjRkZ/7XuhqKWcg1EBt5EHzT7Tnouf kfMbcFqgGB1qNs7g5AO+AMEORAtxgK1MicGOtx+sHHDiug8ezvWmL+Fma7lc2lclvvXg 2/m7wnEDhwg8iBwb1k0363aDclqblPksNY3VkDLDwDjiQzTGYsHQR5MQObW0MiTc4PUy vaeEhbT5Bn+jRBNfX5au88DS7yUAX6C1ibKfP1WfdZpqNJs/lBG0bVU9hJ95PzGQ6jGQ Mxk6eO/Lo7ezPLZ/2pk9vRqm4fOEaVdJ4CuISjJFxRQ06noNRxD7yL8LAh4DkGgOxFjq Znew== X-Gm-Message-State: AOAM533yL/dGAKw7+ooIjzv8CiPe/mOk3V0dUFpXrhguTcji/XmrTBQx yD7q/CnVhbYJPTVlaCEBHr+y9lmTlshdMA== X-Google-Smtp-Source: ABdhPJzBtYMtz0FsCLw390+HrG/JOnFfdwOB+EW7EnmWvWu81UKLjiGg7Vm74d1ZMC514dvOwyZwzA== X-Received: by 2002:adf:fac6:: with SMTP id a6mr4255029wrs.251.1623835889557; Wed, 16 Jun 2021 02:31:29 -0700 (PDT) Received: from ?IPv6:2001:8a0:f932:6a00:6b6e:c7b6:c5a7:aac3? ([2001:8a0:f932:6a00:6b6e:c7b6:c5a7:aac3]) by smtp.gmail.com with ESMTPSA id k82sm4508539wmf.11.2021.06.16.02.31.28 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 16 Jun 2021 02:31:28 -0700 (PDT) Subject: Re: [PATCH v2 16/16] Document pseudo-terminal and interrupting changes From: Pedro Alves To: Eli Zaretskii References: <20210614212410.1612666-1-pedro@palves.net> <20210614212410.1612666-17-pedro@palves.net> <83r1h34771.fsf@gnu.org> Message-ID: <17e0328a-0404-676a-e5e3-fc753e0db979@palves.net> Date: Wed, 16 Jun 2021 10:31:27 +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: <83r1h34771.fsf@gnu.org> 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! On 2021-06-15 1:56 p.m., Eli Zaretskii wrote: >> +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. 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. The difference is that with my patches the program loses its terminal a step earlier. In v1, the detached program would also get a SIGHUP, but that was fixed in v2, it no longer does. 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. Is this clearer? I can try to adjust the documentation to explain this better and be more descriptive like above. Thanks, Pedro Alves