This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch(es) for mingw


A month or two ago, Dave Murphy uploaded a (pre-compiled) version of insight/gdb to the mingw sourceforge website (http://sourceforge.net/project/showfiles.php?group_id=2435&package_id=82725&release_id=371590). This was based on gdb CVS 6.3.50-20051116, with a 32k patch also available at the preceding URL. However, there were still a few issues:

(1) Couldn't single-step (null pointer error in solib.c(in_solib_dynsym_resolve_code)
(2) Couldn't map shared library sections/read shared library symbols


I tracked these down, and was able to correct them with just a few minor changes (on top of Dave's original patch, which I brought forward to gdb CVS 6.4.50-20060131). My changes are quite minor, since Dave's patch does most of the work. For a detailed description of the observed behavior (with Dave's patch, but without my fixes), see this forum thread: http://sourceforge.net/forum/forum.php?thread_id=1430825&forum_id=511897

I hope that Dave does not take it amiss if I post the forward-ported version of his patch here, but I want to keep it here together with my dependent contributions. He has posted portions of it to this list before (notably, here: http://sources.redhat.com/ml/gdb-patches/2005-09/msg00205.html), and of course the full version against 6.3.50.20051116 at the URL at the top of this email).

My forward ported version of his patch differs only in line-number fuzz, so it's really his, and not mine -- which means he'll have to re-post it or sign off on it, not me; and that'll have to happen before my minor contributions can really be considered. So, I've not created a ChangeLog entry for his stuff, but it should be noted that Dave's patch creates 7 new files:
config/mh-mingw32
gdb/config/arm/mingw_embed.mt
gdb/config/i386/mingw32.mh
gdb/config/i386/mingw32.mt
gdb/config/i386/nm-mingw32.h
gdb/config/i386/tm-mingw32.h
gdb/config/i386/xm-mingw32.h
in addition to modifying 21 others (diffstat output for all both patches below). It's also possible that Dave's patch should be split into (at least) 2 pieces because some of it is really insight/tcl/tk, not gdb.


However, with Dave's patch and my minor fixes, I can build an insight/gdb under mingw that actually works when dealing with apps that link to DLLs.


2006-02-02 Charles Wilson <...>


	* gdb/config/i386/nm-mingw32.h: define
	IN_SOLIB_DYNSYM_RESOLVE_CODE macro
	* gdb/win32-nat.c(register_loaded_dll): make sure so->so_name
	is populated, even on non-cygwin
	* gdb/solib.c(solib_open): ensure solib files are opened in
	binary mode.

That binary mode one was fun. Didja know that "This program cannot be run in DOS mode." in the DOS stub of DLLs/EXEs is really "This program cannot be run in DOS mode.\r\r\n"? bfd_seek got all messed up, and the image_hdr.nt_signature contained the wrong bytes... Worse, even tho bfd_open "re-opens" the descriptor in binary mode by using
fdopen(filedescriptor_from_solib_open, "rb")
the actual mode does *not* get changed to binarymode in the gdb executable -- as I determined by actually inspecting the buffers in bfd_bread/cache_bread. But in a tiny test app using the same sequence, it _does_ work.


  int fd = open(..., O_RDONLY);
     >> explicit test/inspection: it's text mode here
  FILE* f = fdopen(fd, "rb");
     >> explicit test/inspection: it's binary mode here

Totally bizarre. But, the proof is in the pudding: by making the changes to solib.c, the solib is definitely opened in binary mode, and symbols are successfully read and sections are successfully mapped.


gdb-6.4.50.20060131-cvs.patch-CharlesWilson2


 config/i386/nm-mingw32.h |    3 +++
 solib.c                  |   16 ++++++++++------
 win32-nat.c              |    2 ++
 3 files changed, 15 insertions(+), 6 deletions(-)

gdb-6.4.50.20060131-cvs.patch-DaveMurphy1

Makefile.in | 2
bfd/doc/chew.c | 6 +
config/mh-mingw32 | 7 +
configure | 1
gdb/config/arm/mingw_embed.mt | 7 +
gdb/config/i386/mingw32.mh | 5 +
gdb/config/i386/mingw32.mt | 4 +
gdb/config/i386/nm-mingw32.h | 38 +++++++++
gdb/config/i386/tm-mingw32.h | 21 +++++
gdb/config/i386/xm-mingw32.h | 25 ++++++
gdb/configure | 4 -
gdb/configure.host | 1
gdb/configure.tgt | 7 +
gdb/gdbtk/generic/gdbtk-cmds.c | 2
gdb/gdbtk/generic/gdbtk-hooks.c | 2
gdb/gdbtk/generic/gdbtk-interp.c | 5 +
gdb/gdbtk/generic/gdbtk.c | 15 +++
gdb/gdbtk/library/download.itb | 2
gdb/gdbtk/library/interface.tcl | 2
gdb/gdbtk/library/prefs.tcl | 2
gdb/gdbtk/library/session.tcl | 2
gdb/gdbtk/library/srctextwin.itb | 4 -
gdb/remote-rdp.c | 8 ++
gdb/remote-sim.c | 4 +
gdb/win32-nat.c | 133 ++++++++++++++++++++++++++++++++-
tcl/win/tclWin32Dll.c | 155 +++++++++++++++++++++++++++------------
tcl/win/tclWinChan.c | 6 -
tcl/win/tclWinFCmd.c | 4 -
28 files changed, 408 insertions(+), 66 deletions(-)



-- Chuck Wilson
Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/Makefile.in,v
retrieving revision 1.236
diff -u -r1.236 Makefile.in
--- Makefile.in	5 Jan 2006 17:45:45 -0000	1.236
+++ Makefile.in	1 Feb 2006 21:21:21 -0000
@@ -23245,7 +23245,7 @@
 	srcdiroption="--srcdir=$${topdir}/sim"; \
 	libsrcdir="$$s/sim"; \
 	$(SHELL) $${libsrcdir}/configure \
-	  $(HOST_CONFIGARGS) $${srcdiroption}  \
+	  `echo $(HOST_CONFIGARGS) | sed -e 's/--disable-nls//'` $${srcdiroption}  \
 	  || exit 1
 @endif sim
 
Index: configure
===================================================================
RCS file: /cvs/src/src/configure,v
retrieving revision 1.210
diff -u -r1.210 configure
--- configure	26 Jan 2006 18:56:01 -0000	1.210
+++ configure	1 Feb 2006 21:21:22 -0000
@@ -1735,6 +1735,7 @@
     host_makefile_frag="config/mh-cygwin"
     ;;
   *-mingw32*)
+    host_makefile_frag="config/mh-mingw32"
     ;;
   *-interix*)
     host_makefile_frag="config/mh-interix"
Index: bfd/doc/chew.c
===================================================================
RCS file: /cvs/src/src/bfd/doc/chew.c,v
retrieving revision 1.19
diff -u -r1.19 chew.c
--- bfd/doc/chew.c	24 Jul 2005 16:57:42 -0000	1.19
+++ bfd/doc/chew.c	1 Feb 2006 21:21:28 -0000
@@ -92,6 +92,12 @@
 #define DEF_SIZE 5000
 #define STACK 50
 
+#ifdef __MINGW32__
+/* Prevent \r\n\ line endings */
+#include <fcntl.h>
+unsigned int _CRT_fmode = _O_BINARY;
+#endif
+
 int internal_wanted;
 int internal_mode;
 
Index: config/mh-mingw32
===================================================================
RCS file: config/mh-mingw32
diff -N config/mh-mingw32
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ config/mh-mingw32	1 Feb 2006 21:21:31 -0000
@@ -0,0 +1,7 @@
+# We also need to override LIBGCC2_DEBUG_CFLAGS so libgcc2 will be
+# built without debugging information
+
+LIBGCC2_DEBUG_CFLAGS=
+
+# custom installation rules for mingw32 (append .exe to binaries, etc.)
+# INSTALL_DOSREL=install-dosrel
Index: gdb/configure
===================================================================
RCS file: /cvs/src/src/gdb/configure,v
retrieving revision 1.205
diff -u -r1.205 configure
--- gdb/configure	21 Jan 2006 01:29:03 -0000	1.205
+++ gdb/configure	1 Feb 2006 21:21:33 -0000
@@ -20277,7 +20277,7 @@
 #define USE_WIN32API 1
 _ACEOF
 
-    WIN32LIBS="$WIN32LIBS -lws2_32"
+    WIN32LIBS="$WIN32LIBS -lws2_32 -lkernel32 -lpsapi"
     ;;
 esac
 
@@ -20292,7 +20292,7 @@
 
 
 case "${host}" in
-*-*-cygwin*)
+*-*-cygwin* | *mingw32*)
     configdir="win"
     ;;
 *)
Index: gdb/configure.host
===================================================================
RCS file: /cvs/src/src/gdb/configure.host,v
retrieving revision 1.93
diff -u -r1.93 configure.host
--- gdb/configure.host	22 May 2005 19:11:42 -0000	1.93
+++ gdb/configure.host	1 Feb 2006 21:21:33 -0000
@@ -85,6 +85,7 @@
 i[34567]86-*-sysv*)	gdb_host=i386v ;;
 i[34567]86-*-isc*)	gdb_host=i386v ;;
 i[34567]86-*-cygwin*)	gdb_host=cygwin ;;
+i[34567]86-*-mingw32*)	gdb_host=mingw32 ;;
 
 ia64-*-linux*)		gdb_host=linux ;;
 
Index: gdb/configure.tgt
===================================================================
RCS file: /cvs/src/src/gdb/configure.tgt,v
retrieving revision 1.170
diff -u -r1.170 configure.tgt
--- gdb/configure.tgt	12 Dec 2005 11:25:05 -0000	1.170
+++ gdb/configure.tgt	1 Feb 2006 21:21:34 -0000
@@ -60,9 +60,14 @@
 arm-*-nto*)		gdb_target=nto ;;
 arm*-*-openbsd*)	gdb_target=nbsd ;;
 arm*-*-* | thumb*-*-* | strongarm*-*-*)
-			gdb_target=embed
+  case "${host}" in
+  *mingw*)	gdb_target=mingw_embed
+            ;;
+  * )  gdb_target=embed
 			build_rdi_share=yes
                         ;;
+  esac
+  ;;
 xscale-*-*)		gdb_target=embed
 			build_rdi_share=yes
                         ;;
Index: gdb/remote-rdp.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-rdp.c,v
retrieving revision 1.47
diff -u -r1.47 remote-rdp.c
--- gdb/remote-rdp.c	24 Jan 2006 22:09:28 -0000	1.47
+++ gdb/remote-rdp.c	1 Feb 2006 21:21:37 -0000
@@ -57,6 +57,10 @@
 #ifdef HAVE_TIME_H
 #include <time.h>
 #endif
+#ifdef __MINGW32__
+	#define		WIN32_LEAN_AND_MEAN
+	#include <windows.h>
+#endif
 
 extern struct target_ops remote_rdp_ops;
 static struct serial *io;
@@ -331,7 +335,11 @@
 		  printf_unfiltered ("\nThe board has sent notification that it was reset.\n");
 		  printf_unfiltered ("Waiting for it to settle down...\n");
 		}
+				#ifdef __MINGW32__
+					Sleep(3);
+				#else
 	      sleep (3);
+	      #endif
 	      if (tty)
 		printf_unfiltered ("\nTrying again.\n");
 	      cold = 0;
Index: gdb/remote-sim.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-sim.c,v
retrieving revision 1.52
diff -u -r1.52 remote-sim.c
--- gdb/remote-sim.c	24 Jan 2006 22:09:28 -0000	1.52
+++ gdb/remote-sim.c	1 Feb 2006 21:21:38 -0000
@@ -44,6 +44,10 @@
 #include "sim-regno.h"
 #include "arch-utils.h"
 
+#ifndef SIGTRAP
+#define SIGTRAP 5
+#endif
+
 /* Prototypes */
 
 extern void _initialize_remote_sim (void);
Index: gdb/win32-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/win32-nat.c,v
retrieving revision 1.119
diff -u -r1.119 win32-nat.c
--- gdb/win32-nat.c	24 Jan 2006 22:09:28 -0000	1.119
+++ gdb/win32-nat.c	1 Feb 2006 21:21:42 -0000
@@ -43,7 +43,10 @@
 #include <stdlib.h>
 #include <windows.h>
 #include <imagehlp.h>
+
+#if defined (__CYGWIN__)
 #include <sys/cygwin.h>
+#endif /* __CYGWIN__ */
 
 #include "buildsym.h"
 #include "symfile.h"
@@ -52,6 +55,9 @@
 #include "gdbthread.h"
 #include "gdbcmd.h"
 #include <sys/param.h>
+#ifdef __MINGW32__
+  #define MAXPATHLEN PATH_MAX
+#endif
 #include <unistd.h>
 #include "exec.h"
 #include "solist.h"
@@ -73,7 +79,65 @@
     CONTEXT_DEBUGGER = (CONTEXT_FULL | CONTEXT_FLOATING_POINT)
   };
 #endif
-#include <sys/procfs.h>
+#ifndef __MINGW32__
+  #include <sys/procfs.h>
+#else
+  #define	NOTE_INFO_PROCESS	1
+  #define	NOTE_INFO_THREAD	2
+  #define	NOTE_INFO_MODULE	3
+
+  struct win32_core_process_info
+  {
+    DWORD pid;
+    int signal;
+    int command_line_size;
+    char command_line[1];
+  }
+  #ifdef __GNUC__
+    __attribute__ ((packed))
+  #endif
+  ;
+
+  struct win32_core_thread_info
+  {
+    DWORD tid;
+    BOOL is_active_thread;
+    CONTEXT thread_context;
+  }
+  #ifdef __GNUC__
+    __attribute__ ((packed))
+  #endif
+  ;
+
+  struct win32_core_module_info
+  {
+    void* base_address;
+    int module_name_size;
+    char module_name[1];
+  }
+  #ifdef __GNUC__
+    __attribute__ ((packed))
+  #endif
+  ;
+
+  struct win32_pstatus
+  {
+    unsigned long data_type;
+    union
+      {
+        struct win32_core_process_info process_info;
+        struct win32_core_thread_info thread_info;
+        struct win32_core_module_info module_info;
+      } data ;
+  }
+  #ifdef __GNUC__
+    __attribute__ ((packed))
+  #endif
+  ;
+
+  typedef struct win32_pstatus win32_pstatus_t ;
+
+#endif
 #include <psapi.h>
 
 #define CONTEXT_DEBUGGER_DR CONTEXT_DEBUGGER | CONTEXT_DEBUG_REGISTERS \
@@ -727,7 +791,9 @@
   so = XZALLOC (struct so_list);
   so->lm_info = (struct lm_info *) xmalloc (sizeof (struct lm_info));
   so->lm_info->load_addr = load_addr;
+#ifdef __CYGWIN__
   cygwin_conv_to_posix_path (buf, so->so_name);
+#endif
   strcpy (so->so_original_name, so->so_name);
 
   solib_end->next = so;
@@ -1591,8 +1657,9 @@
   if (!ok)
     {
       /* Try fall back to Cygwin pid */
+#ifdef __CYGWIN__
       pid = cygwin_internal (CW_CYGWIN_PID_TO_WINPID, pid);
-
+#endif
       if (pid > 0)
 	ok = DebugActiveProcess (pid);
 
@@ -1656,13 +1723,14 @@
 static char *
 win32_pid_to_exec_file (int pid)
 {
+
+  static char path[MAX_PATH + 1];
+  char *path_ptr = NULL;
+#ifdef __CYGWIN__
   /* Try to find the process path using the Cygwin internal process list
      pid isn't a valid pid, unfortunately.  Use current_event.dwProcessId
      instead.  */
   /* TODO: Also find native Windows processes using CW_GETPINFO_FULL.  */
-
-  static char path[MAX_PATH + 1];
-  char *path_ptr = NULL;
   int cpid;
   struct external_pinfo *pinfo;
 
@@ -1680,6 +1748,13 @@
        }
     }
   cygwin_internal (CW_UNLOCK_PINFO);
+#else
+  if (!GetModuleFileNameEx (current_process_handle, NULL, path, MAX_PATH))
+    printf_unfiltered ("error reading the process's file name: %lu",
+                       GetLastError ());
+  else
+    path_ptr = path;
+#endif
   return path_ptr;
 }
 
@@ -1729,8 +1804,18 @@
   char *toexec;
   char shell[MAX_PATH + 1]; /* Path to shell */
   const char *sh;
+
+#if defined (__MINGW32__)
+  /* BEGIN: Fragment of Al Stevens's patch for GDB on Win9x */
+  HANDLE hStdInput = 0;
+  HANDLE hStdOutput = 0;
+  HANDLE hStdError = 0;
+  /* END: Fragment of Al Stevens's patch for GDB on Win9x */
+#else /* !__MINGW32__ */
   int tty;
   int ostdin, ostdout, ostderr;
+#endif /* !__MINGW32__ */
+
   const char *inferior_io_terminal = get_inferior_io_terminal ();
 
   if (!exec_file)
@@ -1742,7 +1827,11 @@
   if (!useshell)
     {
       flags = DEBUG_ONLY_THIS_PROCESS;
+#ifdef __CYGWIN__
       cygwin_conv_to_win32_path (exec_file, real_path);
+#else
+      strcpy (real_path, exec_file);
+#endif
       toexec = real_path;
     }
   else
@@ -1751,7 +1840,11 @@
       sh = getenv ("SHELL");
       if (!sh)
 	sh = "/bin/sh";
+#ifdef __CYGWIN__
       cygwin_conv_to_win32_path (sh, shell);
+#else
+      strcpy (shell, sh);
+#endif
       newallargs = alloca (sizeof (" -c 'exec  '") + strlen (exec_file)
 			   + strlen (allargs) + 2);
       sprintf (newallargs, " -c 'exec %s %s'", exec_file, allargs);
@@ -1802,10 +1895,12 @@
 	    len = strlen (conv_path_names[j]);
 	    if (strncmp (conv_path_names[j], in_env[i], len) == 0)
 	      {
+#ifdef __CYGWIN__
 		if (cygwin_posix_path_list_p (in_env[i] + len))
 		  envlen += len
 		    + cygwin_posix_to_win32_path_list_buf_size (in_env[i] + len);
 		else
+#endif
 		  envlen += strlen (in_env[i]) + 1;
 		break;
 	      }
@@ -1832,12 +1927,14 @@
 	    len = strlen (conv_path_names[j]);
 	    if (strncmp (conv_path_names[j], env[i], len) == 0)
 	      {
+#ifdef __CYGWIN__
 		if (cygwin_posix_path_list_p (env[i] + len))
 		  {
 		    memcpy (temp, env[i], len);
 		    cygwin_posix_to_win32_path_list (env[i] + len, temp + len);
 		  }
 		else
+#endif
 		  strcpy (temp, env[i]);
 		break;
 	      }
@@ -1851,6 +1948,20 @@
     /* Final nil string to terminate new env.  */
     *temp = 0;
   }
+#if defined (__MINGW32__)
+  /* BEGIN: Fragment of Al Stevens's patch for GDB on Win9x */
+  if ( new_console)
+    {
+      hStdInput = GetStdHandle( STD_INPUT_HANDLE);
+      hStdOutput = GetStdHandle( STD_OUTPUT_HANDLE);
+      hStdError = GetStdHandle( STD_ERROR_HANDLE);
+
+      SetStdHandle( STD_INPUT_HANDLE, INVALID_HANDLE_VALUE);
+      SetStdHandle( STD_OUTPUT_HANDLE, INVALID_HANDLE_VALUE);
+      SetStdHandle( STD_ERROR_HANDLE, INVALID_HANDLE_VALUE);
+    }
+  /* END: Fragment of Al Stevens's patch for GDB on Win9x */
+#else /* !__MINGW32__ */
 
   if (!inferior_io_terminal)
     tty = ostdin = ostdout = ostderr = -1;
@@ -1872,6 +1983,7 @@
 	  dup2 (tty, 2);
 	}
     }
+#endif /* !__MINGW32__ */
 
   win32_init_thread_list ();
   ret = CreateProcess (0,
@@ -1884,6 +1996,16 @@
 		       NULL,	/* current directory */
 		       &si,
 		       &pi);
+#if defined (__MINGW32__)
+  /* BEGIN: Fragment of Al Stevens's patch for GDB on Win9x */
+  if ( new_console)
+    {
+      SetStdHandle( STD_INPUT_HANDLE, hStdInput);
+      SetStdHandle( STD_OUTPUT_HANDLE, hStdOutput);
+      SetStdHandle( STD_ERROR_HANDLE, hStdError);
+    }
+  /* END: Fragment of Al Stevens's patch for GDB on Win9x */
+#else /* !__MINGW32__ */
   if (tty >= 0)
     {
       close (tty);
@@ -1894,6 +2016,7 @@
       close (ostdout);
       close (ostderr);
     }
+#endif /* !__MINGW32__ */
 
   if (!ret)
     error (_("Error creating process %s, (error %d)."),
Index: gdb/config/arm/mingw_embed.mt
===================================================================
RCS file: gdb/config/arm/mingw_embed.mt
diff -N gdb/config/arm/mingw_embed.mt
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gdb/config/arm/mingw_embed.mt	1 Feb 2006 21:21:42 -0000
@@ -0,0 +1,7 @@
+# Target: ARM embedded system
+TDEPFILES= arm-tdep.o remote-rdp.o
+TDEPLIBS=
+DEPRECATED_TM_FILE= tm-embed.h
+
+SIM_OBS = remote-sim.o
+SIM = ../sim/arm/libsim.a
Index: gdb/config/i386/mingw32.mh
===================================================================
RCS file: gdb/config/i386/mingw32.mh
diff -N gdb/config/i386/mingw32.mh
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gdb/config/i386/mingw32.mh	1 Feb 2006 21:21:44 -0000
@@ -0,0 +1,5 @@
+MH_CFLAGS=-D_POSIX_
+XM_FILE=xm-mingw32.h
+NATDEPFILES= i386-nat.o win32-nat.o corelow.o
+NAT_FILE=nm-mingw32.h
+XM_CLIBS=
Index: gdb/config/i386/mingw32.mt
===================================================================
RCS file: gdb/config/i386/mingw32.mt
diff -N gdb/config/i386/mingw32.mt
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gdb/config/i386/mingw32.mt	1 Feb 2006 21:21:44 -0000
@@ -0,0 +1,4 @@
+# Target: Intel x86 running Win32 (MinGW)
+TDEPFILES= i386-tdep.o i386-win32-tdep.o i387-tdep.o
+DEPRECATED_TM_FILE= tm-mingw32.h
+GDBSERVER_DEPFILES=
Index: gdb/config/i386/nm-mingw32.h
===================================================================
RCS file: gdb/config/i386/nm-mingw32.h
diff -N gdb/config/i386/nm-mingw32.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gdb/config/i386/nm-mingw32.h	1 Feb 2006 21:21:44 -0000
@@ -0,0 +1,38 @@
+/* Native definitions for Intel x86 running MinGW.
+   Copyright (C) 2002 Free Software Foundation, Inc.
+
+   This file is part of GDB.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#define NO_PTRACE_H
+
+#define I386_USE_GENERIC_WATCHPOINTS
+
+#include "i386/nm-i386.h"
+
+/* Support for hardware-assisted breakpoints and watchpoints.  */
+
+#define I386_DR_LOW_SET_CONTROL(VAL)	cygwin_set_dr7 (VAL)
+extern void cygwin_set_dr7 (unsigned);
+
+#define I386_DR_LOW_SET_ADDR(N,ADDR)	cygwin_set_dr (N,ADDR)
+extern void cygwin_set_dr (int, CORE_ADDR);
+
+#define I386_DR_LOW_RESET_ADDR(N)
+
+#define I386_DR_LOW_GET_STATUS()	cygwin_get_dr6 ()
+extern unsigned cygwin_get_dr6 (void);
Index: gdb/config/i386/tm-mingw32.h
===================================================================
RCS file: gdb/config/i386/tm-mingw32.h
diff -N gdb/config/i386/tm-mingw32.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gdb/config/i386/tm-mingw32.h	1 Feb 2006 21:21:44 -0000
@@ -0,0 +1,21 @@
+/* Macro definitions for i386 running under Win32.
+   Copyright 1999 Free Software Foundation, Inc.
+
+   This file is part of GDB.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#include "i386/tm-cygwin.h"
+
Index: gdb/config/i386/xm-mingw32.h
===================================================================
RCS file: gdb/config/i386/xm-mingw32.h
diff -N gdb/config/i386/xm-mingw32.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gdb/config/i386/xm-mingw32.h	1 Feb 2006 21:21:44 -0000
@@ -0,0 +1,25 @@
+/* Definitions for hosting on WIN32, building with MinGW, for GDB.
+   Copyright 1999 Free Software Foundation, Inc.
+
+This file is part of GDB.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#include "fopen-bin.h"
+#define getkey getch
+#define DIRNAME_SEPARATOR ';'
+
+/* Define this if source files use \r\n rather than just \n.  */
+#define CRLF_SOURCE_FILES
Index: gdb/gdbtk/generic/gdbtk-cmds.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk-cmds.c,v
retrieving revision 1.91
diff -u -r1.91 gdbtk-cmds.c
--- gdb/gdbtk/generic/gdbtk-cmds.c	23 Dec 2005 18:23:15 -0000	1.91
+++ gdb/gdbtk/generic/gdbtk-cmds.c	1 Feb 2006 21:21:49 -0000
@@ -56,7 +56,9 @@
 
 #include <signal.h>
 #include <fcntl.h>
+#ifndef __MINGW32__
 #include <sys/ioctl.h>
+#endif
 #include <sys/time.h>
 #include <sys/stat.h>
 
Index: gdb/gdbtk/generic/gdbtk-hooks.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk-hooks.c,v
retrieving revision 1.41
diff -u -r1.41 gdbtk-hooks.c
--- gdb/gdbtk/generic/gdbtk-hooks.c	23 Dec 2005 18:23:16 -0000	1.41
+++ gdb/gdbtk/generic/gdbtk-hooks.c	1 Feb 2006 21:21:49 -0000
@@ -51,7 +51,9 @@
 
 #include <signal.h>
 #include <fcntl.h>
+#ifndef __MINGW32__
 #include <sys/ioctl.h>
+#endif
 #include <sys/time.h>
 
 #include "gdb_string.h"
Index: gdb/gdbtk/generic/gdbtk-interp.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk-interp.c,v
retrieving revision 1.8
diff -u -r1.8 gdbtk-interp.c
--- gdb/gdbtk/generic/gdbtk-interp.c	23 Dec 2005 18:23:16 -0000	1.8
+++ gdb/gdbtk/generic/gdbtk-interp.c	1 Feb 2006 21:21:49 -0000
@@ -34,6 +34,11 @@
 #include "tk.h"
 #include "gdbtk.h"
 
+#ifdef _WIN32
+	#define		WIN32_LEAN_AND_MEAN
+	#include <windows.h>
+#endif
+
 static void gdbtk_command_loop (void);
 static void hack_disable_interpreter_exec (char *, int);
 
Index: gdb/gdbtk/generic/gdbtk.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk.c,v
retrieving revision 1.44
diff -u -r1.44 gdbtk.c
--- gdb/gdbtk/generic/gdbtk.c	23 Dec 2005 18:23:16 -0000	1.44
+++ gdb/gdbtk/generic/gdbtk.c	1 Feb 2006 21:21:49 -0000
@@ -49,7 +49,9 @@
 
 #include <fcntl.h>
 #include <sys/stat.h>
+#ifndef __MINGW32__
 #include <sys/ioctl.h>
+#endif
 #include <sys/time.h>
 #include <signal.h>
 
@@ -65,9 +67,11 @@
 
 /* For unix natives, we use a timer to periodically keep the gui alive.
    See comments before x_event. */
+#ifndef __MINGW32__
 static sigset_t nullsigmask;
 static struct sigaction act1, act2;
 static struct itimerval it_on, it_off;
+#endif
 
 static void
 x_event_wrapper (int signo)
@@ -261,6 +265,7 @@
   if (first)
     {
       /* first time called, set up all the structs */
+#ifndef __MINGW32__
       first = 0;
       sigemptyset (&nullsigmask);
 
@@ -281,14 +286,17 @@
       it_off.it_interval.tv_usec = 0;
       it_off.it_value.tv_sec = 0;
       it_off.it_value.tv_usec = 0;
+#endif
     }
 
   if (target_should_use_timer (&current_target))
     {
       if (!gdbtk_timer_going)
 	{
+#ifndef __MINGW32__
 	  sigaction (SIGALRM, &act1, NULL);
 	  setitimer (ITIMER_REAL, &it_on, NULL);
+#endif
 	  gdbtk_timer_going = 1;
 	}
     }
@@ -302,8 +310,10 @@
   if (gdbtk_timer_going)
     {
       gdbtk_timer_going = 0;
+#ifndef __MINGW32__
       setitimer (ITIMER_REAL, &it_off, NULL);
       sigaction (SIGALRM, &act2, NULL);
+#endif
     }
   return;
 }
@@ -521,7 +531,7 @@
    * These are the commands to do some Windows Specific stuff...
    */
 
-#ifdef __CYGWIN32__
+#ifdef __WIN32 
   if (ide_create_messagebox_command (gdbtk_interp) != TCL_OK)
     error ("messagebox command initialization failed");
   /* On Windows, create a sizebox widget command */
@@ -534,12 +544,13 @@
   if (ide_create_win_grab_command (gdbtk_interp) != TCL_OK)
     error ("grab support command initialization failed");
   /* Path conversion functions.  */
+#ifdef __CYGWIN__
   if (ide_create_cygwin_path_command (gdbtk_interp) != TCL_OK)
     error ("cygwin path command initialization failed");
   if (ide_create_shell_execute_command (gdbtk_interp) != TCL_OK)
     error ("cygwin shell execute command initialization failed");
 #endif
-
+#endif
   /* Only for testing -- and only when it can't be done any
      other way. */
   if (cyg_create_warp_pointer_command (gdbtk_interp) != TCL_OK)
Index: gdb/gdbtk/library/download.itb
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/download.itb,v
retrieving revision 1.11
diff -u -r1.11 download.itb
--- gdb/gdbtk/library/download.itb	23 Dec 2005 18:26:50 -0000	1.11
+++ gdb/gdbtk/library/download.itb	1 Feb 2006 21:21:49 -0000
@@ -207,7 +207,7 @@
     }
   }
 
-  if {[string compare $tcl_platform(platform) "windows"] == 0} {
+  if {[string compare $tcl_platform(platform) "windows"] == 0 && [llength [info commands ide_cygwin_path]]} {
     set f [ide_cygwin_path to_win32 $gdb_exe_name]
   } else {
     set f $gdb_exe_name
Index: gdb/gdbtk/library/interface.tcl
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/interface.tcl,v
retrieving revision 1.57
diff -u -r1.57 interface.tcl
--- gdb/gdbtk/library/interface.tcl	23 Dec 2005 18:26:50 -0000	1.57
+++ gdb/gdbtk/library/interface.tcl	1 Feb 2006 21:21:49 -0000
@@ -962,7 +962,7 @@
   }
   # Add the base dir for this file to the source search path.
   set root [file dirname $file]
-  if {$tcl_platform(platform) == "windows"} {
+  if {$tcl_platform(platform) == "windows" && [llength [info commands ide_cygwin_path]]} {
     set root [ide_cygwin_path to_posix $root]
     set file [ide_cygwin_path to_posix $file]
   }
Index: gdb/gdbtk/library/prefs.tcl
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/prefs.tcl,v
retrieving revision 1.32
diff -u -r1.32 prefs.tcl
--- gdb/gdbtk/library/prefs.tcl	23 Dec 2005 18:26:50 -0000	1.32
+++ gdb/gdbtk/library/prefs.tcl	1 Feb 2006 21:21:50 -0000
@@ -35,7 +35,7 @@
   global tcl_platform
 
   if {[info exists env(HOME)]} {
-    if {$tcl_platform(platform) == "windows"} {
+    if {$tcl_platform(platform) == "windows" && [llength [info commands ide_cygwin_path]]} {
       set home [ide_cygwin_path to_win32 $env(HOME)]
     } else {
       set home $env(HOME)
Index: gdb/gdbtk/library/session.tcl
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/session.tcl,v
retrieving revision 1.16
diff -u -r1.16 session.tcl
--- gdb/gdbtk/library/session.tcl	23 Dec 2005 18:26:50 -0000	1.16
+++ gdb/gdbtk/library/session.tcl	1 Feb 2006 21:21:50 -0000
@@ -21,7 +21,7 @@
     global tcl_platform
 
     # Get real directory.
-    if {[string compare $tcl_platform(platform) "windows"] == 0} {
+    if {[string compare $tcl_platform(platform) "windows"] == 0 && [llength [info commands ide_cygwin_path]]} {
       set path [ide_cygwin_path to_win32 $path]
     }
     set save [pwd]
Index: gdb/gdbtk/library/srctextwin.itb
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/srctextwin.itb,v
retrieving revision 1.42
diff -u -r1.42 srctextwin.itb
--- gdb/gdbtk/library/srctextwin.itb	23 Dec 2005 18:26:50 -0000	1.42
+++ gdb/gdbtk/library/srctextwin.itb	1 Feb 2006 21:21:51 -0000
@@ -891,7 +891,7 @@
   } elseif {$f == ""} {
     set r 1
   } else {
-    if {[string compare $tcl_platform(platform) "windows"] == 0} {
+    if {[string compare $tcl_platform(platform) "windows"] == 0 && [llength [info commands ide_cygwin_path]]} {
       set f [ide_cygwin_path to_win32 $f]
     }
     if {[catch {file mtime $f} mtime]} {
@@ -2715,7 +2715,7 @@
     # out.
 
     if {$loadingSource} {
-      if {[string compare $tcl_platform(platform) "windows"] == 0} {
+      if {[string compare $tcl_platform(platform) "windows"] == 0 && [llength [info commands ide_cygwin_path]]} {
         set f [ide_cygwin_path to_win32 $name]
       } else {
         set f $name
Index: tcl/win/tclWin32Dll.c
===================================================================
RCS file: /cvs/src/src/tcl/win/tclWin32Dll.c,v
retrieving revision 1.9
diff -u -r1.9 tclWin32Dll.c
--- tcl/win/tclWin32Dll.c	21 Jan 2003 19:40:22 -0000	1.9
+++ tcl/win/tclWin32Dll.c	1 Feb 2006 21:23:29 -0000
@@ -12,6 +12,10 @@
  * RCS: @(#) $Id: tclWin32Dll.c,v 1.16 2002/06/13 09:40:01 vincentdarley Exp $
  */
 
+/* The following is a workaround for a w32api problem.
+   See http://sources.redhat.com/ml/insight/2004-q4/msg00039.html */
+#define __INSIDE_CYGWIN__
+
 #include "tclWinInt.h"
 
 /*
@@ -38,6 +42,23 @@
 static int platformId;		/* Running under NT, or 95/98? */
 
 #ifdef HAVE_NO_SEH
+/*
+ * Unlike Borland and Microsoft, we don't register exception handlers by
+ * pushing registration records onto the runtime stack. Instead, we register
+ * them by creating an EXCEPTION_REGISTRATION within the activation record.
+ */
+
+typedef struct EXCEPTION_REGISTRATION {
+    struct EXCEPTION_REGISTRATION *link;
+    EXCEPTION_DISPOSITION (*handler)(
+	    struct _EXCEPTION_RECORD*, void*, struct _CONTEXT*, void*);
+    void *ebp;
+    void *esp;
+    int status;
+} EXCEPTION_REGISTRATION;
+#endif
+
+#ifdef HAVE_NO_SEH
 static void *ESP;
 static void *EBP;
 #endif /* HAVE_NO_SEH */
@@ -347,65 +368,111 @@
 int
 TclpCheckStackSpace()
 {
+
+#ifdef HAVE_NO_SEH
+    EXCEPTION_REGISTRATION registration;
+#endif
     int retval = 0;
 
     /*
-     * We can recurse only if there is at least TCL_WIN_STACK_THRESHOLD
-     * bytes of stack space left.  alloca() is cheap on windows; basically
-     * it just subtracts from the stack pointer causing the OS to throw an
-     * exception if the stack pointer is set below the bottom of the stack.
+     * We can recurse only if there is at least TCL_WIN_STACK_THRESHOLD bytes
+     * of stack space left. alloca() is cheap on windows; basically it just
+     * subtracts from the stack pointer causing the OS to throw an exception
+     * if the stack pointer is set below the bottom of the stack.
      */
 
 #ifdef HAVE_NO_SEH
     __asm__ __volatile__ (
-            "movl  %esp, _ESP" "\n\t"
-            "movl  %ebp, _EBP");
 
-    __asm__ __volatile__ (
-            "pushl $__except_checkstackspace_handler" "\n\t"
-            "pushl %fs:0" "\n\t"
-            "mov   %esp, %fs:0");
-#else
+	/*
+	 * Construct an EXCEPTION_REGISTRATION to protect the call to __alloca
+	 */
+
+	"leal	%[registration], %%edx"		"\n\t"
+	"movl	%%fs:0,		%%eax"		"\n\t"
+	"movl	%%eax,		0x0(%%edx)"	"\n\t" /* link */
+	"leal	1f,		%%eax"		"\n\t"
+	"movl	%%eax,		0x4(%%edx)"	"\n\t" /* handler */
+	"movl	%%ebp,		0x8(%%edx)"	"\n\t" /* ebp */
+	"movl	%%esp,		0xc(%%edx)"	"\n\t" /* esp */
+	"movl	%[error],	0x10(%%edx)"	"\n\t" /* status */
+	
+	/*
+	 * Link the EXCEPTION_REGISTRATION on the chain
+	 */
+
+	"movl	%%edx,		%%fs:0"		"\n\t"
+
+	/*
+	 * Attempt a call to __alloca, to determine whether there's sufficient
+	 * memory to be had.
+	 */
+
+	"movl	%[size],	%%eax"		"\n\t"
+	"pushl	%%eax"				"\n\t"
+	"call	__alloca"			"\n\t"
+
+	/*
+	 * Come here on a normal exit. Recover the EXCEPTION_REGISTRATION and
+	 * store a TCL_OK status
+	 */
+
+	"movl	%%fs:0,		%%edx"		"\n\t"
+	"movl	%[ok],		%%eax"		"\n\t"
+	"movl	%%eax,		0x10(%%edx)"	"\n\t"
+	"jmp	2f"				"\n"
+
+	/*
+	 * Come here on an exception. Get the EXCEPTION_REGISTRATION that we
+	 * previously put on the chain.
+	 */
+
+	"1:"					"\t"
+	"movl	%%fs:0,		%%edx"		"\n\t"
+	"movl	0x8(%%edx),	%%edx"		"\n\t"
+	
+	/* 
+	 * Come here however we exited. Restore context from the
+	 * EXCEPTION_REGISTRATION in case the stack is unbalanced.
+	 */
+	
+	"2:"					"\t"
+	"movl	0xc(%%edx),	%%esp"		"\n\t"
+	"movl	0x8(%%edx),	%%ebp"		"\n\t"
+	"movl	0x0(%%edx),	%%eax"		"\n\t"
+	"movl	%%eax,		%%fs:0"		"\n\t"
+	
+	:
+	/* No outputs */
+	:
+	[registration]	"m"	(registration),
+	[ok]		"i"	(TCL_OK),
+	[error]		"i"	(TCL_ERROR),
+	[size]		"i"	(TCL_WIN_STACK_THRESHOLD)
+	:
+	"%eax", "%ebx", "%ecx", "%edx", "%esi", "%edi", "memory"
+	);
+    retval = (registration.status == TCL_OK);
+
+#else /* !HAVE_NO_SEH */
     __try {
-#endif /* HAVE_NO_SEH */
+#ifdef HAVE_ALLOCA_GCC_INLINE
+	__asm__ __volatile__ (
+	    "movl  %0, %%eax" "\n\t"
+	    "call  __alloca" "\n\t"
+	    :
+	    : "i"(TCL_WIN_STACK_THRESHOLD)
+	    : "%eax");
+#else
 	alloca(TCL_WIN_STACK_THRESHOLD);
+#endif /* HAVE_ALLOCA_GCC_INLINE */
 	retval = 1;
-#ifdef HAVE_NO_SEH
-    __asm__ __volatile__ (
-            "jmp   checkstackspace_pop" "\n"
-            "checkstackspace_reentry:" "\n\t"
-            "movl  _ESP, %esp" "\n\t"
-            "movl  _EBP, %ebp");
-
-    __asm__ __volatile__ (
-            "checkstackspace_pop:" "\n\t"
-            "mov   (%esp), %eax" "\n\t"
-            "mov   %eax, %fs:0" "\n\t"
-            "add   $8, %esp");
-#else
     } __except (EXCEPTION_EXECUTE_HANDLER) {}
 #endif /* HAVE_NO_SEH */
-
-    /*
-     * Avoid using control flow statements in the SEH guarded block!
-     */
+    
     return retval;
 }
-#ifdef HAVE_NO_SEH
-static
-__attribute__ ((cdecl))
-EXCEPTION_DISPOSITION
-_except_checkstackspace_handler(
-    struct _EXCEPTION_RECORD *ExceptionRecord,
-    void *EstablisherFrame,
-    struct _CONTEXT *ContextRecord,
-    void *DispatcherContext)
-{
-    __asm__ __volatile__ (
-            "jmp checkstackspace_reentry");
-    return 0; /* Function does not return */
-}
-#endif /* HAVE_NO_SEH */
+
 
 /*
  *----------------------------------------------------------------------
Index: tcl/win/tclWinChan.c
===================================================================
RCS file: /cvs/src/src/tcl/win/tclWinChan.c,v
retrieving revision 1.5
diff -u -r1.5 tclWinChan.c
--- tcl/win/tclWinChan.c	21 Jan 2003 19:40:22 -0000	1.5
+++ tcl/win/tclWinChan.c	1 Feb 2006 21:23:29 -0000
@@ -122,8 +122,8 @@
 };
 
 #ifdef HAVE_NO_SEH
-static void *ESP;
-static void *EBP;
+static void *ESP __attribute__ ((used));
+static void *EBP __attribute__ ((used));
 #endif /* HAVE_NO_SEH */
 
 
@@ -1106,7 +1106,7 @@
 }
 #ifdef HAVE_NO_SEH
 static
-__attribute__ ((cdecl))
+__attribute__ ((cdecl)) __attribute__ ((used))
 EXCEPTION_DISPOSITION
 _except_makefilechannel_handler(
     struct _EXCEPTION_RECORD *ExceptionRecord,
Index: tcl/win/tclWinFCmd.c
===================================================================
RCS file: /cvs/src/src/tcl/win/tclWinFCmd.c,v
retrieving revision 1.6
diff -u -r1.6 tclWinFCmd.c
--- tcl/win/tclWinFCmd.c	7 Feb 2003 19:52:00 -0000	1.6
+++ tcl/win/tclWinFCmd.c	1 Feb 2006 21:23:31 -0000
@@ -469,7 +469,7 @@
 }
 #ifdef HAVE_NO_SEH
 static
-__attribute__ ((cdecl))
+__attribute__ ((cdecl)) __attribute__ ((used))
 EXCEPTION_DISPOSITION
 _except_dorenamefile_handler(
     struct _EXCEPTION_RECORD *ExceptionRecord,
@@ -651,7 +651,7 @@
 }
 #ifdef HAVE_NO_SEH
 static
-__attribute__ ((cdecl))
+__attribute__ ((cdecl)) __attribute__ ((used))
 EXCEPTION_DISPOSITION
 _except_docopyfile_handler(
     struct _EXCEPTION_RECORD *ExceptionRecord,
diff -ur gdb/config/i386/nm-mingw32.h.orig gdb/config/i386/nm-mingw32.h
--- gdb/config/i386/nm-mingw32.h.orig	2006-02-01 16:32:38.946857800 -0500
+++ gdb/config/i386/nm-mingw32.h	2006-01-30 19:07:13.671875000 -0500
@@ -36,3 +36,6 @@
 
 #define I386_DR_LOW_GET_STATUS()	cygwin_get_dr6 ()
 extern unsigned cygwin_get_dr6 (void);
+
+#define IN_SOLIB_DYNSYM_RESOLVE_CODE(PC) (0)
+
diff -ur gdb/win32-nat.c.orig gdb/win32-nat.c
--- gdb/win32-nat.c.orig	2006-02-01 16:34:32.632902600 -0500
+++ gdb/win32-nat.c	2006-01-30 19:15:59.931278800 -0500
@@ -793,6 +793,8 @@
   so->lm_info->load_addr = load_addr;
 #ifdef __CYGWIN__
   cygwin_conv_to_posix_path (buf, so->so_name);
+#else
+  strcpy (so->so_name, buf);
 #endif
   strcpy (so->so_original_name, so->so_name);
 
Index: gdb/solib.c
===================================================================
RCS file: /cvs/src/src/gdb/solib.c,v
retrieving revision 1.83
diff -u -r1.83 solib.c
--- gdb/solib.c	21 Jan 2006 22:23:27 -0000	1.83
+++ gdb/solib.c	1 Feb 2006 21:27:52 -0000
@@ -47,6 +47,10 @@
 #include "observer.h"
 #include "readline/readline.h"
 
+#ifndef O_BINARY
+# define O_BINARY 0
+#endif
+
 /* Architecture-specific operations.  */
 
 /* Per-architecture data key.  */
@@ -171,7 +175,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 +196,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 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]