From: Eli Zaretskii <eliz@gnu.org>
To: Pierre Muller <pierre.muller@ics-cnrs.unistra.fr>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFC] Avoid invalid parameter warnings in C runtime function for mingw builtr GDB
Date: Fri, 09 Aug 2013 14:09:00 -0000 [thread overview]
Message-ID: <83bo57rm59.fsf@gnu.org> (raw)
In-Reply-To: <"002201ce9414$7e0d7130$7a285390$@muller"@ics-cnrs.unistra.fr>
> From: "Pierre Muller" <pierre.muller@ics-cnrs.unistra.fr>
> Date: Thu, 8 Aug 2013 10:51:37 +0200
>
> Lately I got several warnings with mingw built
> GDB's:
>
> warning: Invalid parameter passed to C runtime function.
>
> Use the new "set stop-on-debug-string-event on"
> command submitted previously in
> http://sourceware.org/ml/gdb-patches/2013-08/msg00236.html
>
> I was able to trace this down to
> the fopen call with mode that to "re".
> As stated in the source, the "e" mode is a glibc extension
> about close on exec which generates this warning.
>
> The patch below excludes this code if __MINGW32__ is defined,
> but maybe it should be excluded if O_CLOEXEC is zero?
Actually, if we want this to be portable, we should have a function to
make a file handle be non-inheritable, instead of relying on glibc
extensions. There _is_ a way to make a file handle non-inheritable on
Windows.
> diff -u -p -r1.7 filestuff.c
> --- src/gdb/common/filestuff.c 26 Jun 2013 08:01:55 -0000 1.7
> +++ src/gdb/common/filestuff.c 7 Aug 2013 12:35:55 -0000
> @@ -311,6 +311,7 @@ FILE *
> gdb_fopen_cloexec (const char *filename, const char *opentype)
> {
> FILE *result = NULL;
> +#ifndef __MINGW32__
> static int fopen_e_ever_failed;
>
> if (!fopen_e_ever_failed)
> @@ -320,17 +321,21 @@ gdb_fopen_cloexec (const char *filename,
> copy = alloca (strlen (opentype) + 2);
> strcpy (copy, opentype);
> /* This is a glibc extension but we try it unconditionally on
> - this path. */
> + this path, except when using Windows OS msvcrt dll,
> + in order to avoid a output debug string event. */
> strcat (copy, "e");
> result = fopen (filename, copy);
> }
> +#endif
>
> if (result == NULL)
> {
> /* Fallback. */
> result = fopen (filename, opentype);
> +#ifndef __MINGW32__
> if (result != NULL)
> fopen_e_ever_failed = 1;
> +#endif
> }
>
> if (result != NULL)
Wouldn't it be better to instead initialize fopen_e_ever_failed to 1
on MinGW? Then the rest of the code will "just work", no?
next parent reply other threads:[~2013-08-09 14:09 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <"002201ce9414$7e0d7130$7a285390$@muller"@ics-cnrs.unistra.fr>
2013-08-09 14:09 ` Eli Zaretskii [this message]
2013-08-13 9:13 ` Pierre Muller
[not found] ` <41630.7793967009$1376385245@news.gmane.org>
2013-08-13 15:37 ` Tom Tromey
2013-08-14 11:38 ` [RFA-v2] Avoid invalid parameter warnings in C runtime function for mingw built GDB Pierre Muller
[not found] ` <520b6c37.e9e6440a.7cfb.45fcSMTPIN_ADDED_BROKEN@mx.google.com>
2013-08-14 12:01 ` Pedro Alves
2013-08-14 12:12 ` [RFA-v3] " Pierre Muller
2013-09-13 22:35 ` Pierre Muller
[not found] ` <5233934f.8360440a.1d3e.ffffa937SMTPIN_ADDED_BROKEN@mx.google.com>
2013-09-13 23:08 ` Doug Evans
2013-09-14 6:30 ` Pierre Muller
[not found] ` <"001401ce9805$6cce7050$466b50f0$@muller"@ics-cnrs.unistra.fr>
2013-08-13 16:35 ` [RFC] Avoid invalid parameter warnings in C runtime function for mingw builtr GDB Eli Zaretskii
[not found] <22647.6293908947$1375951926@news.gmane.org>
2013-08-09 15:26 ` Tom Tromey
2013-08-08 8:51 Pierre Muller
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=83bo57rm59.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=gdb-patches@sourceware.org \
--cc=pierre.muller@ics-cnrs.unistra.fr \
/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