aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog13
-rw-r--r--gdb/arm-wince-tdep.c84
-rw-r--r--gdb/config/arm/wince.mt9
-rw-r--r--gdb/configure.tgt5
-rw-r--r--gdb/gdbserver/ChangeLog82
-rw-r--r--gdb/gdbserver/Makefile.in20
-rw-r--r--gdb/gdbserver/config.in25
-rwxr-xr-xgdb/gdbserver/configure202
-rw-r--r--gdb/gdbserver/configure.ac26
-rw-r--r--gdb/gdbserver/configure.srv10
-rw-r--r--gdb/gdbserver/gdbreplay.c65
-rw-r--r--gdb/gdbserver/mem-break.c8
-rw-r--r--gdb/gdbserver/mem-break.h5
-rw-r--r--gdb/gdbserver/remote-utils.c14
-rw-r--r--gdb/gdbserver/server.c4
-rw-r--r--gdb/gdbserver/server.h12
-rw-r--r--gdb/gdbserver/utils.c10
-rw-r--r--gdb/gdbserver/win32-arm-low.c76
-rw-r--r--gdb/gdbserver/win32-i386-low.c152
-rw-r--r--gdb/gdbserver/win32-low.h87
-rw-r--r--gdb/gdbserver/wincecompat.c41
-rw-r--r--gdb/gdbserver/wincecompat.h (renamed from gdb/config/arm/tm-wince.h)26
-rw-r--r--gdb/signals/signals.c5
23 files changed, 938 insertions, 43 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 7e0a0f1..14fb171 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -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
index 0000000..bfebef1
--- /dev/null
+++ b/gdb/arm-wince-tdep.c
@@ -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/wince.mt b/gdb/config/arm/wince.mt
index 9cdc07d..2e74f02 100644
--- a/gdb/config/arm/wince.mt
+++ b/gdb/config/arm/wince.mt
@@ -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
diff --git a/gdb/configure.tgt b/gdb/configure.tgt
index 94cd6bb..801ddd4 100644
--- a/gdb/configure.tgt
+++ b/gdb/configure.tgt
@@ -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
;;
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index d331198..aa5b868 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -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
diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in
index 4292c44..fad7963 100644
--- a/gdb/gdbserver/Makefile.in
+++ b/gdb/gdbserver/Makefile.in
@@ -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
diff --git a/gdb/gdbserver/config.in b/gdb/gdbserver/config.in
index 69cdec6..675a50c 100644
--- a/gdb/gdbserver/config.in
+++ b/gdb/gdbserver/config.in
@@ -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
@@ -10,6 +14,15 @@
/* 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
@@ -110,6 +132,9 @@
/* 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
diff --git a/gdb/gdbserver/configure b/gdb/gdbserver/configure
index c95ea40..b6834c1 100755
--- a/gdb/gdbserver/configure
+++ b/gdb/gdbserver/configure
@@ -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
@@ -3158,6 +3281,76 @@ _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
diff --git a/gdb/gdbserver/configure.ac b/gdb/gdbserver/configure.ac
index 2568a57..e24462b 100644
--- a/gdb/gdbserver/configure.ac
+++ b/gdb/gdbserver/configure.ac
@@ -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
diff --git a/gdb/gdbserver/configure.srv b/gdb/gdbserver/configure.srv
index cc5f864..4b5d3e4 100644
--- a/gdb/gdbserver/configure.srv
+++ b/gdb/gdbserver/configure.srv
@@ -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
diff --git a/gdb/gdbserver/gdbreplay.c b/gdb/gdbserver/gdbreplay.c
index c87d1ee..f089b3f 100644
--- a/gdb/gdbserver/gdbreplay.c
+++ b/gdb/gdbserver/gdbreplay.c
@@ -22,12 +22,19 @@
#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 */
diff --git a/gdb/gdbserver/mem-break.c b/gdb/gdbserver/mem-break.c
index eb3dad4..19233e0 100644
--- a/gdb/gdbserver/mem-break.c
+++ b/gdb/gdbserver/mem-break.c
@@ -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)
{
diff --git a/gdb/gdbserver/mem-break.h b/gdb/gdbserver/mem-break.h
index d04c659..9c8dc28 100644
--- a/gdb/gdbserver/mem-break.h
+++ b/gdb/gdbserver/mem-break.h
@@ -31,6 +31,11 @@
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). */
diff --git a/gdb/gdbserver/remote-utils.c b/gdb/gdbserver/remote-utils.c
index 362bfdb..3c0e5e4 100644
--- a/gdb/gdbserver/remote-utils.c
+++ b/gdb/gdbserver/remote-utils.c
@@ -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
@@ -42,15 +44,23 @@
#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.
diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
index 04b6265..61a08a1 100644
--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -21,8 +21,12 @@
#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
diff --git a/gdb/gdbserver/server.h b/gdb/gdbserver/server.h
index df67615..d433f30 100644
--- a/gdb/gdbserver/server.h
+++ b/gdb/gdbserver/server.h
@@ -24,10 +24,16 @@
#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))
diff --git a/gdb/gdbserver/utils.c b/gdb/gdbserver/utils.c
index 2130d17..88215aa 100644
--- a/gdb/gdbserver/utils.c
+++ b/gdb/gdbserver/utils.c
@@ -22,6 +22,13 @@
#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
index 0000000..08c5a09
--- /dev/null
+++ b/gdb/gdbserver/win32-arm-low.c
@@ -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
index 0000000..58ad787
--- /dev/null
+++ b/gdb/gdbserver/win32-i386-low.c
@@ -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
index 0000000..68daa62
--- /dev/null
+++ b/gdb/gdbserver/win32-low.h
@@ -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
index 0000000..dd69dca
--- /dev/null
+++ b/gdb/gdbserver/wincecompat.c
@@ -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/config/arm/tm-wince.h b/gdb/gdbserver/wincecompat.h
index c95c9b4..568411b 100644
--- a/gdb/config/arm/tm-wince.h
+++ b/gdb/gdbserver/wincecompat.h
@@ -1,5 +1,5 @@
-/* Definitions to target GDB for Windows CE target
- Copyright 2000, 2007 Free Software Foundation, Inc.
+/* Compatibility routines for Windows CE.
+ Copyright (C) 2007 Free Software Foundation, Inc.
This file is part of GDB.
@@ -15,20 +15,18 @@
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. */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA. */
-#ifndef TM_WINCE_H
-#define TM_WINCE_H
+#ifndef WINCECOMPAT_H
+#define WINCECOMPAT_H
-#include "arm/tm-arm.h"
+#include <windows.h>
-#undef SOFTWARE_SINGLE_STEP_P
-#define SOFTWARE_SINGLE_STEP_P() 1
+#define errno (GetLastError ())
-#undef SOFTWARE_SINGLE_STEP
-#define SOFTWARE_SINGLE_STEP(sig, bp_p) wince_software_single_step (sig, bp_p)
+/* in win32-low.c */
+extern char * strwinerror (DWORD error);
+#define strerror strwinerror
-void wince_software_single_step (unsigned int, int);
-
-#endif /* TM_WINCE_H */
+#endif
diff --git a/gdb/signals/signals.c b/gdb/signals/signals.c
index 8b9c33f..fc04e76 100644
--- a/gdb/signals/signals.c
+++ b/gdb/signals/signals.c
@@ -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)