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 +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 #endif +#ifdef __MINGW32__ + #define WIN32_LEAN_AND_MEAN + #include +#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 #include #include + +#if defined (__CYGWIN__) #include +#endif /* __CYGWIN__ */ #include "buildsym.h" #include "symfile.h" @@ -52,6 +55,9 @@ #include "gdbthread.h" #include "gdbcmd.h" #include +#ifdef __MINGW32__ + #define MAXPATHLEN PATH_MAX +#endif #include #include "exec.h" #include "solist.h" @@ -73,7 +79,65 @@ CONTEXT_DEBUGGER = (CONTEXT_FULL | CONTEXT_FLOATING_POINT) }; #endif -#include +#ifndef __MINGW32__ + #include +#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 #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 #include +#ifndef __MINGW32__ #include +#endif #include #include 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 #include +#ifndef __MINGW32__ #include +#endif #include #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 +#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 #include +#ifndef __MINGW32__ #include +#endif #include #include @@ -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 (¤t_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,