Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
[parent not found: <"002201ce9414$7e0d7130$7a285390$@muller"@ics-cnrs.unistra.fr>]
* [RFC] Avoid invalid parameter warnings in C runtime function for mingw builtr GDB
@ 2013-08-08  8:51 Pierre Muller
  0 siblings, 0 replies; 6+ messages in thread
From: Pierre Muller @ 2013-08-08  8:51 UTC (permalink / raw)
  To: gdb-patches

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?

Comments welcome.


Pierre Muller
GDB pascal language maintainer

2013-08-07  Pierre Muller  <muller@sourceware.org>

	* src/gdb/common/filestuff.c (gdb_fopen_cloexec): Do not
	try to use "e" mode if linking to Windows OS msvcrt DLL,
	to avoid getting a output debug string event.


Index: src/gdb/common/filestuff.c
===================================================================
RCS file: /cvs/src/src/gdb/common/filestuff.c,v
retrieving revision 1.7
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)


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-08-13 16:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <22647.6293908947$1375951926@news.gmane.org>
2013-08-09 15:26 ` [RFC] Avoid invalid parameter warnings in C runtime function for mingw builtr GDB Tom Tromey
     [not found] <"002201ce9414$7e0d7130$7a285390$@muller"@ics-cnrs.unistra.fr>
2013-08-09 14:09 ` Eli Zaretskii
2013-08-13  9:13   ` Pierre Muller
     [not found]   ` <41630.7793967009$1376385245@news.gmane.org>
2013-08-13 15:37     ` Tom Tromey
     [not found]   ` <"001401ce9805$6cce7050$466b50f0$@muller"@ics-cnrs.unistra.fr>
2013-08-13 16:35     ` Eli Zaretskii
2013-08-08  8:51 Pierre Muller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox