From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26044 invoked by alias); 18 Jul 2013 16:48:54 -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 26018 invoked by uid 89); 18 Jul 2013 16:48:54 -0000 X-Spam-SWARE-Status: No, score=-5.5 required=5.0 tests=AWL,BAYES_00,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,RDNS_NONE,SPF_HELO_PASS,SPF_PASS autolearn=no version=3.3.1 Received: from Unknown (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Thu, 18 Jul 2013 16:48:53 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r6IGmhTF018911 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 18 Jul 2013 12:48:44 -0400 Received: from barimba (ovpn-113-128.phx2.redhat.com [10.3.113.128]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r6IGmfMU025577 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Thu, 18 Jul 2013 12:48:42 -0400 From: Tom Tromey To: Sergio Durigan Junior Cc: "Pierre Muller" , "'GDB Patches'" Subject: Re: [RFC/PATCH] New convenience variable $_exitsignal References: <00db01ce6b24$0b716aa0$22543fe0$@muller@ics-cnrs.unistra.fr> Date: Thu, 18 Jul 2013 16:48:00 -0000 In-Reply-To: (Sergio Durigan Junior's message of "Mon, 17 Jun 2013 14:51:52 -0300") Message-ID: <87bo5zbyqe.fsf@fleche.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2013-07/txt/msg00456.txt.bz2 >>>>> "Sergio" == Sergio Durigan Junior writes: Sergio> To the extent of my knowledge, this is a shell feature. It sets $? (the Sergio> variable which contains the exit code of the program) to 128 + signal Sergio> number. No, it's actually how things work under the hood. When you call 'wait' (or one of its many equivalent APIs), the result you get is an integer that encodes whether the program exited normally or via signal; if normally, the exit code; or if via signal, which signal. This touches on Doug's question of how to use these variables generically. There's no nice way for a script to use this right now, partly because gdb's scripting is so limited, but also because the two values are put into two separate variables. Just having a variable that is "the exit status as the OS reports it" seems nice, but then it means reimplementing WIFEXITED and friends. Not perhaps the friendliest. Tom