delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2021/02/05/05:36:03

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BAFC438708CD
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1612521316;
bh=FesTuD/1GauD+10qeA+qkpKHFG4CyYP+uTYhCVl3+I0=;
h=Date:To:Subject:In-Reply-To:References:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:
From;
b=wA51jCNm9d6CqihtM9ZYI52bXH89BAPrKpxCTRfH3FytCedVH3bbDlTqt816RCEM/
vr2vjJcYp5ggCwPcF8GX0Kaz9OvMhQ41QLHEdOsye/GoSPdOhPzN8pRLd7UQKr6XRC
TOELTlr9TG4h3sHCV0NSZoTJyS2pnFh6cUSqsDDU=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org ADF05385DC33
DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-04.nifty.com 115AYvXP031732
X-Nifty-SrcIP: [122.249.67.108]
Date: Fri, 5 Feb 2021 19:34:57 +0900
To: cygwin AT cygwin DOT com
Subject: Re: GDB looses pgrp setting in the terminal for debugged process
after break.
Message-Id: <20210205193457.cecc47a50865a59dc3f7041f@nifty.ne.jp>
In-Reply-To: <20210126121402.167ba4ca0d7d8b747feede9f@nifty.ne.jp>
References: <20210126121402 DOT 167ba4ca0d7d8b747feede9f AT nifty DOT ne DOT jp>
X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32)
Mime-Version: 1.0
X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00, DKIM_SIGNED,
DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_NONE,
SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2
X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on
server2.sourceware.org
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.29
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Takashi Yano via Cygwin <cygwin AT cygwin DOT com>
Reply-To: Takashi Yano <takashi DOT yano AT nifty DOT ne DOT jp>
Errors-To: cygwin-bounces AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces AT cygwin DOT com>

On Tue, 26 Jan 2021 12:14:02 +0900
Takashi Yano wrote:
> Hi GDB maintainer,
> 
> In GDB, debugged process cannot continue execution after break
> if it reads stdin.
> 
> With the following steps, cat is terminated with error.
> 
> 1) Install coreutils-debuginfo package.
> 2) Run "gdb cat" in console (command prompt), not in mintty.
> 3) Enter "start" in gdb.
> 4) Enter "cont" in gdb.
> 
> This results in:
> /usr/bin/cat: -: Input/output error
> 
> Both gdb-9.2-1 and gdb-10.1-1(TEST) have this problem.
> 
> I looked into this problem and found the cause is that the pgid
> setting for /usr/bin/cat is lost after break. The following patch
> for GDB source resolves the issue. In the following section,
> winpid is passed to getpgid() rather than cygwin pid. Also, winpid
> is passed to other POSIX system calls such as kill() elsewhere. 
> 
> --- inflow.c.orig	2020-05-24 06:10:29.000000000 +0900
> +++ inflow.c	2021-01-23 17:48:27.963609500 +0900
> @@ -364,11 +364,11 @@
>  #ifdef HAVE_TERMIOS_H
>  	  /* If we can't tell the inferior's actual process group,
>  	     then restore whatever was the foreground pgrp the last
>  	     time the inferior was running.  See also comments
>  	     describing terminal_state::process_group.  */
> -#ifdef HAVE_GETPGID
> +#if defined (HAVE_GETPGID) && !defined (__CYGWIN__)
>  	  result = tcsetpgrp (0, getpgid (inf->pid));
>  #else
>  	  result = tcsetpgrp (0, tinfo->process_group);
>  #endif
>  	  if (result == -1)
> 
> 
> I hope the GDB maintainer will check it out.
> 
> Addresses: https://cygwin.com/pipermail/cygwin-patches/2021q1/011018.html

I have noticed that cygwin gdb essentially has the problem
regarding terminal process group.

Cygwin gdb uses CreateProcessW() to execute debugging process
rather than exec(). If the debugging process is a cygwin process,
cygwin pid is assigned, however, if the debugging process is a
non cygwin process, cygwin pid is not assigned. Therefore, there
is no appropriate process group ID to set.

I wonder what is the right thing under that situation. Any idea?

-- 
Takashi Yano <takashi DOT yano AT nifty DOT ne DOT jp>
--
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019