gdb uses solib_open() to open solibs via open(), openp(), or ops->find_and_open_solib(), using the O_RDONLY flag. Later, bfd_open uses fdopen(filedescriptor_from_solib_open, "rb") to change the text/binary mode (to binary) on platforms where that matters -- like cygwin and mingw. Now, cygwin's fdopen implementation does the right thing and does, in fact, change the mode to binary. So, on cygwin, this "bug" has no practical effect; this is not true for mingw, where the mode is NOT changed to binary (which leads to all sorts of problems parsing the file). However, even on cygwin, it's still *wrong* for gdb to open a solib (which is by definition a binary object) in text mode -- even if it gets "fixed" later by bfd_open(). So IMO this patch is "the right thing" for both cygwin and mingw, even tho there is no observable change in cygwin's behavior -- and it DOES fix a serious bug on mingw. Oh, and about the #ifndef O_BINARY stuff in this .c file: look at gdb/source.c before commenting. Also, as this patch adds only three non-blank lines and modifies only six more (all in exactly the same way), I believe it falls under the FSF definition of trivial. 2006-02-17 Charles Wilson <...> * gdb/solib.c(solib_open): ensure solib files are opened in binary mode. -- Chuck