From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32676 invoked by alias); 22 Apr 2019 10:30:24 -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 26941 invoked by uid 89); 22 Apr 2019 10:30:14 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-7.1 required=5.0 tests=AWL,BAYES_20,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.1 spammy=understanding, UD:be, H*F:D*be, HX-Languages-Length:1723 X-HELO: mailsec101.isp.belgacom.be Received: from mailsec101.isp.belgacom.be (HELO mailsec101.isp.belgacom.be) (195.238.20.97) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 22 Apr 2019 10:30:03 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=skynet.be; i=@skynet.be; q=dns/txt; s=securemail; t=1555929003; x=1587465003; h=message-id:subject:from:to:cc:date:in-reply-to: references:mime-version:content-transfer-encoding; bh=kNpOtKv+lKo+mJJCh2qc8EdI3IXcCMB4tDYkmtTGq8A=; b=D51i75acoKHuq6fe76FI1r7EiUog6T/r0MPZFc87ihtNMfcM9JTQ9zc0 OKrQQ/ZkSd1qF3Y7wb7mbkTwkU/1cw==; Received: from 45.123-131-109.adsl-dyn.isp.belgacom.be (HELO md) ([109.131.123.45]) by relay.skynet.be with ESMTP/TLS/AES256-GCM-SHA384; 22 Apr 2019 12:30:01 +0200 Message-ID: <1555929000.6208.20.camel@skynet.be> Subject: Re: [RFA 2/4] Implement | (pipe) command. From: Philippe Waroquiers To: Eli Zaretskii Cc: gdb-patches@sourceware.org Date: Mon, 22 Apr 2019 10:30:00 -0000 In-Reply-To: <838sw3acgz.fsf@gnu.org> References: <20190420212153.30934-1-philippe.waroquiers@skynet.be> <20190420212153.30934-3-philippe.waroquiers@skynet.be> <83r29w9bpw.fsf@gnu.org> <1555839622.6208.17.camel@skynet.be> <838sw3acgz.fsf@gnu.org> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2019-04/txt/msg00413.txt.bz2 On Sun, 2019-04-21 at 13:18 +0300, Eli Zaretskii wrote: > Here's my proposal: > > #define WIFEXITED(stat_val) (((stat_val) & 0xC0000000) == 0) > #define WIFSIGNALED(stat_val) (((stat_val) & 0xC0000000) == 0xC0000000) > #define WEXITSTATUS(stat_val) ((stat_val) & 255) > #define WTERMSIG(stat_val) windows_status_to_termsig (stat_val) > > where windows_status_to_termsig should use the xlate[] array defined > in windows-nat.c, like the (ifdef'ed away) code in > windows_nat_target::resume does. > > The underlying idea is that when a Windows program is terminated by a > fatal exception, its exit code is the value of that exception, as > defined by the various STATUS_* symbols in the Windows API headers. > > The above is not perfect, because a program could legitimately exit > normally with a status whose value happens to have the high bits set, > but that's extremely rare, to say the least, and I think such a > negligibly small probability of false positives is justified by the > utility of reporting the terminating signal in the "normal" cases. Thanks for the above. To confirm what to do, I will try to explain my current understanding: Currently, on MingW, the above macros (WIFEXITED, WIFSIGNALED, ...) are not defined. So, the idea is to have gdb_wait.h defining them on MingW, with something like: #ifndef WIFEXITED #if defined (__MINGW32__) #define WIFEXITED(stat_val)   (((stat_val) & 0xC0000000) == 0) #else #define WIFEXITED(w) (((w)&0377) == 0) #endif #endif Then in windows-nat.c, implement windows_status_to_termsig that searches in xlate for stat_val & ~0xC0000000 to give the equivalent signal. Does the above look reasonable ? Thanks Philippe