Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Sergio Durigan Junior <sergiodj@redhat.com>
Cc: GDB Patches <gdb-patches@sourceware.org>
Subject: Re: [RFC/PATCH] Add new internal variable $_signo
Date: Mon, 17 Jun 2013 17:20:00 -0000	[thread overview]
Message-ID: <51BF4311.9010502@redhat.com> (raw)
In-Reply-To: <m361xewqdh.fsf@redhat.com>

On 06/16/2013 06:56 AM, Sergio Durigan Junior wrote:
> 
>> > BTW, IMO, $_exitcode (and $_exitsignal) should print the exit
>> > code/signal of the selected inferior.  It was never adjusted
>> > for multi-inferior, so it always prints the exit code of the
>> > inferior that happened to exit last.  Simon's patch for
>> > displaying the inferior's exit-code in MI's -list-thread-groups records
>> > the info in the inferior struct.  Once that is in, we'd just need to
>> > make $_exitcode a lazy convenience var too.
> OK, this paragraph mades sense but made me feel a bit confused.

Ok, that clarify.  Say:

- you're running 100 inferiors under GDB in non-stop mode.
- they're all running (c -a&) while you're inspecting, say
  thread #3 of inferior #1.
- inferiors #4, #65 and #87 exit, with exit codes 10, 20, 30,
  respectively.
- '$_exitcode' is left set to '30', the exit code of inferior #87:

 (gdb) p $_exitcode
 $1 = 30
 (gdb) inferior 4
 (gdb) p $_exitcode
 $2 = 30
 (gdb) inferior 65
 (gdb) p $_exitcode
 $3 = 30
 (gdb) inferior 87
 (gdb) p $_exitcode
 $4 = 30

Meaning, $_exitcode is useless when you consider async debugging,
as it may be overwritten at any point in time.

I was saying that IMO it'd make more sense that GDB behaved like
this instead:

 (gdb) p $_exitcode
 $1 = void
 (gdb) inferior 4
 (gdb) p $_exitcode
 $2 = 10
 (gdb) inferior 65
 (gdb) p $_exitcode
 $3 = 20
 (gdb) inferior 87
 (gdb) p $_exitcode
 $4 = 30
 (gdb) inferior 4
 (gdb) p $_exitcode
 $5 = 10

And that means making the $_exitcode convenience var a lazy
convenience var that prints 'struct inferior'::exit_code,
instead of a regular convenience var that gets set whenever
an inferior exits.

-- 
Pedro Alves


  parent reply	other threads:[~2013-06-17 17:10 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-14  2:39 Sergio Durigan Junior
2013-06-14  7:49 ` Eli Zaretskii
2013-06-16  6:08   ` Sergio Durigan Junior
2013-06-14  8:59 ` Mark Kettenis
2013-06-14  9:37 ` Pierre Muller
2013-06-14 17:59   ` Sergio Durigan Junior
2013-06-14 20:36     ` Pedro Alves
2013-06-15  6:46       ` Sergio Durigan Junior
2013-06-17 17:02         ` Pedro Alves
2013-06-14 17:58 ` Pedro Alves
2013-06-16  5:57   ` Sergio Durigan Junior
2013-06-16  6:25     ` Sergio Durigan Junior
2013-06-17 17:20     ` Pedro Alves [this message]
2013-07-17 18:41 ` Tom Tromey

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=51BF4311.9010502@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=sergiodj@redhat.com \
    /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