gdb/
authorPedro Alves <palves@redhat.com>
Thu, 29 Mar 2007 01:06:48 +0000 (01:06 +0000)
committerPedro Alves <palves@redhat.com>
Thu, 29 Mar 2007 01:06:48 +0000 (01:06 +0000)
* arm-wince-tdep.c: New.
* config/arm/wince.mt (DEPRECATED_TM_FILE): Use tm-arm.h.
(MT_CFLAGS): Delete.
(TM_CLIBS): Delete.
(TDEPFILES): Add arm-wince-tdep.o, corelow.o, solib.o,
solib-legacy.o, solib-svr4.o, and remove wince.o.
* configure.tgt (arm*-*-mingw32ce*): Add.
* signals/signals.c [HAVE_SIGNAL_H]: Check.
(do_target_signal_to_host): Silence 'not used' warning.
* config/arm/tm-wince.h: Remove.

gdb/gdbserver/

* gdbserver/configure.ac: Add errno checking.
(AC_CHECK_HEADERS): Add errno.h, fcntl.h, signal.h,
sys/file.h and malloc.h.
(AC_CHECK_DECLS): Add perror.
(srv_mingwce): Handle.
* gdbserver/configure.srv (i[34567]86-*-cygwin*): Add
win32-i386-low.o to srv_tgtobj.
(i[34567]86-*-mingw*): Likewise.
(arm*-*-mingw32ce*): Add case.
* gdbreplay.c [HAVE_SYS_FILE_H, HAVE_SIGNAL_H,
HAVE_FCNTL_H, HAVE_ERRNO_H, HAVE_MALLOC_H]: Check.
[__MINGW32CE__] (strerror): New function.
[__MINGW32CE__] (errno): Define to GetLastError.
[__MINGW32CE__] (COUNTOF): New macro.
(remote_open): Remove extra close call.
* mem-break.c (delete_breakpoint_at): New function.
* mem-break.h (delete_breakpoint_at): Declare.
* remote-utils.c [HAVE_SYS_FILE_H, HAVE_SIGNAL_H,
HAVE_FCNTL_H, HAVE_UNISTD_H, HAVE_ERRNO_H]: Check.
[USE_WIN32API] (read, write): Add char* casts.
* server.c [HAVE_UNISTD_H, HAVE_SIGNAL_H]: Check.
* server.h: Include wincecompat.h on Windows CE.
[HAVE_ERRNO_H]: Check.
(perror): Declare if not declared.
* utils.c: Add stdlib.h, errno.h and malloc.h includes.
(perror_with_name): Remove errno declaration.
* wincecompat.h: New.
* wincecompat.c: New.
* win32-low.h: New.
* win32-arm-low.c: New.
* win32-i386-low.c: New.
(win32-low.c): Include mem-break.h and win32-low.h, and winnt.h.
(OUTMSG2): Make it safe.
(_T): New macro.
(COUNTOF): New macro.
(NUM_REGS): Get it from the low target.
(CONTEXT_EXTENDED_REGISTERS, CONTEXT_FLOATING_POINT,
CONTEXT_DEBUG_REGISTERS): Add fallbacks to 0.
(thread_rec): Let low target handle debug registers.
(child_add_thread): Likewise.
(child_init_thread_list): Likewise.
(continue_one_thread): Likewise.
(regptr): New.
(do_child_fetch_inferior_registers): Move to ...
* win32-i386-low.c: ... here, and rename to ...
(do_fetch_inferior_registers): ... this.
* win32-low.c (child_fetch_inferior_registers):
Go through the low target.
(do_child_store_inferior_registers): Use regptr.
(strwinerror): New function.
(win32_create_inferior): Handle Windows CE.
Use strwinerror instead of strerror on Windows error
codes.  Add program to the error output.
Don't close the main thread handle on Windows CE.
(win32_attach): Use coredll.dll on Windows CE.
(win32_kill): Close current process and current
thread handles.
(win32_detach): Use coredll.dll on Windows CE.
(win32_resume): Let low target handle debug registers, and
step request.
(handle_exception): Add/Remove initial breakpoint.  Avoid
non-existant WSTOPSIG on Windows CE.
(win32_read_inferior_memory): Cast to remove warning.
(win32_arch_string): Go through the low target.
(initialize_low): Call set_breakpoint_data with the low
target's breakpoint.
* win32-low.c (dr, FLAG_TRACE_BIT, FCS_REGNUM,
FOP_REGNUM, mappings): Move to ...
* win32-i386-low.c: ... here.
* win32-low.c (win32_thread_info): Move to ...
* win32-low.h: ... here.
* Makefile.in (SFILES): Add win32-low.c, win32-i386-low.c,
win32-arm-low.c and wincecompat.c.
(all:): Add $EXEEXT.
(install-only:): Likewise.
(gdbserver:): Likewise.
(gdbreplay:): Likewise.
* config.in: Regenerate.
* configure: Regenerate.

24 files changed:
gdb/ChangeLog
gdb/arm-wince-tdep.c [new file with mode: 0644]
gdb/config/arm/tm-wince.h [deleted file]
gdb/config/arm/wince.mt
gdb/configure.tgt
gdb/gdbserver/ChangeLog
gdb/gdbserver/Makefile.in
gdb/gdbserver/config.in
gdb/gdbserver/configure
gdb/gdbserver/configure.ac
gdb/gdbserver/configure.srv
gdb/gdbserver/gdbreplay.c
gdb/gdbserver/mem-break.c
gdb/gdbserver/mem-break.h
gdb/gdbserver/remote-utils.c
gdb/gdbserver/server.c
gdb/gdbserver/server.h
gdb/gdbserver/utils.c
gdb/gdbserver/win32-arm-low.c [new file with mode: 0644]
gdb/gdbserver/win32-i386-low.c [new file with mode: 0644]
gdb/gdbserver/win32-low.h [new file with mode: 0644]
gdb/gdbserver/wincecompat.c [new file with mode: 0644]
gdb/gdbserver/wincecompat.h [new file with mode: 0644]
gdb/signals/signals.c

index 7e0a0f176d8c0303994abc1704150de3d269e43d..14fb171c104afc8ac60fc044e3e7405a1ad25f23 100644 (file)
@@ -1,3 +1,16 @@
+2007-03-29  Pedro Alves  <pedro_alves@portugalmail.pt>
+
+       * arm-wince-tdep.c: New.
+       * config/arm/wince.mt (DEPRECATED_TM_FILE): Use tm-arm.h.
+       (MT_CFLAGS): Delete.
+       (TM_CLIBS): Delete.
+       (TDEPFILES): Add arm-wince-tdep.o, corelow.o, solib.o,
+       solib-legacy.o, solib-svr4.o, and remove wince.o.
+       * configure.tgt (arm*-*-mingw32ce*): Add.
+       * signals/signals.c [HAVE_SIGNAL_H]: Check.
+       (do_target_signal_to_host): Silence 'not used' warning.
+       * config/arm/tm-wince.h: Remove.
+
 2007-03-28  Ulrich Weigand  <uweigand@de.ibm.com>
 
        * arch-utils.c (legacy_pc_in_sigtramp): Remove.
diff --git a/gdb/arm-wince-tdep.c b/gdb/arm-wince-tdep.c
new file mode 100644 (file)
index 0000000..bfebef1
--- /dev/null
@@ -0,0 +1,84 @@
+/* Target-dependent code for Windows CE running on ARM processors,
+   for GDB.
+
+   Copyright (C) 2007 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., 51 Franklin Street, Fifth Floor,
+   Boston, MA 02110-1301, USA.  */
+
+#include "defs.h"
+#include "osabi.h"
+#include "solib-svr4.h"
+#include "target.h"
+
+#include "gdb_string.h"
+
+#include "arm-tdep.h"
+
+static const char arm_wince_le_breakpoint[] = { 0x10, 0x00, 0x00, 0xe6 };
+
+/* Description of the longjmp buffer.  */
+#define ARM_WINCE_JB_ELEMENT_SIZE      INT_REGISTER_SIZE
+#define ARM_WINCE_JB_PC                        21
+
+static void
+arm_wince_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
+{
+  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
+  tdep->arm_breakpoint = arm_wince_le_breakpoint;
+  tdep->arm_breakpoint_size = sizeof (arm_wince_le_breakpoint);
+  tdep->struct_return = pcc_struct_return;
+
+  tdep->fp_model = ARM_FLOAT_SOFT_VFP;
+
+  tdep->jb_pc = ARM_WINCE_JB_PC;
+  tdep->jb_elt_size = ARM_WINCE_JB_ELEMENT_SIZE;
+
+  /* On ARM WinCE char defaults to signed.  */
+  set_gdbarch_char_signed (gdbarch, 1);
+
+  set_solib_svr4_fetch_link_map_offsets
+    (gdbarch, svr4_ilp32_fetch_link_map_offsets);
+
+  /* Shared library handling.  */
+  set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
+}
+
+static enum gdb_osabi
+arm_wince_osabi_sniffer (bfd *abfd)
+{
+  const char *target_name = bfd_get_target (abfd);
+
+  if (strcmp (target_name, "pei-arm-wince-little") == 0)
+    return GDB_OSABI_WINCE;
+
+  return GDB_OSABI_UNKNOWN;
+}
+
+/* Provide a prototype to silence -Wmissing-prototypes.  */
+void _initialize_arm_wince_tdep (void);
+
+void
+_initialize_arm_wince_tdep (void)
+{
+  gdbarch_register_osabi_sniffer (bfd_arch_arm, bfd_target_coff_flavour,
+                                  arm_wince_osabi_sniffer);
+
+  gdbarch_register_osabi (bfd_arch_arm, 0, GDB_OSABI_WINCE,
+                          arm_wince_init_abi);
+}
diff --git a/gdb/config/arm/tm-wince.h b/gdb/config/arm/tm-wince.h
deleted file mode 100644 (file)
index c95c9b4..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Definitions to target GDB for Windows CE target
-   Copyright 2000, 2007 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.  */
-
-#ifndef TM_WINCE_H
-#define TM_WINCE_H
-
-#include "arm/tm-arm.h"
-
-#undef SOFTWARE_SINGLE_STEP_P
-#define SOFTWARE_SINGLE_STEP_P() 1
-
-#undef SOFTWARE_SINGLE_STEP
-#define SOFTWARE_SINGLE_STEP(sig, bp_p) wince_software_single_step (sig, bp_p)
-
-void wince_software_single_step (unsigned int, int);
-
-#endif /* TM_WINCE_H */
index 9cdc07ded5e747cb2db49145406cc580538fbb9f..2e74f029b12d091d3dc3f9072d1df4b68f9af1c1 100644 (file)
@@ -1,5 +1,4 @@
-# Target: Acorn RISC machine (ARM) with simulator
-TDEPFILES= arm-tdep.o wince.o
-DEPRECATED_TM_FILE= tm-wince.h
-MT_CFLAGS=-DARM -U_X86_ -U_M_IX86 -U__i386__ -U__i486__ -U__i586__ -U__i686__ -DUNICODE -D_WIN32_WCE -DWINCE_STUB='"${target_alias}-stub.exe"'
-TM_CLIBS=-lrapi
+# Target: ARM based machine running Windows CE (win32)
+DEPRECATED_TM_FILE= tm-arm.h
+TDEPFILES= arm-tdep.o arm-wince-tdep.o corelow.o \
+  solib.o solib-legacy.o solib-svr4.o
index 94cd6bb81f1337185a62935b9ecf331d01b1edbd..801ddd43d9012498ed9152aa95668c9220d1802f 100644 (file)
@@ -54,7 +54,10 @@ alpha*-*-*)          gdb_target=alpha ;;
 # mn10300 / am33 liunux
 am33_2.0*-*-linux*)    gdb_target=linux ;;
 
-arm*-wince-pe)         gdb_target=wince ;;
+arm*-wince-pe | arm*-*-mingw32ce*)
+                       gdb_target=wince
+                       build_gdbserver=yes
+                       ;;
 arm*-*-linux*)         gdb_target=linux
                        build_gdbserver=yes
                        ;;
index d331198d562dccfd01fdd87ca17e144edf1673aa..aa5b86807a4d1968c88964441ec675f59ff39ce4 100644 (file)
@@ -1,3 +1,85 @@
+2007-03-29  Pedro Alves  <pedro_alves@portugalmail.pt>
+
+       * gdbserver/configure.ac: Add errno checking.
+       (AC_CHECK_HEADERS): Add errno.h, fcntl.h, signal.h,
+       sys/file.h and malloc.h.
+       (AC_CHECK_DECLS): Add perror.
+       (srv_mingwce): Handle.
+       * gdbserver/configure.srv (i[34567]86-*-cygwin*): Add
+       win32-i386-low.o to srv_tgtobj.
+       (i[34567]86-*-mingw*): Likewise.
+       (arm*-*-mingw32ce*): Add case.
+       * gdbreplay.c [HAVE_SYS_FILE_H, HAVE_SIGNAL_H,
+       HAVE_FCNTL_H, HAVE_ERRNO_H, HAVE_MALLOC_H]: Check.
+       [__MINGW32CE__] (strerror): New function.
+       [__MINGW32CE__] (errno): Define to GetLastError.
+       [__MINGW32CE__] (COUNTOF): New macro.
+       (remote_open): Remove extra close call.
+       * mem-break.c (delete_breakpoint_at): New function.
+       * mem-break.h (delete_breakpoint_at): Declare.
+       * remote-utils.c [HAVE_SYS_FILE_H, HAVE_SIGNAL_H,
+       HAVE_FCNTL_H, HAVE_UNISTD_H, HAVE_ERRNO_H]: Check.
+       [USE_WIN32API] (read, write): Add char* casts.
+       * server.c [HAVE_UNISTD_H, HAVE_SIGNAL_H]: Check.
+       * server.h: Include wincecompat.h on Windows CE.
+       [HAVE_ERRNO_H]: Check.
+       (perror): Declare if not declared.
+       * utils.c: Add stdlib.h, errno.h and malloc.h includes.
+       (perror_with_name): Remove errno declaration.
+       * wincecompat.h: New.
+       * wincecompat.c: New.
+       * win32-low.h: New.
+       * win32-arm-low.c: New.
+       * win32-i386-low.c: New.
+       (win32-low.c): Include mem-break.h and win32-low.h, and winnt.h.
+       (OUTMSG2): Make it safe.
+       (_T): New macro.
+       (COUNTOF): New macro.
+       (NUM_REGS): Get it from the low target.
+       (CONTEXT_EXTENDED_REGISTERS, CONTEXT_FLOATING_POINT,
+       CONTEXT_DEBUG_REGISTERS): Add fallbacks to 0.
+       (thread_rec): Let low target handle debug registers.
+       (child_add_thread): Likewise.
+       (child_init_thread_list): Likewise.
+       (continue_one_thread): Likewise.
+       (regptr): New.
+       (do_child_fetch_inferior_registers): Move to ...
+       * win32-i386-low.c: ... here, and rename to ...
+       (do_fetch_inferior_registers): ... this.
+       * win32-low.c (child_fetch_inferior_registers): 
+       Go through the low target.
+       (do_child_store_inferior_registers): Use regptr.
+       (strwinerror): New function.
+       (win32_create_inferior): Handle Windows CE.
+       Use strwinerror instead of strerror on Windows error
+       codes.  Add program to the error output.
+       Don't close the main thread handle on Windows CE.
+       (win32_attach): Use coredll.dll on Windows CE.
+       (win32_kill): Close current process and current
+       thread handles.
+       (win32_detach): Use coredll.dll on Windows CE.
+       (win32_resume): Let low target handle debug registers, and
+       step request.
+       (handle_exception): Add/Remove initial breakpoint.  Avoid
+       non-existant WSTOPSIG on Windows CE.
+       (win32_read_inferior_memory): Cast to remove warning.
+       (win32_arch_string): Go through the low target.
+       (initialize_low): Call set_breakpoint_data with the low
+       target's breakpoint.
+       * win32-low.c (dr, FLAG_TRACE_BIT, FCS_REGNUM,
+       FOP_REGNUM, mappings): Move to ...
+       * win32-i386-low.c: ... here.
+       * win32-low.c (win32_thread_info): Move to ...
+       * win32-low.h: ... here.
+       * Makefile.in (SFILES): Add win32-low.c, win32-i386-low.c,
+       win32-arm-low.c and wincecompat.c.
+       (all:): Add $EXEEXT.
+       (install-only:): Likewise.
+       (gdbserver:): Likewise.
+       (gdbreplay:): Likewise.
+       * config.in: Regenerate.
+       * configure: Regenerate.
+
 2007-03-28  Pedro Alves  <pedro_alves@portugalmail.pt>
 
        * win32-low.c: Rename typedef thread_info to
index 4292c4492a08508af3831f86cb76ea0b2b375f13..fad796304e6acc945479f6bc6dbc180c46cc190f 100644 (file)
@@ -128,7 +128,9 @@ SFILES=     $(srcdir)/gdbreplay.c $(srcdir)/inferiors.c \
        $(srcdir)/linux-m68k-low.c $(srcdir)/linux-mips-low.c \
        $(srcdir)/linux-ppc-low.c $(srcdir)/linux-ppc64-low.c \
        $(srcdir)/linux-s390-low.c \
-       $(srcdir)/linux-sh-low.c $(srcdir)/linux-x86-64-low.c
+       $(srcdir)/linux-sh-low.c $(srcdir)/linux-x86-64-low.c \
+       $(srcdir)/win32-arm-low.c $(srcdir)/win32-i386-low.c \
+       $(srcdir)/win32-low.c $(srcdir)/wincecompat.c
 
 DEPFILES = @GDBSERVER_DEPFILES@
 
@@ -154,7 +156,7 @@ XML_BUILTIN = @srv_xmlbuiltin@
 .c.o:
        ${CC} -c ${INTERNAL_CFLAGS} $<
 
-all: gdbserver gdbreplay
+all: gdbserver$(EXEEXT) gdbreplay$(EXEEXT)
 
 # Traditionally "install" depends on "all".  But it may be useful
 # not to; for example, if the user has made some trivial change to a 
@@ -166,7 +168,7 @@ install-only:
        n=`echo gdbserver | sed '$(program_transform_name)'`; \
        if [ x$$n = x ]; then n=gdbserver; else true; fi; \
        $(SHELL) $(srcdir)/../../mkinstalldirs $(DESTDIR)$(bindir); \
-       $(INSTALL_PROGRAM) gdbserver $(DESTDIR)$(bindir)/$$n; \
+       $(INSTALL_PROGRAM) gdbserver$(EXEEXT) $(DESTDIR)$(bindir)/$$n$(EXEEXT); \
        $(SHELL) $(srcdir)/../../mkinstalldirs $(DESTDIR)$(man1dir); \
        $(INSTALL_DATA) $(srcdir)/gdbserver.1 $(DESTDIR)$(man1dir)/$$n.1
 
@@ -184,14 +186,14 @@ html:
 install-html:
 clean-info:
 
-gdbserver: $(OBS) ${ADD_DEPS} ${CDEPS}
-       rm -f gdbserver
-       ${CC-LD} $(INTERNAL_CFLAGS) $(INTERNAL_LDFLAGS) -o gdbserver $(OBS) \
+gdbserver$(EXEEXT): $(OBS) ${ADD_DEPS} ${CDEPS}
+       rm -f gdbserver$(EXEEXT)
+       ${CC-LD} $(INTERNAL_CFLAGS) $(INTERNAL_LDFLAGS) -o gdbserver$(EXEEXT) $(OBS) \
          $(GDBSERVER_LIBS) $(XM_CLIBS)
 
-gdbreplay: gdbreplay.o
-       rm -f gdbreplay
-       ${CC-LD} $(INTERNAL_CFLAGS) $(INTERNAL_LDFLAGS) -o gdbreplay gdbreplay.o \
+gdbreplay$(EXEEXT): gdbreplay.o
+       rm -f gdbreplay$(EXEEXT)
+       ${CC-LD} $(INTERNAL_CFLAGS) $(INTERNAL_LDFLAGS) -o gdbreplay$(EXEEXT) gdbreplay.o \
          $(XM_CLIBS)
 
 # Put the proper machine-specific files first, so M-. on a machine
index 69cdec6e64494cb14a6269a44726e61c1c3dcd56..675a50c96bcedb4c5eee72ef0e4467f4589034b8 100644 (file)
@@ -3,6 +3,10 @@
 /* Define to 1 if you have the <arpa/inet.h> header file. */
 #undef HAVE_ARPA_INET_H
 
+/* Define to 1 if you have the declaration of `perror', and to 0 if you don't.
+   */
+#undef HAVE_DECL_PERROR
+
 /* Define to 1 if you have the declaration of `strerror', and to 0 if you
    don't. */
 #undef HAVE_DECL_STRERROR
 /* Define if <sys/procfs.h> has elf_fpregset_t. */
 #undef HAVE_ELF_FPREGSET_T
 
+/* Define if errno is available */
+#undef HAVE_ERRNO
+
+/* Define to 1 if you have the <errno.h> header file. */
+#undef HAVE_ERRNO_H
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#undef HAVE_FCNTL_H
+
 /* Define to 1 if you have the <inttypes.h> header file. */
 #undef HAVE_INTTYPES_H
 
@@ -25,6 +38,9 @@
 /* Define if <sys/procfs.h> has lwpid_t. */
 #undef HAVE_LWPID_T
 
+/* Define to 1 if you have the <malloc.h> header file. */
+#undef HAVE_MALLOC_H
+
 /* Define to 1 if you have the <memory.h> header file. */
 #undef HAVE_MEMORY_H
 
@@ -56,6 +72,9 @@
 /* Define to 1 if you have the <sgtty.h> header file. */
 #undef HAVE_SGTTY_H
 
+/* Define to 1 if you have the <signal.h> header file. */
+#undef HAVE_SIGNAL_H
+
 /* Define to 1 if the system has the type `socklen_t'. */
 #undef HAVE_SOCKLEN_T
 
@@ -71,6 +90,9 @@
 /* Define to 1 if you have the <string.h> header file. */
 #undef HAVE_STRING_H
 
+/* Define to 1 if you have the <sys/file.h> header file. */
+#undef HAVE_SYS_FILE_H
+
 /* Define to 1 if you have the <sys/ioctl.h> header file. */
 #undef HAVE_SYS_IOCTL_H
 
 /* Define to 1 if you have the <unistd.h> header file. */
 #undef HAVE_UNISTD_H
 
+/* Checking if errno must be defined */
+#undef MUST_DEFINE_ERRNO
+
 /* Define to the address where bug reports for this package should be sent. */
 #undef PACKAGE_BUGREPORT
 
index c95ea401a5afe808281cb47b5eec3fd9c8167cf4..b6834c10251da02b6856bd96f65215a5057809d0 100755 (executable)
@@ -2938,7 +2938,12 @@ done
 
 
 
-for ac_header in sgtty.h termio.h termios.h sys/reg.h string.h                  proc_service.h sys/procfs.h thread_db.h linux/elf.h             stdlib.h unistd.h               sys/ioctl.h netinet/in.h sys/socket.h netdb.h           netinet/tcp.h arpa/inet.h sys/wait.h
+
+
+
+
+
+for ac_header in sgtty.h termio.h termios.h sys/reg.h string.h                  proc_service.h sys/procfs.h thread_db.h linux/elf.h             stdlib.h unistd.h               errno.h fcntl.h signal.h sys/file.h malloc.h            sys/ioctl.h netinet/in.h sys/socket.h netdb.h           netinet/tcp.h arpa/inet.h sys/wait.h
 do
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
 if eval "test \"\${$as_ac_Header+set}\" = set"; then
@@ -3088,6 +3093,124 @@ fi
 done
 
 
+have_errno=no
+echo "$as_me:$LINENO: checking for errno" >&5
+echo $ECHO_N "checking for errno... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+#if HAVE_ERRNO_H
+#include <errno.h>
+#endif
+int
+main ()
+{
+static int x; x = errno;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  echo "$as_me:$LINENO: result: yes - in errno.h" >&5
+echo "${ECHO_T}yes - in errno.h" >&6;
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_ERRNO 1
+_ACEOF
+ have_errno=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+if test $have_errno = no; then
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+#if HAVE_ERRNO_H
+#include <errno.h>
+#endif
+int
+main ()
+{
+extern int errno; static int x; x = errno;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  echo "$as_me:$LINENO: result: yes - must define" >&5
+echo "${ECHO_T}yes - must define" >&6;
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_ERRNO 1
+_ACEOF
+
+cat >>confdefs.h <<\_ACEOF
+#define MUST_DEFINE_ERRNO 1
+_ACEOF
+
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+
 echo "$as_me:$LINENO: checking whether strerror is declared" >&5
 echo $ECHO_N "checking whether strerror is declared... $ECHO_C" >&6
 if test "${ac_cv_have_decl_strerror+set}" = set; then
@@ -3157,6 +3280,76 @@ else
 _ACEOF
 
 
+fi
+echo "$as_me:$LINENO: checking whether perror is declared" >&5
+echo $ECHO_N "checking whether perror is declared... $ECHO_C" >&6
+if test "${ac_cv_have_decl_perror+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+#ifndef perror
+  char *p = (char *) perror;
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_have_decl_perror=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_have_decl_perror=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_have_decl_perror" >&5
+echo "${ECHO_T}$ac_cv_have_decl_perror" >&6
+if test $ac_cv_have_decl_perror = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_PERROR 1
+_ACEOF
+
+
+else
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_PERROR 0
+_ACEOF
+
+
 fi
 
 
@@ -3270,8 +3463,13 @@ esac
 
 . ${srcdir}/configure.srv
 
-if test "${srv_mingw}" = "yes"; then
+if test "${srv_mingwce}" = "yes"; then
+  LIBS="$LIBS -lws2"
+elif test "${srv_mingw}" = "yes"; then
   LIBS="$LIBS -lwsock32"
+fi
+
+if test "${srv_mingw}" = "yes"; then
 
 cat >>confdefs.h <<\_ACEOF
 #define USE_WIN32API 1
index 2568a57f17ef52acf048e3aaad60f0ebbd82c858..e24462b0132cdcef96cb989691b085d23681302e 100644 (file)
@@ -39,10 +39,27 @@ AC_HEADER_STDC
 AC_CHECK_HEADERS(sgtty.h termio.h termios.h sys/reg.h string.h dnl
                 proc_service.h sys/procfs.h thread_db.h linux/elf.h dnl
                 stdlib.h unistd.h dnl
+                errno.h fcntl.h signal.h sys/file.h malloc.h dnl
                 sys/ioctl.h netinet/in.h sys/socket.h netdb.h dnl
                 netinet/tcp.h arpa/inet.h sys/wait.h)
 
-AC_CHECK_DECLS(strerror)
+have_errno=no
+AC_MSG_CHECKING(for errno)
+AC_TRY_LINK([
+#if HAVE_ERRNO_H
+#include <errno.h>
+#endif], [static int x; x = errno;],
+  [AC_MSG_RESULT(yes - in errno.h); AC_DEFINE(HAVE_ERRNO, 1, [Define if errno is available]) have_errno=yes])
+if test $have_errno = no; then
+AC_TRY_LINK([
+#if HAVE_ERRNO_H
+#include <errno.h>
+#endif], [extern int errno; static int x; x = errno;],
+  [AC_MSG_RESULT(yes - must define); AC_DEFINE(HAVE_ERRNO, 1, [Define if errno is available]) AC_DEFINE(MUST_DEFINE_ERRNO, 1, [Checking if errno must be defined])],
+  [AC_MSG_RESULT(no)])
+fi
+
+AC_CHECK_DECLS([strerror, perror])
 
 AC_CHECK_TYPES(socklen_t, [], [],
 [#include <sys/types.h>
@@ -68,8 +85,13 @@ esac
 
 . ${srcdir}/configure.srv
 
-if test "${srv_mingw}" = "yes"; then
+if test "${srv_mingwce}" = "yes"; then
+  LIBS="$LIBS -lws2"
+elif test "${srv_mingw}" = "yes"; then
   LIBS="$LIBS -lwsock32"
+fi
+
+if test "${srv_mingw}" = "yes"; then
   AC_DEFINE(USE_WIN32API, 1,
            [Define if we should use the Windows API, instead of the
             POSIX API.  On Windows, we use the Windows API when
index cc5f86456d078996af69eaa401a6dad8464d7aad..4b5d3e438ee36a134466dc376f9fed022876a8bc 100644 (file)
@@ -44,7 +44,7 @@ case "${target}" in
                        srv_linux_thread_db=yes
                        ;;
   i[34567]86-*-cygwin*)        srv_regobj=reg-i386.o
-                       srv_tgtobj="win32-low.o"
+                       srv_tgtobj="win32-low.o win32-i386-low.o"
                        ;;
   i[34567]86-*-linux*) srv_regobj=reg-i386-linux.o
                        srv_tgtobj="linux-low.o linux-i386-low.o i387-fp.o"
@@ -52,8 +52,14 @@ case "${target}" in
                        srv_linux_regsets=yes
                        srv_linux_thread_db=yes
                        ;;
+  arm*-*-mingw32ce*)   srv_regobj=reg-arm.o
+                       srv_tgtobj="win32-low.o win32-arm-low.o"
+                       srv_tgtobj="${srv_tgtobj} wincecompat.o"
+                       srv_mingw=yes
+                       srv_mingwce=yes
+                       ;;
   i[34567]86-*-mingw*) srv_regobj=reg-i386.o
-                       srv_tgtobj="win32-low.o"
+                       srv_tgtobj="win32-low.o win32-i386-low.o"
                        srv_mingw=yes
                        ;;
   ia64-*-linux*)       srv_regobj=reg-ia64.o
index c87d1eec4970e5a7b55702dfc6e7f8c6053cbf58..f089b3f79f8050027fc4db10aa8c4f81fe8ab1f7 100644 (file)
 
 #include "config.h"
 #include <stdio.h>
+#if HAVE_SYS_FILE_H
 #include <sys/file.h>
+#endif
+#if HAVE_SIGNAL_H
 #include <signal.h>
+#endif
 #include <ctype.h>
+#if HAVE_FCNTL_H
 #include <fcntl.h>
+#endif
+#if HAVE_ERRNO_H
 #include <errno.h>
-
+#endif
 #ifdef HAVE_STDLIB_H
 #include <stdlib.h>
 #endif
@@ -49,6 +56,9 @@
 #if HAVE_NETINET_TCP_H
 #include <netinet/tcp.h>
 #endif
+#if HAVE_MALLOC_H
+#include <malloc.h>
+#endif
 
 #if USE_WIN32API
 #include <winsock.h>
@@ -63,6 +73,57 @@ typedef int socklen_t;
 
 static int remote_desc;
 
+#ifdef __MINGW32CE__
+
+#ifndef COUNTOF
+#define COUNTOF(STR) (sizeof (STR) / sizeof ((STR)[0]))
+#endif
+
+#define errno (GetLastError ())
+
+char *
+strerror (DWORD error)
+{
+  static char buf[1024];
+  WCHAR *msgbuf;
+  DWORD lasterr = GetLastError ();
+  DWORD chars = FormatMessageW (FORMAT_MESSAGE_FROM_SYSTEM
+                               | FORMAT_MESSAGE_ALLOCATE_BUFFER,
+                               NULL,
+                               error,
+                               0, /* Default language */
+                               (LPVOID)&msgbuf,
+                               0,
+                               NULL);
+  if (chars != 0)
+    {
+      /* If there is an \r\n appended, zap it.  */
+      if (chars >= 2
+         && msgbuf[chars - 2] == '\r'
+         && msgbuf[chars - 1] == '\n')
+       {
+         chars -= 2;
+         msgbuf[chars] = 0;
+       }
+
+      if (chars > ((COUNTOF (buf)) - 1))
+       {
+         chars = COUNTOF (buf) - 1;
+         msgbuf [chars] = 0;
+       }
+
+      wcstombs (buf, msgbuf, chars + 1);
+      LocalFree (msgbuf);
+    }
+  else
+    sprintf (buf, "unknown win32 error (%ld)", error);
+
+  SetLastError (lasterr);
+  return buf;
+}
+
+#endif /* __MINGW32CE__ */
+
 /* Print the system error message for errno, and also mention STRING
    as the file name for which the error was encountered.
    Then return to command level.  */
@@ -178,8 +239,6 @@ remote_open (char *name)
       setsockopt (remote_desc, IPPROTO_TCP, TCP_NODELAY,
                  (char *) &tmp, sizeof (tmp));
 
-      close (tmp_desc);                /* No longer need this */
-
 #ifndef USE_WIN32API
       close (tmp_desc);                /* No longer need this */
 
index eb3dad481ededa60bbc63fbacea170b301ddbf33..19233e05269f042d6a790240530113d3f830314f 100644 (file)
@@ -113,6 +113,14 @@ find_breakpoint_at (CORE_ADDR where)
   return NULL;
 }
 
+void
+delete_breakpoint_at (CORE_ADDR addr)
+{
+  struct breakpoint *bp = find_breakpoint_at (addr);
+  if (bp != NULL)
+    delete_breakpoint (bp);
+}
+
 static void
 reinsert_breakpoint_handler (CORE_ADDR stop_pc)
 {
index d04c65943c75b50f6b09f46538abf073d2ca5111..9c8dc28a287cb8e0dced512465e2d76937ad080a 100644 (file)
 void set_breakpoint_at (CORE_ADDR where,
                        void (*handler) (CORE_ADDR));
 
+/* Delete a breakpoint previously inserted at ADDR with
+   set_breakpoint_at.  */
+
+void delete_breakpoint_at (CORE_ADDR addr);
+
 /* Create a reinsertion breakpoint at STOP_AT for the breakpoint
    currently at STOP_PC (and temporarily remove the breakpoint at
    STOP_PC).  */
index 362bfdbc5babce1568f87f4969e2c9fd4ce75647..3c0e5e47282a3af18aee92b8c942d78dc76b54d2 100644 (file)
@@ -26,7 +26,9 @@
 #if HAVE_SYS_IOCTL_H
 #include <sys/ioctl.h>
 #endif
+#if HAVE_SYS_FILE_H
 #include <sys/file.h>
+#endif
 #if HAVE_NETINET_IN_H
 #include <netinet/in.h>
 #endif
 #if HAVE_SYS_IOCTL_H
 #include <sys/ioctl.h>
 #endif
+#if HAVE_SIGNAL_H
 #include <signal.h>
+#endif
+#if HAVE_FCNTL_H
 #include <fcntl.h>
+#endif
 #include <sys/time.h>
+#if HAVE_UNISTD_H
 #include <unistd.h>
+#endif
 #if HAVE_ARPA_INET_H
 #include <arpa/inet.h>
 #endif
 #include <sys/stat.h>
+#if HAVE_ERRNO_H
 #include <errno.h>
+#endif
 
 #if USE_WIN32API
 #include <winsock.h>
@@ -85,8 +95,8 @@ extern int using_threads;
 extern int debug_threads;
 
 #ifdef USE_WIN32API
-# define read(fd, buf, len) recv (fd, buf, len, 0)
-# define write(fd, buf, len) send (fd, buf, len, 0)
+# define read(fd, buf, len) recv (fd, (char *) buf, len, 0)
+# define write(fd, buf, len) send (fd, (char *) buf, len, 0)
 #endif
 
 /* Open a connection to a remote debugger.
index 04b62654a038e07e52c5068b48973ab6c51a6012..61a08a175d6eb7c9e0e1a3ba20b9b87f9dad540c 100644 (file)
 
 #include "server.h"
 
+#if HAVE_UNISTD_H
 #include <unistd.h>
+#endif
+#if HAVE_SIGNAL_H
 #include <signal.h>
+#endif
 #if HAVE_SYS_WAIT_H
 #include <sys/wait.h>
 #endif
index df676158817b1ea7ca549995134e01f3c88a431a..d433f30837858dff067a407aea4efb245c7e80f9 100644 (file)
 
 #include "config.h"
 
+#ifdef __MINGW32CE__
+#include "wincecompat.h"
+#endif
+
 #include <stdarg.h>
 #include <stdio.h>
 #include <stdlib.h>
+#ifdef HAVE_ERRNO_H
 #include <errno.h>
+#endif
 #include <setjmp.h>
 
 #ifdef HAVE_STRING_H
@@ -40,6 +46,12 @@ extern char *strerror (int); /* X3.159-1989  4.11.6.2 */
 #endif
 #endif
 
+#if !HAVE_DECL_PERROR
+#ifndef perror
+extern void perror (const char *);
+#endif
+#endif
+
 #ifndef ATTR_NORETURN
 #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7))
 #define ATTR_NORETURN __attribute__ ((noreturn))
index 2130d1766c408b8689d5c977d2bcc784d58d156a..88215aa22219f0e0ea6a48c62b67a926338ae183 100644 (file)
 #include "server.h"
 #include <stdio.h>
 #include <string.h>
+#include <stdlib.h>
+#if HAVE_ERRNO_H
+#include <errno.h>
+#endif
+#if HAVE_MALLOC_H
+#include <malloc.h>
+#endif
 
 /* Generally useful subroutines used throughout the program.  */
 
@@ -32,9 +39,6 @@
 void
 perror_with_name (char *string)
 {
-#ifndef STDC_HEADERS
-  extern int errno;
-#endif
   const char *err;
   char *combined;
 
diff --git a/gdb/gdbserver/win32-arm-low.c b/gdb/gdbserver/win32-arm-low.c
new file mode 100644 (file)
index 0000000..08c5a09
--- /dev/null
@@ -0,0 +1,76 @@
+/* Copyright (C) 2007 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., 51 Franklin Street, Fifth Floor,
+   Boston, MA 02110-1301, USA.  */
+
+#include "server.h"
+#include "win32-low.h"
+
+/* Fetch register(s) from gdbserver regcache data.  */
+static void
+do_fetch_inferior_registers (win32_thread_info *th, int r)
+{
+  char *context_offset = regptr (&th->context, r);
+  supply_register (r, context_offset);
+}
+
+#define context_offset(x) ((int)&(((CONTEXT *)NULL)->x))
+static const int mappings[] = {
+  context_offset (R0),
+  context_offset (R1),
+  context_offset (R2),
+  context_offset (R3),
+  context_offset (R4),
+  context_offset (R5),
+  context_offset (R6),
+  context_offset (R7),
+  context_offset (R8),
+  context_offset (R9),
+  context_offset (R10),
+  context_offset (R11),
+  context_offset (R12),
+  context_offset (Sp),
+  context_offset (Lr),
+  context_offset (Pc),
+  -1, /* f0 */
+  -1, /* f1 */
+  -1, /* f2 */
+  -1, /* f3 */
+  -1, /* f4 */
+  -1, /* f5 */
+  -1, /* f6 */
+  -1, /* f7 */
+  -1, /* fps */
+  context_offset (Psr),
+};
+#undef context_offset
+
+static const unsigned char arm_wince_le_breakpoint[] =
+  { 0x10, 0x00, 0x00, 0xe6 };
+
+struct win32_target_ops the_low_target = {
+  mappings,
+  sizeof (mappings) / sizeof (mappings[0]),
+  NULL, /* initial_stuff */
+  NULL, /* store_debug_registers */
+  NULL, /* load_debug_registers */
+  do_fetch_inferior_registers,
+  NULL, /* single_step */
+  arm_wince_le_breakpoint,
+  sizeof (arm_wince_le_breakpoint) / sizeof (arm_wince_le_breakpoint[0]),
+  "arm" /* arch_string */
+};
diff --git a/gdb/gdbserver/win32-i386-low.c b/gdb/gdbserver/win32-i386-low.c
new file mode 100644 (file)
index 0000000..58ad787
--- /dev/null
@@ -0,0 +1,152 @@
+/* Copyright (C) 2007 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., 51 Franklin Street, Fifth Floor,
+   Boston, MA 02110-1301, USA.  */
+
+#include "server.h"
+#include "win32-low.h"
+
+#define FCS_REGNUM 27
+#define FOP_REGNUM 31
+
+#define FLAG_TRACE_BIT 0x100
+
+static unsigned dr[8];
+
+static void
+initial_stuff (void)
+{
+  memset (&dr, 0, sizeof (dr));
+}
+
+static void
+store_debug_registers (win32_thread_info *th)
+{
+  dr[0] = th->context.Dr0;
+  dr[1] = th->context.Dr1;
+  dr[2] = th->context.Dr2;
+  dr[3] = th->context.Dr3;
+  dr[6] = th->context.Dr6;
+  dr[7] = th->context.Dr7;
+}
+
+static void
+load_debug_registers (win32_thread_info *th)
+{
+  th->context.Dr0 = dr[0];
+  th->context.Dr1 = dr[1];
+  th->context.Dr2 = dr[2];
+  th->context.Dr3 = dr[3];
+  /* th->context.Dr6 = dr[6];
+     FIXME: should we set dr6 also ?? */
+  th->context.Dr7 = dr[7];
+}
+
+/* Fetch register(s) from gdbserver regcache data.  */
+static void
+do_fetch_inferior_registers (win32_thread_info *th, int r)
+{
+  char *context_offset = regptr (&th->context, r);
+
+  long l;
+  if (r == FCS_REGNUM)
+    {
+      l = *((long *) context_offset) & 0xffff;
+      supply_register (r, (char *) &l);
+    }
+  else if (r == FOP_REGNUM)
+    {
+      l = (*((long *) context_offset) >> 16) & ((1 << 11) - 1);
+      supply_register (r, (char *) &l);
+    }
+  else
+    supply_register (r, context_offset);
+}
+
+static void
+single_step (win32_thread_info *th)
+{
+  th->context.EFlags |= FLAG_TRACE_BIT;
+}
+
+/* An array of offset mappings into a Win32 Context structure.
+   This is a one-to-one mapping which is indexed by gdb's register
+   numbers.  It retrieves an offset into the context structure where
+   the 4 byte register is located.
+   An offset value of -1 indicates that Win32 does not provide this
+   register in it's CONTEXT structure.  In this case regptr will return
+   a pointer into a dummy register.  */
+#define context_offset(x) ((int)&(((CONTEXT *)NULL)->x))
+static const int mappings[] = {
+  context_offset (Eax),
+  context_offset (Ecx),
+  context_offset (Edx),
+  context_offset (Ebx),
+  context_offset (Esp),
+  context_offset (Ebp),
+  context_offset (Esi),
+  context_offset (Edi),
+  context_offset (Eip),
+  context_offset (EFlags),
+  context_offset (SegCs),
+  context_offset (SegSs),
+  context_offset (SegDs),
+  context_offset (SegEs),
+  context_offset (SegFs),
+  context_offset (SegGs),
+  context_offset (FloatSave.RegisterArea[0 * 10]),
+  context_offset (FloatSave.RegisterArea[1 * 10]),
+  context_offset (FloatSave.RegisterArea[2 * 10]),
+  context_offset (FloatSave.RegisterArea[3 * 10]),
+  context_offset (FloatSave.RegisterArea[4 * 10]),
+  context_offset (FloatSave.RegisterArea[5 * 10]),
+  context_offset (FloatSave.RegisterArea[6 * 10]),
+  context_offset (FloatSave.RegisterArea[7 * 10]),
+  context_offset (FloatSave.ControlWord),
+  context_offset (FloatSave.StatusWord),
+  context_offset (FloatSave.TagWord),
+  context_offset (FloatSave.ErrorSelector),
+  context_offset (FloatSave.ErrorOffset),
+  context_offset (FloatSave.DataSelector),
+  context_offset (FloatSave.DataOffset),
+  context_offset (FloatSave.ErrorSelector),
+  /* XMM0-7 */
+  context_offset (ExtendedRegisters[10 * 16]),
+  context_offset (ExtendedRegisters[11 * 16]),
+  context_offset (ExtendedRegisters[12 * 16]),
+  context_offset (ExtendedRegisters[13 * 16]),
+  context_offset (ExtendedRegisters[14 * 16]),
+  context_offset (ExtendedRegisters[15 * 16]),
+  context_offset (ExtendedRegisters[16 * 16]),
+  context_offset (ExtendedRegisters[17 * 16]),
+  /* MXCSR */
+  context_offset (ExtendedRegisters[24])
+};
+#undef context_offset
+
+struct win32_target_ops the_low_target = {
+  mappings,
+  sizeof (mappings) / sizeof (mappings[0]),
+  initial_stuff,
+  store_debug_registers,
+  load_debug_registers,
+  do_fetch_inferior_registers,
+  single_step,
+  (const char*)NULL, /* breakpoint */
+  0, /* breakpoint_len */
+  "i386" /* arch_string */
+};
diff --git a/gdb/gdbserver/win32-low.h b/gdb/gdbserver/win32-low.h
new file mode 100644 (file)
index 0000000..68daa62
--- /dev/null
@@ -0,0 +1,87 @@
+/* Internal interfaces for the Win32 specific target code for gdbserver.
+   Copyright (C) 2007 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., 51 Franklin Street, Fifth Floor,
+   Boston, MA 02110-1301, USA.  */
+
+#include <windows.h>
+
+/* Thread information structure used to track extra information about
+   each thread.  */
+typedef struct win32_thread_info
+{
+  DWORD tid;
+  HANDLE h;
+  int suspend_count;
+  CONTEXT context;
+} win32_thread_info;
+
+struct win32_target_ops
+{
+  /* An array of offset mappings into a Win32 Context structure.
+     This is a one-to-one mapping which is indexed by gdb's register
+     numbers.  It retrieves an offset into the context structure where
+     the 4 byte register is located.
+     An offset value of -1 indicates that Win32 does not provide this
+     register in it's CONTEXT structure.  In this case regptr will return
+     a pointer into a dummy register.  */
+  const int *regmap;
+
+  /* The number of elements of regmap.  */
+  int num_regs;
+
+  void (*initial_stuff) (void);
+
+  void (*store_debug_registers) (win32_thread_info *);
+  void (*load_debug_registers) (win32_thread_info *);
+
+  /* Fetch register(s) from gdbserver regcache data.  */
+  void (*fetch_inferior_registers) (win32_thread_info *th, int r);
+
+  void (*single_step) (win32_thread_info *th);
+
+  const unsigned char *breakpoint;
+  int breakpoint_len;
+
+  /* What string to report to GDB when it asks for the architecture,
+     or NULL not to answer.  */
+  const char *arch_string;
+};
+
+extern struct win32_target_ops the_low_target;
+
+/* in win32-low.c */
+
+/* Return a pointer into a CONTEXT field indexed by gdb register number.
+   Return a pointer to an dummy register holding zero if there is no
+   corresponding CONTEXT field for the given register number.  */
+extern char * regptr (CONTEXT* c, int r);
+
+/* Map the Windows error number in ERROR to a locale-dependent error
+   message string and return a pointer to it.  Typically, the values
+   for ERROR come from GetLastError.
+
+   The string pointed to shall not be modified by the application,
+   but may be overwritten by a subsequent call to strwinerror
+
+   The strwinerror function does not change the current setting
+   of GetLastError.  */
+extern char * strwinerror (DWORD error);
+
+/* in wincecompat.c */
+
+extern void to_back_slashes (char *);
diff --git a/gdb/gdbserver/wincecompat.c b/gdb/gdbserver/wincecompat.c
new file mode 100644 (file)
index 0000000..dd69dca
--- /dev/null
@@ -0,0 +1,41 @@
+/* Compatibility routines for Windows CE.
+   Copyright (C) 2007 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., 51 Franklin Street, Fifth Floor,
+   Boston, MA 02110-1301, USA.  */
+
+#include "server.h"
+
+#include <stdio.h>
+#include <windows.h>
+
+void
+perror (const char *s)
+{
+  if (s && *s)
+    fprintf (stderr, "%s: %s\n", s, strwinerror (GetLastError ()));
+  else
+    fprintf (stderr, "%s\n", strwinerror (GetLastError ()));
+}
+
+void
+to_back_slashes (char *path)
+{
+  for (; *path; ++path)
+    if ('/' == *path)
+      *path = '\\';
+}
diff --git a/gdb/gdbserver/wincecompat.h b/gdb/gdbserver/wincecompat.h
new file mode 100644 (file)
index 0000000..568411b
--- /dev/null
@@ -0,0 +1,32 @@
+/* Compatibility routines for Windows CE.
+   Copyright (C) 2007 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., 51 Franklin Street, Fifth Floor,
+   Boston, MA 02110-1301, USA.  */
+
+#ifndef WINCECOMPAT_H
+#define WINCECOMPAT_H
+
+#include <windows.h>
+
+#define errno (GetLastError ())
+
+/* in win32-low.c */
+extern char * strwinerror (DWORD error);
+#define strerror strwinerror
+
+#endif
index 8b9c33f80de35a2bfe4b0bc253e42a4c0f98a2ef..fc04e76e8b3f6d92113e1defaf46b4484dcb261b 100644 (file)
@@ -28,7 +28,9 @@
 #include "gdb_string.h"
 #endif
 
+#ifdef HAVE_SIGNAL_H
 #include <signal.h>
+#endif
 
 /* Always use __SIGRTMIN if it's available.  SIGRTMIN is the lowest
    _available_ realtime signal, not the lowest supported; glibc takes
@@ -519,6 +521,9 @@ do_target_signal_to_host (enum target_signal oursig,
                          int *oursig_ok)
 {
   int retsig;
+  /* Silence the 'not used' warning, for targets that
+     do not support signals.  */
+  (void) retsig;
 
   *oursig_ok = 1;
   switch (oursig)
This page took 0.0459 seconds and 4 git commands to generate.