From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 99717 invoked by alias); 23 Jul 2019 18:02:37 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 99600 invoked by uid 89); 23 Jul 2019 18:02:37 -0000 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 Received: from rgout0706.bt.lon5.cpcloud.co.uk (HELO rgout0706.bt.lon5.cpcloud.co.uk) (65.20.0.146) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 23 Jul 2019 18:02:34 +0000 X-OWM-Source-IP: 86.179.112.104 (GB) X-OWM-Env-Sender: jonturney@btinternet.com X-VadeSecure-score: verdict=clean score=0/300, class=clean X-SNCR-VADESECURE: CLEAN Received: from [192.168.1.102] (86.179.112.104) by rgout07.bt.lon5.cpcloud.co.uk (9.0.019.26-1) (authenticated as jonturney@btinternet.com) id 5C6509360E87C890; Tue, 23 Jul 2019 19:02:32 +0100 Subject: Re: Can't debug bash with gdb 8.2.1-1 To: Ken Brown , The Cygwin Mailing List References: <37d412b3-f0ff-b079-4d64-16b01898b420@cornell.edu> <73dcccf2-33a0-7608-269b-e9cb9abc2238@dronecode.org.uk> <10d70ba8-41a8-10e8-0ab0-5be526931de7@cornell.edu> From: Jon Turney Message-ID: Date: Tue, 23 Jul 2019 18:02:00 -0000 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> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2019-07/txt/msg00210.txt.bz2 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 > int > main () > { > pid_t t = getpgrp (); > } Hmm.... let me clarify what I mean: $ cat getpgrp_test.c #include #include 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