From: Pedro Alves <palves@redhat.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: philippe.waroquiers@skynet.be, gdb-patches@sourceware.org
Subject: Re: [RFAv3 2/6] Improve process exit status macros on MinGW
Date: Tue, 17 Dec 2019 17:51:00 -0000 [thread overview]
Message-ID: <52c4ca33-ffc4-8e1e-fe08-a92123ef02aa@redhat.com> (raw)
In-Reply-To: <835zie51mf.fsf@gnu.org>
On 12/17/19 4:59 PM, Eli Zaretskii wrote:
>> From: Pedro Alves <palves@redhat.com>
>> 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 <sys/wait.h>, 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?
The issue pointed out was that by putting the windows_status_to_termsig
function in windows-nat.c, and then calling it from gdb's common code
(cli/cli-cmds.c, via WTERMSIG) would result in a build/link failure when
you try to build a cross debugger hosted on mingw, because such a gdb
build does not include the native Windows target support, i.e., does not
build/link the windows-nat.o object. Putting said function in mingw-hdep.c
instead fixes that issue because that file is included as part of the build
in all kinds of mingw-hosted GDBs, either native or cross-debugger.
>> 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?
You'll also want to call it in gdbserver's win32-low.c file, so that
you get the translation too when debugging against gdbserver.
This actually suggests putting the new function in some new
shared file in gdb/gdbsupport/, since gdb/mingw-hdep.c is gdb-only.
Thanks,
Pedro Alves
next prev parent reply other threads:[~2019-12-17 17:51 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-04 16:18 [RFAv3 0/6] Implement | (pipe) command Philippe Waroquiers
2019-05-04 16:18 ` [RFAv3 6/6] NEWS and documentation for " Philippe Waroquiers
2019-05-04 16:26 ` Eli Zaretskii
2019-05-04 16:33 ` Eli Zaretskii
2019-05-27 17:51 ` Pedro Alves
2019-05-04 16:18 ` [RFAv3 2/6] Improve process exit status macros on MinGW Philippe Waroquiers
2019-05-27 17:33 ` Pedro Alves
2019-05-27 18:38 ` Eli Zaretskii
2019-05-29 12:38 ` Pedro Alves
2019-05-29 15:03 ` Eli Zaretskii
2019-05-30 10:26 ` Philippe Waroquiers
2019-12-17 17:00 ` Eli Zaretskii
2019-12-17 17:51 ` Pedro Alves [this message]
2019-12-18 17:08 ` Eli Zaretskii
2019-12-18 17:42 ` Pedro Alves
2019-12-18 18:33 ` Eli Zaretskii
2019-12-25 15:57 ` Eli Zaretskii
2020-01-03 19:59 ` Pedro Alves
2020-01-03 20:08 ` Pedro Alves
2020-01-03 20:34 ` Eli Zaretskii
2020-01-06 11:57 ` Pedro Alves
2020-01-06 16:17 ` Eli Zaretskii
2020-01-06 18:51 ` Pedro Alves
2020-01-06 19:26 ` Eli Zaretskii
2020-01-06 18:59 ` Hannes Domani via gdb-patches
2020-01-06 19:34 ` Eli Zaretskii
2020-01-06 19:38 ` Hannes Domani via gdb-patches
2020-01-06 19:55 ` Eli Zaretskii
2020-01-03 17:04 ` Pedro Alves
2019-05-04 16:18 ` [RFAv3 5/6] Test the | (pipe) command Philippe Waroquiers
2019-05-27 17:49 ` Pedro Alves
2019-05-04 16:18 ` [RFAv3 1/6] Add previous_saved_command_line to allow a command to repeat a previous command Philippe Waroquiers
2019-05-27 17:29 ` Pedro Alves
2019-05-04 16:18 ` [RFAv3 3/6] Add function execute_command_to_ui_file Philippe Waroquiers
2019-05-04 16:18 ` [RFAv3 4/6] Implement | (pipe) command Philippe Waroquiers
2019-05-27 17:48 ` Pedro Alves
2019-05-27 17:55 ` Pedro Alves
[not found] <271718487.11947642.1578332826544.ref@mail.yahoo.com>
2020-01-06 17:47 ` [RFAv3 2/6] Improve process exit status macros on MinGW Hannes Domani via gdb-patches
2020-01-06 18:23 ` Eli Zaretskii
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=52c4ca33-ffc4-8e1e-fe08-a92123ef02aa@redhat.com \
--to=palves@redhat.com \
--cc=eliz@gnu.org \
--cc=gdb-patches@sourceware.org \
--cc=philippe.waroquiers@skynet.be \
/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