From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4515 invoked by alias); 24 Feb 2006 08:38:42 -0000 Received: (qmail 4488 invoked by uid 22791); 24 Feb 2006 08:38:41 -0000 X-Spam-Check-By: sourceware.org Received: from out4.smtp.messagingengine.com (HELO out4.smtp.messagingengine.com) (66.111.4.28) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 24 Feb 2006 08:38:40 +0000 Received: from frontend1.internal (mysql-sessions.internal [10.202.2.149]) by frontend1.messagingengine.com (Postfix) with ESMTP id CD36AD387E8 for ; Fri, 24 Feb 2006 03:38:37 -0500 (EST) Received: from frontend2.messagingengine.com ([10.202.2.151]) by frontend1.internal (MEProxy); Fri, 24 Feb 2006 03:38:37 -0500 Received: from [127.0.0.1] (user-0c6sj7r.cable.mindspring.com [24.110.76.251]) by frontend2.messagingengine.com (Postfix) with ESMTP id 4CB1F58A0CE; Fri, 24 Feb 2006 03:38:37 -0500 (EST) Message-ID: <43FEC572.3090403@cwilson.fastmail.fm> Date: Fri, 24 Feb 2006 10:37:00 -0000 From: Charles Wilson User-Agent: Thunderbird 1.5 (Windows/20051201) MIME-Version: 1.0 To: gdb-patches@sourceware.org Subject: Re: RFA: ensure binary objects opened in binary mode References: <43F6473F.8030508@cwilson.fastmail.fm> <20060217234141.GA1918@trixie.casa.cgf.cx> <200602181118.k1IBIwNC028708@elgar.sibelius.xs4all.nl> <43FBF706.9030604@cwilson.fastmail.fm> <20060222185032.GA29383@nevyn.them.org> In-Reply-To: <20060222185032.GA29383@nevyn.them.org> Content-Type: multipart/mixed; boundary="------------030308010808070201080402" Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-02/txt/msg00459.txt.bz2 This is a multi-part message in MIME format. --------------030308010808070201080402 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 1896 Daniel Jacobowitz wrote: > On Wed, Feb 22, 2006 at 08:34:54PM +0200, Eli Zaretskii wrote: >>> (1) for every file that #includes both defs.h AND , remove the >>> inclusion. [snip] >> So I'd prefer if you committed the 1st and the 3rd patch. but not the >> second. However, before you actually do that, let's wait and hear >> what others think. > > Fine by me. > >>> +/* In case this is not defined in fcntl.h */ >>> + >>> +#ifndef O_BINARY >>> +#define O_BINARY 0 >>> +#endif >> I'd change the comment to explain that O_BINARY has a meaning on >> non-Posix platforms, while on Posix platforms it should be a no-op. >> That is the _real_ reason we define O_BINARY. > > Ditto. > Alrighty then -- here's the next iteration. Both parts have changed a bit: the first patch no longer removes #include from solib.c, while the second patch ONLY addresses the #ifndef O_BINARY clutter and no longer removes from the 48 files. Patch 1: defs.h | 12 ++++++++++++ solib.c | 12 ++++++------ 2 files changed, 18 insertions(+), 6 deletions(-) 2006-02-24 Charles Wilson * gdb/defs.h: unconditionally include , and ensure that O_BINARY is defined. * gdb/solib.c(solib_open): ensure solib files are opened in binary mode. Patch 2: corelow.c | 3 --- exec.c | 3 --- remote-rdp.c | 3 --- source.c | 3 --- symfile.c | 3 --- 5 files changed, 15 deletions(-) 2006-02-24 Charles Wilson * gdb/corelow.c: Remove O_BINARY macro definition. * gdb/exec.c: Remove O_BINARY macro definition * gdb/remote-rdp.c: Remove O_BINARY macro definition * gdb/source.c: Remove O_BINARY macro definition * gdb/symfile.c: Remove O_BINARY macro definition Per cgf's earlier message, I can go ahead and check this in myself assuming everybody's happy with it at this point? -- Chuck --------------030308010808070201080402 Content-Type: text/plain; name="gdb-6.4.50.20060131-cvs.solib.patch-attempt3-part1" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="gdb-6.4.50.20060131-cvs.solib.patch-attempt3-part1" Content-length: 3351 Index: defs.h =================================================================== RCS file: /cvs/src/src/gdb/defs.h,v retrieving revision 1.190 diff -u -r1.190 defs.h --- defs.h 17 Dec 2005 22:33:59 -0000 1.190 +++ defs.h 22 Feb 2006 20:37:34 -0000 @@ -39,6 +39,8 @@ #include #endif +#include + /* First include ansidecl.h so we can use the various macro definitions here and in all subsequent file inclusions. */ @@ -58,6 +60,16 @@ #define SEEK_CUR 1 #endif +/* The O_BINARY flag is defined in fcntl.h on some non-Posix platforms. + It is used as an access modifier in calls to open(), where it acts + similarly to the "b" character in fopen()'s MODE argument. On Posix + platforms it should be a no-op, so it is defined as 0 here. This + ensures that the symbol may be used freely elsewhere in gdb. */ + +#ifndef O_BINARY +#define O_BINARY 0 +#endif + #include /* For va_list. */ #include "libiberty.h" Index: solib.c =================================================================== RCS file: /cvs/src/src/gdb/solib.c,v retrieving revision 1.83 diff -u -r1.83 solib.c --- solib.c 21 Jan 2006 22:23:27 -0000 1.83 +++ solib.c 22 Feb 2006 20:37:34 -0000 @@ -171,7 +171,7 @@ } /* Now see if we can open it. */ - found_file = open (temp_pathname, O_RDONLY, 0); + found_file = open (temp_pathname, O_RDONLY | O_BINARY, 0); } /* If the search in solib_absolute_prefix failed, and the path name is @@ -192,32 +192,32 @@ /* If not found, search the solib_search_path (if any). */ if (found_file < 0 && solib_search_path != NULL) found_file = openp (solib_search_path, OPF_TRY_CWD_FIRST, - in_pathname, O_RDONLY, 0, &temp_pathname); + in_pathname, O_RDONLY | O_BINARY, 0, &temp_pathname); /* If not found, next search the solib_search_path (if any) for the basename only (ignoring the path). This is to allow reading solibs from a path that differs from the opened path. */ if (found_file < 0 && solib_search_path != NULL) found_file = openp (solib_search_path, OPF_TRY_CWD_FIRST, - lbasename (in_pathname), O_RDONLY, 0, + lbasename (in_pathname), O_RDONLY | O_BINARY, 0, &temp_pathname); /* If not found, try to use target supplied solib search method */ if (found_file < 0 && ops->find_and_open_solib) - found_file = ops->find_and_open_solib (in_pathname, O_RDONLY, + found_file = ops->find_and_open_solib (in_pathname, O_RDONLY | O_BINARY, &temp_pathname); /* If not found, next search the inferior's $PATH environment variable. */ if (found_file < 0 && solib_absolute_prefix == NULL) found_file = openp (get_in_environ (inferior_environ, "PATH"), - OPF_TRY_CWD_FIRST, in_pathname, O_RDONLY, 0, + OPF_TRY_CWD_FIRST, in_pathname, O_RDONLY | O_BINARY, 0, &temp_pathname); /* If not found, next search the inferior's $LD_LIBRARY_PATH environment variable. */ if (found_file < 0 && solib_absolute_prefix == NULL) found_file = openp (get_in_environ (inferior_environ, "LD_LIBRARY_PATH"), - OPF_TRY_CWD_FIRST, in_pathname, O_RDONLY, 0, + OPF_TRY_CWD_FIRST, in_pathname, O_RDONLY | O_BINARY, 0, &temp_pathname); /* Done. If not found, tough luck. Return found_file and --------------030308010808070201080402 Content-Type: text/plain; name="gdb-6.4.50.20060131-cvs.solib.patch-attempt3-part2" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="gdb-6.4.50.20060131-cvs.solib.patch-attempt3-part2" Content-length: 2201 Index: corelow.c =================================================================== RCS file: /cvs/src/src/gdb/corelow.c,v retrieving revision 1.54 diff -u -r1.54 corelow.c --- corelow.c 24 Jan 2006 22:34:34 -0000 1.54 +++ corelow.c 22 Feb 2006 20:29:45 -0000 @@ -47,9 +47,6 @@ #include "exceptions.h" #include "solib.h" -#ifndef O_BINARY -#define O_BINARY 0 -#endif #ifndef O_LARGEFILE #define O_LARGEFILE 0 Index: exec.c =================================================================== RCS file: /cvs/src/src/gdb/exec.c,v retrieving revision 1.59 diff -u -r1.59 exec.c --- exec.c 17 Dec 2005 22:33:59 -0000 1.59 +++ exec.c 22 Feb 2006 20:29:45 -0000 @@ -42,9 +42,6 @@ #include #include "gdb_stat.h" -#ifndef O_BINARY -#define O_BINARY 0 -#endif #include "xcoffsolib.h" Index: remote-rdp.c =================================================================== RCS file: /cvs/src/src/gdb/remote-rdp.c,v retrieving revision 1.47 diff -u -r1.47 remote-rdp.c --- remote-rdp.c 24 Jan 2006 22:09:28 -0000 1.47 +++ remote-rdp.c 22 Feb 2006 20:29:45 -0000 @@ -791,9 +791,6 @@ #define SWI_GenerateError 0x71 -#ifndef O_BINARY -#define O_BINARY 0 -#endif static int translate_open_mode[] = { Index: source.c =================================================================== RCS file: /cvs/src/src/gdb/source.c,v retrieving revision 1.72 diff -u -r1.72 source.c --- source.c 15 Jan 2006 19:09:30 -0000 1.72 +++ source.c 22 Feb 2006 20:29:45 -0000 @@ -46,9 +46,6 @@ #include "ui-out.h" #include "readline/readline.h" -#ifndef O_BINARY -#define O_BINARY 0 -#endif #define OPEN_MODE (O_RDONLY | O_BINARY) #define FDOPEN_MODE FOPEN_RB Index: symfile.c =================================================================== RCS file: /cvs/src/src/gdb/symfile.c,v retrieving revision 1.165 diff -u -r1.165 symfile.c --- symfile.c 15 Jan 2006 19:50:03 -0000 1.165 +++ symfile.c 22 Feb 2006 20:29:45 -0000 @@ -60,9 +60,6 @@ #include #include -#ifndef O_BINARY -#define O_BINARY 0 -#endif int (*deprecated_ui_load_progress_hook) (const char *section, unsigned long num); void (*deprecated_show_load_progress) (const char *section, --------------030308010808070201080402--