From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25435 invoked by alias); 17 Jun 2013 17:10:45 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 25422 invoked by uid 89); 17 Jun 2013 17:10:45 -0000 X-Spam-SWARE-Status: No, score=-8.0 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.1 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Mon, 17 Jun 2013 17:10:44 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r5HHAhkW001235 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 17 Jun 2013 13:10:43 -0400 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r5HHAfMU008266; Mon, 17 Jun 2013 13:10:42 -0400 Message-ID: <51BF4311.9010502@redhat.com> Date: Mon, 17 Jun 2013 17:20:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130514 Thunderbird/17.0.6 MIME-Version: 1.0 To: Sergio Durigan Junior CC: GDB Patches Subject: Re: [RFC/PATCH] Add new internal variable $_signo References: <51BB5592.9060502@redhat.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-SW-Source: 2013-06/txt/msg00385.txt.bz2 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