From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11652 invoked by alias); 8 Aug 2013 08:51:49 -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 11611 invoked by uid 89); 8 Aug 2013 08:51:49 -0000 X-Spam-SWARE-Status: No, score=0.7 required=5.0 tests=AWL,BAYES_50,MSGID_MULTIPLE_AT,RDNS_NONE autolearn=no version=3.3.1 Received: from Unknown (HELO mailhost.u-strasbg.fr) (130.79.201.46) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Thu, 08 Aug 2013 08:51:48 +0000 Received: from md16.u-strasbg.fr (md16.u-strasbg.fr [130.79.200.206]) by mailhost.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id r788pddK005423 for ; Thu, 8 Aug 2013 10:51:39 +0200 (CEST) (envelope-from pierre.muller@ics-cnrs.unistra.fr) Received: from ms14.u-strasbg.fr (ms14.u-strasbg.fr [130.79.204.114]) by md16.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id r788pd1a021675 for ; Thu, 8 Aug 2013 10:51:39 +0200 (envelope-from pierre.muller@ics-cnrs.unistra.fr) Received: from E6510Muller (gw-ics.u-strasbg.fr [130.79.210.225]) (Authenticated sender: mullerp) by ms14.u-strasbg.fr (Postfix) with ESMTPSA id 176A61FD84 for ; Thu, 8 Aug 2013 10:51:39 +0200 (CEST) From: "Pierre Muller" To: Subject: [RFC] Avoid invalid parameter warnings in C runtime function for mingw builtr GDB Date: Thu, 08 Aug 2013 08:51:00 -0000 Message-ID: <002201ce9414$7e0d7130$7a285390$@muller@ics-cnrs.unistra.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-SW-Source: 2013-08/txt/msg00237.txt.bz2 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 * 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)