public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Jon Turney <jon.turney@dronecode.org.uk>
To: Ken Brown <kbrown@cornell.edu>,
	The Cygwin Mailing List <cygwin@cygwin.com>
Subject: Re: Can't debug bash with gdb 8.2.1-1
Date: Tue, 23 Jul 2019 18:02:00 -0000	[thread overview]
Message-ID: <d4efc941-490d-135b-cfd3-ef7b25f93104@dronecode.org.uk> (raw)
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

  reply	other threads:[~2019-07-23 18:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-22 14:59 Ken Brown
2019-07-23 13:52 ` Jon Turney
2019-07-23 15:42   ` Ken Brown
2019-07-23 18:02     ` Jon Turney [this message]
2019-07-24 12:33       ` Ken Brown
2019-07-24 14:32         ` Ken Brown
2019-07-24 14:42           ` Ken Brown
2019-07-25 12:12             ` Jon Turney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d4efc941-490d-135b-cfd3-ef7b25f93104@dronecode.org.uk \
    --to=jon.turney@dronecode.org.uk \
    --cc=cygwin@cygwin.com \
    --cc=kbrown@cornell.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).