From 091be84d73b3a4f706d2e566df4e11f7b5fd625a Mon Sep 17 00:00:00 2001
From: Christopher Faylor <me+cygwin@cgf.cx>
Date: Thu, 24 Feb 2000 03:31:45 +0000
Subject: [PATCH] * configure.tgt: Add arm, mips, sh wince targets. *
 config/arm/tm-wince.h: New file. * config/arm/wince.mt New file. *
 config/sh/tm-wince.h: New file. * config/sh/wince.mt New file. *
 config/mips/tm-wince.h: New file. * config/mips/wince.mt New file. * wince.c:
 New file. * wince-stub.c: New file. * wince-stub.h: New file. * sh-tdep.c:
 Use correct register names for Windows CE.

---
 gdb/ChangeLog              | 14 ++++++++++++++
 gdb/config/arm/tm-wince.h  | 37 +++++++++++++++++++++++++++++++++++++
 gdb/config/arm/wince.mt    |  5 +++++
 gdb/config/mips/tm-wince.h | 34 ++++++++++++++++++++++++++++++++++
 gdb/config/mips/wince.mt   |  5 +++++
 gdb/config/sh/tm-wince.h   | 34 ++++++++++++++++++++++++++++++++++
 gdb/config/sh/wince.mt     |  5 +++++
 gdb/configure.tgt          |  4 +++-
 gdb/sh-tdep.c              |  6 ++++--
 9 files changed, 141 insertions(+), 3 deletions(-)
 create mode 100644 gdb/config/arm/tm-wince.h
 create mode 100644 gdb/config/arm/wince.mt
 create mode 100644 gdb/config/mips/tm-wince.h
 create mode 100644 gdb/config/mips/wince.mt
 create mode 100644 gdb/config/sh/tm-wince.h
 create mode 100644 gdb/config/sh/wince.mt

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index eed3df14444..f2dadb79346 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,17 @@
+2000-02-24  Christopher Faylor  <cgf@cygnus.com>
+
+	* configure.tgt: Add arm, mips, sh wince targets.
+	* config/arm/tm-wince.h: New file.
+	* config/arm/wince.mt New file.
+	* config/sh/tm-wince.h: New file.
+	* config/sh/wince.mt New file.
+	* config/mips/tm-wince.h: New file.
+	* config/mips/wince.mt New file.
+	* wince.c: New file.
+	* wince-stub.c: New file.
+	* wince-stub.h: New file.
+	* sh-tdep.c: Use correct register names for Windows CE.
+
 Wed Feb 23 19:01:45 EST 2000  Nicholas Duffek <nsd@cygnus.com>
 
 	* top.c (SIGJMP_BUF, SIGSETJMP, SIGLONGJMP): Update comments.
diff --git a/gdb/config/arm/tm-wince.h b/gdb/config/arm/tm-wince.h
new file mode 100644
index 00000000000..9b4613506e5
--- /dev/null
+++ b/gdb/config/arm/tm-wince.h
@@ -0,0 +1,37 @@
+/* Definitions to target GDB for Windows CE target
+   Copyright 2000 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);
+
+#undef TARGET_BYTE_ORDER_SELECTABLE
+#define TARGET_BYTE_ORDER LITTLE_ENDIAN
+
+#endif /* TM_WINCE_H */
diff --git a/gdb/config/arm/wince.mt b/gdb/config/arm/wince.mt
new file mode 100644
index 00000000000..10fe0eb3f38
--- /dev/null
+++ b/gdb/config/arm/wince.mt
@@ -0,0 +1,5 @@
+# Target: Acorn RISC machine (ARM) with simulator
+TDEPFILES= arm-tdep.o wince.o
+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"'
+WIN32LIBS=-lrapi
diff --git a/gdb/config/mips/tm-wince.h b/gdb/config/mips/tm-wince.h
new file mode 100644
index 00000000000..f4bfad2185e
--- /dev/null
+++ b/gdb/config/mips/tm-wince.h
@@ -0,0 +1,34 @@
+/* Definitions to make GDB run on a Windows CE system.
+   Copyright 2000 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_MIPS_H
+#define TM_MIPS_H 1
+
+#include "mips/tm-mips.h"
+
+#undef SOFTWARE_SINGLE_STEP_P
+#define SOFTWARE_SINGLE_STEP_P 1
+#define SOFTWARE_SINGLE_STEP(sig, bp_p) wince_software_single_step (sig, bp_p)
+
+void wince_software_single_step (unsigned int, int);
+#undef TARGET_BYTE_ORDER_SELECTABLE
+#define TARGET_BYTE_ORDER LITTLE_ENDIAN
+
+#endif /* TM_MIPS_H */
diff --git a/gdb/config/mips/wince.mt b/gdb/config/mips/wince.mt
new file mode 100644
index 00000000000..a404b1cec8b
--- /dev/null
+++ b/gdb/config/mips/wince.mt
@@ -0,0 +1,5 @@
+# Target: Little-endian MIPS machine such as DECstation.
+TDEPFILES= mips-tdep.o wince.o
+TM_FILE= tm-wince.h
+MT_CFLAGS=-DMIPS -U_X86_ -U_M_IX86 -U__i386__ -U__i486__ -U__i586__ -U__i686__ -DUNICODE -D_WIN32_WCE -DWINCE_STUB='"${target_alias}-stub.exe"'
+WIN32LIBS=-lrapi
diff --git a/gdb/config/sh/tm-wince.h b/gdb/config/sh/tm-wince.h
new file mode 100644
index 00000000000..16816141d35
--- /dev/null
+++ b/gdb/config/sh/tm-wince.h
@@ -0,0 +1,34 @@
+/* Target-specific definition for Window CE
+   Copyright 2000 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 1
+
+#include "sh/tm-sh.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);
+#undef TARGET_BYTE_ORDER_SELECTABLE
+#define TARGET_BYTE_ORDER LITTLE_ENDIAN
+
+#endif /* TM_WINCE_H */
diff --git a/gdb/config/sh/wince.mt b/gdb/config/sh/wince.mt
new file mode 100644
index 00000000000..237a0bc3428
--- /dev/null
+++ b/gdb/config/sh/wince.mt
@@ -0,0 +1,5 @@
+# Target: Hitachi Super-H running on Windows CE
+TDEPFILES= sh-tdep.o wince.o
+TM_FILE= tm-wince.h
+MT_CFLAGS=-DSHx -U_X86_ -U_M_IX86 -U__i386__ -U__i486__ -U__i586__ -U__i686__ -DUNICODE -D_WIN32_WCE -DWINCE_STUB='"${target_alias}-stub.exe"'
+WIN32LIBS=-lrapi
diff --git a/gdb/configure.tgt b/gdb/configure.tgt
index 20e1aef30a1..4158be5e1ad 100644
--- a/gdb/configure.tgt
+++ b/gdb/configure.tgt
@@ -51,6 +51,7 @@ alpha*-*-linux*)	gdb_target=alpha-linux ;;
 
 arc-*-*)		gdb_target=arc ;;
 
+arm*-wince-pe)		gdb_target=wince ;;
 arm*-*-linux*)		gdb_target=linux ;;
 arm*-*-* | thumb*-*-* | strongarm*-*-*)
 			gdb_target=embed
@@ -171,7 +172,7 @@ mips64*-big-*)		gdb_target=bigmips64 ;;
 mips*-big-*)		gdb_target=bigmips ;;
 mips*-dec-mach3*)	gdb_target=mach3 ;;
 mips*-dec-*)		gdb_target=decstation ;;
-mips*-*-pe)		gdb_target=mips-pe ;;
+mips*-*-pe)		gdb_target=wince ;;
 mips64*el-*-ecoff*)	gdb_target=embedl64 ;;
 mips64*-*-ecoff*)	gdb_target=embed64 ;;
 mips64*vr4xxx*el-*-elf*)gdb_target=vr4xxxel ;;
@@ -245,6 +246,7 @@ rs6000-*-lynxos*)	gdb_target=rs6000lynx ;;
 rs6000-*-aix4*)		gdb_target=aix4 ;;
 rs6000-*-*)		gdb_target=rs6000 ;;
 
+sh*-*-pe)		gdb_target=wince ;;
 sh-*-*)			gdb_target=sh ;;
 
 sparc-*-aout*)		gdb_target=sparc-em ;;
diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c
index 9e6b89b355a..2ab3f53c73c 100644
--- a/gdb/sh-tdep.c
+++ b/gdb/sh-tdep.c
@@ -88,9 +88,11 @@ static char *sh3e_reg_names[] = {
 };
 /* *INDENT-ON* */
 
-
-
+#ifdef _WIN32_WCE
+char **sh_register_names = sh3_reg_names;
+#else
 char **sh_register_names = sh_generic_reg_names;
+#endif
 
 struct
   {