From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 40822 invoked by alias); 17 Dec 2019 17:00:21 -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 40640 invoked by uid 89); 17 Dec 2019 17:00:11 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-3.5 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.3.1 spammy=tia, HX-Languages-Length:3078 X-HELO: eggs.gnu.org Received: from eggs.gnu.org (HELO eggs.gnu.org) (209.51.188.92) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 17 Dec 2019 17:00:09 +0000 Received: from fencepost.gnu.org ([2001:470:142:3::e]:54335) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ihGCc-0002mS-QZ; Tue, 17 Dec 2019 12:00:06 -0500 Received: from [176.228.60.248] (port=2789 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1ihGCb-00085g-K0; Tue, 17 Dec 2019 12:00:06 -0500 Date: Tue, 17 Dec 2019 17:00:00 -0000 Message-Id: <835zie51mf.fsf@gnu.org> From: Eli Zaretskii To: Pedro Alves CC: philippe.waroquiers@skynet.be, gdb-patches@sourceware.org In-reply-to: (message from Pedro Alves on Mon, 27 May 2019 18:33:11 +0100) Subject: Re: [RFAv3 2/6] Improve process exit status macros on MinGW References: <20190504161753.15530-1-philippe.waroquiers@skynet.be> <20190504161753.15530-3-philippe.waroquiers@skynet.be> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-IsSubscribed: yes X-SW-Source: 2019-12/txt/msg00747.txt.bz2 > From: Pedro Alves > Date: Mon, 27 May 2019 18:33:11 +0100 To recap, back in May Philippe added the 'pipe' command, and we had a brief discussion regarding the use of WIFEXITED, WIFSIGNALED, and other related macros from , on MS-Windows. It was decided back then to leave for later the translation of exit codes returned by 'pipe' in MS-Windows build of GDB. I've now started to look at this issue, with the intent to provide ext status to signal conversion for the MS-Windows ports of GDB, and I have a few questions regarding the details. In that discussion, Pedro commented on Philippe's proposed patch (https://sourceware.org/ml/gdb-patches/2019-05/msg00131.html) which added the definitions for WIF* and WEXIT* macros to gdb_wait.h and their use in widnows-nat.c. The comments are in https://sourceware.org/ml/gdb-patches/2019-05/msg00590.html, and go like this: > > * common/gdb_wait.h (WIFEXITED, WIFSIGNALED, WEXITSTATUS, > > WTERMSIG): Define better versions for MinGW. > > * windows-nat.c (xlate): Uncomment the definition. > > (windows_status_to_termsig): New function. > > windows-nat.c looks like the wrong place to put this. > > windows-nat.c is only included in the build if building a native > debugger. But, you need this functionality on every Windows-hosted build > of GDB, even cross debuggers. So I think you're breaking the build on > the Windows-hosted, non-native-debugger case. > > E.g., --host=mingw --target=arm-none-eabi. > > The right place would be mingw-hdep.c. I'm okay with doing this in mingw-hdep.c, but I'm a bit confused by this comment. The encoding of the fatal exception in the exit status of a program is a feature of the native MS-Windows processes. Does "running cross-debugger" mentioned above allude to running an MS-Windows program? If so, which GDB component (that is presumably not windows-nat.c) is involved in running such cross-debugged programs and for translating the debug status to the likes of TARGET_WAITKIND_EXITED? And how does the 'pipe' command support these cross-debugging use cases (as it uses the 'popen' C library function, which AFAIU runs natively)? > I admit to being a bit confused about why we want to do this > translation for this feature while we don't do it for the exit code > of inferiors running under gdb, for example. I mean, exit status > with 0xc0000000 set don't cause $_exitsignal to be set instead of > $_exitcode. Yes, we should do this for exit code of inferiors as well. Native MS-Windows debugging produces the TARGET_WAITKIND_* values in windows-nat.c, so I think the conversion we are talking about will have to be done there, perhaps _in_addition_to_ other places? IOW, the function that performs the conversion can be defined in mingw-hdep.c, but it will have to be called from windows-nat.c at least, right? And I'm uncertain what other places will have to call that conversion function for the use case of running a cross-debugger, can someone please help me understand that? TIA