From: Charles Wilson Date: Sat, 25 Feb 2006 04:36:39 +0000 (+0000) Subject: * gdb/defs.h: unconditionally include , and X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=637d6690a829770987bd4433aacb157fc59ffb77;p=binutils-gdb.git * 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. * 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 --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 89c58aeefba..f3e9d1082a2 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,15 @@ +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. + * 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 + 2006-02-24 Randolph Chung * hppa-hpux-tdep.c (hppa_hpux_push_dummy_code): Initialize diff --git a/gdb/corelow.c b/gdb/corelow.c index 2ccbd5b0258..226b48b5057 100644 --- a/gdb/corelow.c +++ b/gdb/corelow.c @@ -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 diff --git a/gdb/defs.h b/gdb/defs.h index d983dfc195e..1512a6a7bf3 100644 --- a/gdb/defs.h +++ b/gdb/defs.h @@ -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" diff --git a/gdb/exec.c b/gdb/exec.c index 31dd636d4aa..248f7ee22d7 100644 --- a/gdb/exec.c +++ b/gdb/exec.c @@ -42,9 +42,6 @@ #include #include "gdb_stat.h" -#ifndef O_BINARY -#define O_BINARY 0 -#endif #include "xcoffsolib.h" diff --git a/gdb/remote-rdp.c b/gdb/remote-rdp.c index 4533cdf7a58..54eaf778cdd 100644 --- a/gdb/remote-rdp.c +++ b/gdb/remote-rdp.c @@ -791,9 +791,6 @@ argsin; #define SWI_GenerateError 0x71 -#ifndef O_BINARY -#define O_BINARY 0 -#endif static int translate_open_mode[] = { diff --git a/gdb/solib.c b/gdb/solib.c index cd81274c9d8..1368227c638 100644 --- a/gdb/solib.c +++ b/gdb/solib.c @@ -171,7 +171,7 @@ solib_open (char *in_pathname, char **found_pathname) } /* 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 @@ solib_open (char *in_pathname, char **found_pathname) /* 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 diff --git a/gdb/source.c b/gdb/source.c index 3b93362b5e3..927601d3df3 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -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 diff --git a/gdb/symfile.c b/gdb/symfile.c index 841d738a830..59cd3dc7595 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -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,