public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Ken Brown <kbrown@cornell.edu>
To: Jon Turney <jon.turney@dronecode.org.uk>,
	The Cygwin Mailing List	<cygwin@cygwin.com>
Subject: Re: Can't debug bash with gdb 8.2.1-1
Date: Wed, 24 Jul 2019 12:33:00 -0000	[thread overview]
Message-ID: <bb19dff5-80ed-ef65-d9a8-2a359705423c@cornell.edu> (raw)
In-Reply-To: <d4efc941-490d-135b-cfd3-ef7b25f93104@dronecode.org.uk>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 1640 bytes --]

On 7/23/2019 2:02 PM, Jon Turney wrote:
> 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]

Thanks, I was being dense.  But look at this one:

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

int
main ()
{
   pid_t pid = getpid ();
   pid_t pgid = getpgid (0);
   printf ("getpid () = %d, getpgid (0) = %d, errno = %d\n", pid, pgid, errno);
}

$ gcc -o getpgrp_test -Wall -g -O0 getpgrp_test.c

$ ./getpgrp_test.exe
getpid () = 1424, getpgid (0) = 1424, errno = 0

$ gdb ./getpgrp_test.exe
GNU gdb (GDB) (Cygwin 8.2.1-1) 8.2.1
[...]
(gdb) r
Starting program: /home/kbrown/Documents/programming/misc_examples/getpgrp_test.exe
[...]
getpid () = 1427, getpgid (0) = -1, errno = 0
[...]
[Inferior 1 (process 23872) exited normally]

So getpgid (0) returns -1 without setting errno.  I think this means that 
pinfo::init() didn't fail, but for some reason myself->pgid == -1.

Ken
\x03B‹KCB”\x1c›Ø›\x19[H\x1c™\^[ܝ\x1cΈ\b\b\b\b\b\b\x1a\x1d\x1d\x1c\x0e‹ËØÞYÝÚ[‹˜ÛÛKÜ\x1c›Ø›\x19[\Ëš\x1d^[[\x03B‘TNˆ\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\x1a\x1d\x1d\x1c\x0e‹ËØÞYÝÚ[‹˜ÛÛKÙ˜\KÃB‘^[ØÝ[Y[\x18]\x1a[ÛŽˆ\b\b\b\b\b\b\b\b\x1a\x1d\x1d\x1c\x0e‹ËØÞYÝÚ[‹˜ÛÛKÙ^[ØÜËš\x1d^[[\x03B•[œÝXœØÜšX™H\x1a[™›Îˆ\b\b\b\b\b\x1a\x1d\x1d\x1c\x0e‹ËØÞYÝÚ[‹˜ÛÛKÛ[\vÈÝ[œÝXœØÜšX™K\Ú[\^[\x19CBƒB

  reply	other threads:[~2019-07-24 12:33 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
2019-07-24 12:33       ` Ken Brown [this message]
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=bb19dff5-80ed-ef65-d9a8-2a359705423c@cornell.edu \
    --to=kbrown@cornell.edu \
    --cc=cygwin@cygwin.com \
    --cc=jon.turney@dronecode.org.uk \
    /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).