delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2019/07/23/14:03:37

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:subject:to:references:from:message-id:date
:mime-version:in-reply-to:content-type
:content-transfer-encoding; q=dns; s=default; b=HW6fyzepPTlksHe7
xNNlOxYj2XAmFlyU/mtXSDfjYhSn37T+XY8lwqRJeu7IsPzlW2Oz+QlcvEAWimI+
ZMUGHesPNbTyZVekgVShdTA3exQ7Q3PjWFebr9nNE2ehY7HlurDuFH/cAjIDgk6n
POpC2DqS8ad4dwpf1LyDR9XTpMM=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:subject:to:references:from:message-id:date
:mime-version:in-reply-to:content-type
:content-transfer-encoding; s=default; bh=JW147nlW+/cEDSqK+X+ydK
gQ+iQ=; b=h4YCA1tYG6uqq6rd5qrUOjMsmD57WxHoiKt0zcfWuhH9osZmRQy2wn
j6a8im+sWUfkxVlpqT6gs+YrwbXMt6FEmCBVmbwHTAlWtbVc+RVOrLlJ2Q/ukd4v
XOfyIqd5Fx6eHhe0mMu7zwESZJWOAeF/JfOaCuvgN+R5TPtz99qT0=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00,KAM_NUMSUBJECT,RCVD_IN_DNSWL_NONE autolearn=no version=3.3.1 spammy=8.2.1-1, 8211, Cant, Can't
X-HELO: rgout0706.bt.lon5.cpcloud.co.uk
X-OWM-Source-IP: 86.179.112.104 (GB)
X-OWM-Env-Sender: jonturney AT btinternet DOT com
X-VadeSecure-score: verdict=clean score=0/300, class=clean
X-SNCR-VADESECURE: CLEAN
Subject: Re: Can't debug bash with gdb 8.2.1-1
To: Ken Brown <kbrown AT cornell DOT edu>,
The Cygwin Mailing List <cygwin AT cygwin DOT com>
References: <37d412b3-f0ff-b079-4d64-16b01898b420 AT cornell DOT edu> <73dcccf2-33a0-7608-269b-e9cb9abc2238 AT dronecode DOT org DOT uk> <10d70ba8-41a8-10e8-0ab0-5be526931de7 AT cornell DOT edu>
From: Jon Turney <jon DOT turney AT dronecode DOT org DOT uk>
Message-ID: <d4efc941-490d-135b-cfd3-ef7b25f93104@dronecode.org.uk>
Date: Tue, 23 Jul 2019 19:02:29 +0100
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0
MIME-Version: 1.0
In-Reply-To: <10d70ba8-41a8-10e8-0ab0-5be526931de7@cornell.edu>

On 23/07/2019 16:42, Ken Brown wrote:
> On 7/23/2019 9:51 AM, Jon Turney wrote:
>> On 22/07/2019 15:59, Ken Brown wrote:
>>> With the test version of gdb, attempting to debug bash fails as follows:
>>>
>>> $ gdb bash
>>> GNU gdb (GDB) (Cygwin 8.2.1-1) 8.2.1
>>> [...]
>>> Reading symbols from bash...Reading symbols from
>>> /usr/lib/debug//usr/bin/bash.exe.dbg...done.
>>> done.
>>> (gdb) r -c ls
>>> Starting program: /usr/bin/bash -c ls
>>> [...]
>>> /usr/bin/bash: initialize_job_control: getpgrp failed: No error
>>> [...]
>>> [Inferior 1 (process 31876) exited with code 01]
>>>
>>> This problem doesn't occur with gdb-8.1.1-1.
>> Thanks for reporting this.
>>
>> I had also tripped over this problem recently: It seems that changes in gdb
>> (bisection lands on [1]) mean that any call to getpgrp() in the inferior fails
>> (this can be demonstrated with a test program that just calls that).
> 
> I can't reproduce that with the following test program:
> 
> $ cat getpgrp_test.c
> #include <unistd.h>
> int
> main ()
> {
>     pid_t t = getpgrp ();
> }

Hmm.... let me clarify what I mean:

$ cat getpgrp_test.c
#include <unistd.h>
#include <stdio.h>

int main() {
   printf("getpgrp() = %d\n", getpgrp());
}

$ gcc getpgrp_test.c -o getpgrp_test.exe

$ ./getpgrp_test
getpgrp() = 1241


$ gdb ./getpgrp_test
GNU gdb (GDB) (Cygwin 8.2.1-1) 8.2.1
[...]
Reading symbols from ./getpgrp_test...done.
(gdb) r
Starting program: /work/getpgrp_test
getpgrp() = -1
[Inferior 1 (process 11428) exited normally]

>> I believe this is behaviour is caused by some kind of defect in the cygwin DLL,
>> but I haven't made much progress in investigating it. (I don't really understand
>> how the inferior gets into a state where getpgrp() fails, which isn't really
>> supposed to happen...)
> 
> POSIX says that getpgrp() never fails, but Cygwin's getpgrp() can in fact fail.
> I'm about to send a proposed fix to cygwin-patches.  I've just checked that the
> bash example succeeds with my patch installed.

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


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