* callback.[ch]: New files.
* remote-rdp.c: Support for the ARM RDP monitor.
* Makefile: Update.
* arm-tdep.c (arm_othernames): New.
(_initialize_arm_tdep): install 'othernames' command.
(arm_nullified_insn, shifted_reg_val, arm_get_next_pc): New.
* configure.in: Check for termios.h, termio.h and sgtty.h.
(i[345]86-*-win32*): New host.
* configure: Regenerated.
* inflow.c: Clean up inclusions.
* main.c (main): Check for WINGDB, not WIN32.
* printcmd.c (do_examine): Put QUIT test in loop.
* remote-hms.c (e7000_load): Delete.
(hms_ops): Point to generic_load instead.
* remote-hms.c (hms_ops): Point to generic_load.
* remote-sim.c (sim_callback_write_stdout): Becomes
gdbsim_write_stdout.
(gdbsim_load): Call generic_load.
* remote-utils.c (gr_load_image): Delete.
* ser-unix.c (terminal.h): Include instead of havig
own #if tree.
(hardwire_flush_input): Reset input buffer too.
* source.c (openp): If WIN32 then open file in binary mode.
* terminal.h: Configure IO mechanism using autoconf defines if available and
not overriden.
* utils.c (quit, pollquit, notice_quit): WIN32 check becomes WINGDB check.
* config/arm/arm.mt (TDEPFILES): Add remote-rdp.o
* config/arm/tm-arm.h (TARGET_BYTE_ORDER): becomes TARGET_BYTE_ORDER_SELECTABLE.
(ADDR_BITS_REMOVE): New.
(ORIGINAL_REGISTER_NAMES, ADDITIONAL_REGISTER_NAMES): New.
(INST_xx): New
(FRAME_FIND_SAVED_REGS): Pass the right argument.
(arm_get_next_pc): Declare.
* mswin/prebuilt/*/bfdtarget.h (SELECT_ARCHITECTURES): Need leading &.
breakpoint.h
buildsym.c
buildsym.h
+callback.c
+callback.h
c-exp.y
c-lang.c
c-lang.h
remote-nrom.c
remote-os9k.c
remote-pa.c
+remote-rdp.c
remote-sim.c
remote-sim.h
remote-st.c
+Thu Sep 28 14:32:11 1995 steve chamberlain <sac@slash.cygnus.com>
+
+ * callback.[ch]: New files.
+ * remote-rdp.c: Support for the ARM RDP monitor.
+ * Makefile: Update.
+ * arm-tdep.c (arm_othernames): New.
+ (_initialize_arm_tdep): install 'othernames' command.
+ (arm_nullified_insn, shifted_reg_val, arm_get_next_pc): New.
+ * configure.in: Check for termios.h, termio.h and sgtty.h.
+ (i[345]86-*-win32*): New host.
+ * configure: Regenerated.
+ * inflow.c: Clean up inclusions.
+ * main.c (main): Check for WINGDB, not WIN32.
+ * printcmd.c (do_examine): Put QUIT test in loop.
+ * remote-hms.c (e7000_load): Delete.
+ (hms_ops): Point to generic_load instead.
+ * remote-hms.c (hms_ops): Point to generic_load.
+ * remote-sim.c (sim_callback_write_stdout): Becomes
+ gdbsim_write_stdout.
+ (gdbsim_load): Call generic_load.
+ * remote-utils.c (gr_load_image): Delete.
+ * ser-unix.c (terminal.h): Include instead of havig
+ own #if tree.
+ (hardwire_flush_input): Reset input buffer too.
+ * source.c (openp): If WIN32 then open file in binary mode.
+ * terminal.h: Configure IO mechanism using autoconf defines if available and
+ not overriden.
+ * utils.c (quit, pollquit, notice_quit): WIN32 check becomes WINGDB check.
+ * config/arm/arm.mt (TDEPFILES): Add remote-rdp.o
+ * config/arm/tm-arm.h (TARGET_BYTE_ORDER): becomes TARGET_BYTE_ORDER_SELECTABLE.
+ (ADDR_BITS_REMOVE): New.
+ (ORIGINAL_REGISTER_NAMES, ADDITIONAL_REGISTER_NAMES): New.
+ (INST_xx): New
+ (FRAME_FIND_SAVED_REGS): Pass the right argument.
+ (arm_get_next_pc): Declare.
+ * mswin/prebuilt/*/bfdtarget.h (SELECT_ARCHITECTURES): Need leading &.
+
Wed Sep 27 10:14:36 1995 Per Bothner <bothner@kalessin.cygnus.com>
* valops.c (search_struct_field): Also allow "else" as a variant name,
# Links made at configuration time should not be specified here, since
# SFILES is used in building the distribution archive.
-SFILES = blockframe.c breakpoint.c buildsym.c c-exp.y c-lang.c \
+SFILES = blockframe.c breakpoint.c buildsym.c callback.c c-exp.y c-lang.c \
c-typeprint.c c-valprint.c ch-exp.y ch-lang.c ch-typeprint.c \
ch-valprint.c coffread.c command.c complaints.c core.c cp-valprint.c \
dbxread.c demangle.c dwarfread.c \
complaints.o typeprint.o \
c-typeprint.o ch-typeprint.o f-typeprint.o m2-typeprint.o \
c-valprint.o cp-valprint.o ch-valprint.o f-valprint.o m2-valprint.o \
- nlmread.o serial.o mdebugread.o os9kread.o top.o utils.o
+ nlmread.o serial.o mdebugread.o os9kread.o top.o utils.o callback.o
OBS = $(COMMON_OBS) $(ANNOTATE_OBS) main.o
ns32k-tdep.c ns32km3-nat.c osfsolib.c \
somread.c somsolib.c $(HPREAD_SOURCE) \
procfs.c pyr-tdep.c pyr-xdep.c \
- remote-adapt.c remote-bug.c remote-e7000.c remote-eb.c remote-es.c \
+ remote-adapt.c remote-bug.c remote-e7000.c remote-eb.c remote-es.c \
remote-hms.c remote-mips.c \
- remote-mm.c remote-nindy.c remote-os9k.c remote-sim.c \
+ remote-mm.c remote-nindy.c remote-os9k.c remote-rdp.c remote-sim.c \
remote-st.c remote-utils.c dcache.c \
remote-udi.c remote-vx.c remote-vx29k.c \
rs6000-nat.c rs6000-tdep.c \
buildsym.o: buildsym.c $(bfd_h) buildsym.h complaints.h $(defs_h) \
objfiles.h symfile.h $(symtab_h)
+callback.o: callback.c $(defs_h) callback.h
+
c-lang.o: c-lang.c c-lang.h $(defs_h) $(expression_h) $(gdbtypes_h) \
language.h parser-defs.h $(symtab_h)
remote-adapt.o: remote-adapt.c $(wait_h) $(defs_h) $(gdbcore_h) \
$(inferior_h) target.h terminal.h
+remote-rdp.o: remote-rdp.c $(wait_h) $(defs_h) $(gdbcore_h) \
+ $(inferior_h) remote-rdp.h
+
remote-bug.o: remote-bug.c $(wait_h) $(defs_h) $(gdbcore_h) \
$(inferior_h) target.h terminal.h $(remote_utils_h)
--- /dev/null
+/* Host callback routines for GDB.
+ Copyright 1995 Free Software Foundation, Inc.
+ Contributed by Cygnus Support.
+
+ 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. */
+
+
+/* This file provides a standard way for targets to talk to the host OS
+ level.
+
+ This interface will probably need a bit more banging to make it
+ smooth. Currently the simulator uses this file to provide the
+ callbacks for itself when it's built standalone, which is rather
+ ugly. */
+
+#ifndef INSIDE_SIMULATOR
+#include "defs.h"
+#endif
+
+#include "ansidecl.h"
+#include "callback.h"
+#ifdef ANSI_PROTOTYPES
+#include <stdarg.h>
+#else
+#include <varargs.h>
+#endif
+
+#include <stdio.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <time.h>
+
+
+
+/* Set the callback copy of errno from what we see now. */
+static int
+wrap (p, val)
+ host_callback *p;
+ int val;
+{
+ p->last_errno = errno;
+ return val;
+}
+
+/* Make sure the FD provided is ok. If not, return non -1
+ and set errno. */
+
+static int
+fdbad (p, fd)
+ host_callback *p;
+ int fd;
+{
+ if (fd < 0 || fd > MAX_CALLBACK_FDS || !p->fdopen[fd])
+ {
+ p->last_errno = EINVAL;
+ return -1;
+ }
+ return 0;
+}
+
+static int
+fdmap (p, fd)
+ host_callback *p;
+ int fd;
+{
+ return p->fdmap[fd];
+}
+
+int
+os_close (p, fd)
+ host_callback *p;
+ int fd;
+{
+ return fdbad (p, fd) || wrap (p, close (fdmap (p, fd)));
+}
+
+int
+os_get_errno (p)
+ host_callback *p;
+{
+ /* !!! fixme, translate from host to taget errno value */
+ return p->last_errno;
+}
+
+
+int
+os_isatty (p, fd)
+ host_callback *p;
+ int fd;
+{
+ return fdbad (p, fd) || wrap (p, isatty (fdmap (fd)));
+}
+
+int
+os_lseek (p, fd, off, way)
+ host_callback *p;
+ int fd;
+ long off;
+ int way;
+{
+ return fdbad (p, fd) || lseek (fdmap (p, fd), off, way);
+}
+
+int
+os_open (p, name, flags)
+ host_callback *p;
+ const char *name;
+ int flags;
+{
+ int i;
+ for (i = 0; i < MAX_CALLBACK_FDS; i++)
+ {
+ if (!p->fdopen[i])
+ {
+ int f = open (name, flags);
+ if (f < 0)
+ {
+ p->last_errno = errno;
+ return f;
+ }
+ p->fdopen[i] = 1;
+ p->fdmap[i] = f;
+ return i;
+ }
+ }
+ p->last_errno = EMFILE;
+ return -1;
+}
+
+int
+os_read (p, fd, buf, len)
+ host_callback *p;
+ int fd;
+ char *buf;
+ int len;
+{
+ return fdbad (p, fd) || wrap (p, read (fdmap (p, fd), buf, len));
+}
+
+int
+os_read_stdin (p, buf, len)
+ host_callback *p;
+ char *buf;
+ int len;
+{
+ return wrap (p, read (0, buf, len));
+}
+
+int
+os_write (p, fd, buf, len)
+ host_callback *p;
+ int fd;
+ const char *buf;
+ int len;
+{
+ return fdbad (p, fd) || wrap (p, write (fdmap (p, fd), buf, len));
+}
+
+/* ignore the grossness of INSIDE_SIMULATOR, it will go away one day. */
+int
+os_write_stdout (p, buf, len)
+ host_callback *p;
+ const char *buf;
+ int len;
+{
+#ifdef INSIDE_SIMULATOR
+ return os_write (1, buf, len);
+#else
+ int i;
+ char b[2];
+ for (i = 0; i< len; i++)
+ {
+ b[0] = buf[i];
+ b[1] = 0;
+ if (target_output_hook)
+ target_output_hook (b);
+ else
+ fputs_filtered (b, gdb_stdout);
+ }
+ return len;
+#endif
+}
+
+int
+os_rename (p, f1, f2)
+ host_callback *p;
+ const char *f1;
+ const char *f2;
+{
+ return wrap (p, rename (f1, f2));
+}
+
+
+int
+os_system (p, s)
+ host_callback *p;
+ const char *s;
+{
+ return wrap (p, system (s));
+}
+
+long
+os_time (p, t)
+ host_callback *p;
+ long *t;
+{
+ return wrap (p, time (t));
+}
+
+
+int
+os_unlink (p, f1)
+ host_callback *p;
+ const char *f1;
+{
+ return wrap (p, unlink (f1));
+}
+
+
+int
+os_shutdown (p)
+host_callback *p;
+{
+ int i;
+ for (i = 0; i < MAX_CALLBACK_FDS; i++)
+ {
+ if (p->fdopen[i] && !p->alwaysopen[i]) {
+ close (p->fdmap[i]);
+ p->fdopen[i] = 0;
+ }
+ }
+ return 1;
+}
+
+int os_init(p)
+host_callback *p;
+{
+ int i;
+ os_shutdown (p);
+ for (i= 0; i < 3; i++)
+ {
+ p->fdmap[i] = i;
+ p->fdopen[i] = 1;
+ p->alwaysopen[i] = 1;
+ }
+ return 1;
+}
+
+
+/* !!fixme!!
+ This bit is ugly. When the interface has settled down I'll
+ move the whole file into sim/common and remove this bit. */
+
+/* VARARGS */
+void
+#ifdef ANSI_PROTOTYPES
+os_printf_filtered (host_callback *p, char *format, ...)
+#else
+os_printf_filtered (p, va_alist)
+ host_callback *p;
+ va_dcl
+#endif
+{
+ va_list args;
+#ifdef ANSI_PROTOTYPES
+ va_start (args, format);
+#else
+ char *format;
+
+ va_start (args);
+ format = va_arg (args, char *);
+#endif
+
+#ifdef INSIDE_SIMULATOR
+ vprintf (format, args);
+#else
+ vfprintf_filtered (stdout, format, args);
+#endif
+
+ va_end (args);
+}
+
+host_callback default_callback =
+{
+ os_close,
+ os_get_errno,
+ os_isatty,
+ os_lseek,
+ os_open,
+ os_read,
+ os_read_stdin,
+ os_rename,
+ os_system,
+ os_time,
+ os_unlink,
+ os_write,
+ os_write_stdout,
+
+ os_shutdown,
+ os_init,
+
+ os_printf_filtered,
+
+ 0, /* last errno */
+};
--- /dev/null
+#ifndef CALLBACK_H
+#define CALLBACK_H
+typedef struct host_callback_struct host_callback;
+
+#define MAX_CALLBACK_FDS 10
+
+struct host_callback_struct
+{
+ int (*close) PARAMS ((host_callback *,int));
+ int (*get_errno) PARAMS ((host_callback *));
+ int (*isatty) PARAMS ((host_callback *, int));
+ int (*lseek) PARAMS ((host_callback *, int, long , int));
+ int (*open) PARAMS ((host_callback *, const char*, int mode));
+ int (*read) PARAMS ((host_callback *,int, char *, int));
+ int (*read_stdin) PARAMS (( host_callback *, char *, int));
+ int (*rename) PARAMS ((host_callback *, const char *, const char *));
+ int (*system) PARAMS ((host_callback *, const char *));
+ long (*time) PARAMS ((host_callback *, long *));
+ int (*unlink) PARAMS ((host_callback *, const char *));
+ int (*write) PARAMS ((host_callback *,int, const char *, int));
+ int (*write_stdout) PARAMS ((host_callback *, const char *, int));
+
+
+ /* Used when the target has gone away, so we can close open
+ handles and free memory etc etc. */
+ int (*shutdown) PARAMS ((host_callback *));
+ int (*init) PARAMS ((host_callback *));
+
+ /* Talk to the user on a console. */
+ void (*printf_filtered) PARAMS ((host_callback *, const char *, ...));
+
+ int last_errno; /* host format */
+
+ int fdmap[MAX_CALLBACK_FDS];
+ char fdopen[MAX_CALLBACK_FDS];
+ char alwaysopen[MAX_CALLBACK_FDS];
+};
+#endif
+
+
+extern host_callback default_callback;
# Host: Acorn RISC machine running RISCiX (4.3bsd)
-XDEPFILES= infptrace.o inftarg.o fork-child.o arm-xdep.o arm-convert.o
+XDEPFILES= infptrace.o inftarg.o fork-child.o arm-xdep.o arm-convert.o
XM_FILE= xm-arm.h
# Target: Acorn RISC machine (ARM) with simulator
-TDEPFILES= arm-tdep.o
+TDEPFILES= arm-tdep.o remote-rdp.o
TM_FILE= tm-arm.h
SIM_OBS = remote-sim.o
i386v32.mh
i386v4.mh
i386v4.mt
+i386win32.mh
linux.mh
linux.mt
nbsd.mh
xm-i386v.h
xm-i386v32.h
xm-i386v4.h
+xm-i386win32.h
xm-linux.h
xm-nbsd.h
xm-ptx.h
--- /dev/null
+MH_CFLAGS=
+XDEPFILES=
+XM_FILE=xm-i386win32.h
+TERMCAP=
+
+
--- /dev/null
+/* Definitions for hosting on WIN32, for GDB.
+ Copyright 1995 Free Software Foundation, Inc.
+
+This file is part of GDB.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#define HOST_BYTE_ORDER LITTLE_ENDIAN
+
+#include "fopen-bin.h"
+
+#define CANT_FORK
+
+
+#define GDBINIT_FILENAME "gdb.ini"
+
+#define SLASH_P(X) ((X)=='\\' || (X) == '/')
+#define ROOTED_P(X) ((SLASH_P((X)[0]))|| ((X)[1] ==':'))
+#define SLASH_CHAR '/'
+#define SLASH_STRING "/"
+
+/* If we longjmp out of the signal handler we never get another one.
+ So disable immediate_quit inside request_quit */
+#define REQUEST_QUIT
+
+
+
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated automatically using autoconf version 2.3
+# Generated automatically using autoconf version 2.4.2
# Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
#
# This configure script is free software; the Free Software Foundation
verbose=
x_includes=NONE
x_libraries=NONE
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datadir='${prefix}/share'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+libdir='${exec_prefix}/lib'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+infodir='${prefix}/info'
+mandir='${prefix}/man'
# Initialize some other variables.
subdirs=
case "$ac_option" in
- -build | --build | --buil | --bui | --bu | --b)
+ -bindir | --bindir | --bindi | --bind | --bin | --bi)
+ ac_prev=bindir ;;
+ -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+ bindir="$ac_optarg" ;;
+
+ -build | --build | --buil | --bui | --bu)
ac_prev=build ;;
- -build=* | --build=* | --buil=* | --bui=* | --bu=* | --b=*)
+ -build=* | --build=* | --buil=* | --bui=* | --bu=*)
build="$ac_optarg" ;;
-cache-file | --cache-file | --cache-fil | --cache-fi \
| --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
cache_file="$ac_optarg" ;;
+ -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
+ ac_prev=datadir ;;
+ -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
+ | --da=*)
+ datadir="$ac_optarg" ;;
+
-disable-* | --disable-*)
ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
# Reject names that are not valid shell variable names.
Directory and file names:
--prefix=PREFIX install architecture-independent files in PREFIX
[$ac_default_prefix]
- --exec-prefix=PREFIX install architecture-dependent files in PREFIX
+ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
[same as prefix]
+ --bindir=DIR user executables in DIR [EPREFIX/bin]
+ --sbindir=DIR system admin executables in DIR [EPREFIX/sbin]
+ --libexecdir=DIR program executables in DIR [EPREFIX/libexec]
+ --datadir=DIR read-only architecture-independent data in DIR [PREFIX/share]
+ --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc]
+ --sharedstatedir=DIR modifiable architecture-independent data in DIR [PREFIX/com]
+ --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var]
+ --libdir=DIR object code libraries in DIR [EPREFIX/lib]
+ --includedir=DIR C header files in DIR [PREFIX/include]
+ --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include]
+ --infodir=DIR info documentation in DIR [PREFIX/info]
+ --mandir=DIR man documentation in DIR [PREFIX/man]
--srcdir=DIR find the sources in DIR [configure dir or ..]
--program-prefix=PREFIX prepend PREFIX to installed program names
--program-suffix=SUFFIX append SUFFIX to installed program names
--program-transform-name=PROGRAM run sed PROGRAM on installed program names
+EOF
+ cat << EOF
Host type:
--build=BUILD configure for building on BUILD [BUILD=HOST]
--host=HOST configure for HOST [guessed]
-host=* | --host=* | --hos=* | --ho=*)
host="$ac_optarg" ;;
+ -includedir | --includedir | --includedi | --included | --include \
+ | --includ | --inclu | --incl | --inc)
+ ac_prev=includedir ;;
+ -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+ | --includ=* | --inclu=* | --incl=* | --inc=*)
+ includedir="$ac_optarg" ;;
+
+ -infodir | --infodir | --infodi | --infod | --info | --inf)
+ ac_prev=infodir ;;
+ -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+ infodir="$ac_optarg" ;;
+
+ -libdir | --libdir | --libdi | --libd)
+ ac_prev=libdir ;;
+ -libdir=* | --libdir=* | --libdi=* | --libd=*)
+ libdir="$ac_optarg" ;;
+
+ -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+ | --libexe | --libex | --libe)
+ ac_prev=libexecdir ;;
+ -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+ | --libexe=* | --libex=* | --libe=*)
+ libexecdir="$ac_optarg" ;;
+
+ -localstatedir | --localstatedir | --localstatedi | --localstated \
+ | --localstate | --localstat | --localsta | --localst \
+ | --locals | --local | --loca | --loc | --lo)
+ ac_prev=localstatedir ;;
+ -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+ | --localstate=* | --localstat=* | --localsta=* | --localst=* \
+ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
+ localstatedir="$ac_optarg" ;;
+
+ -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+ ac_prev=mandir ;;
+ -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+ mandir="$ac_optarg" ;;
+
-nfp | --nfp | --nf)
# Obsolete; use --without-fp.
with_fp=no ;;
| --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
no_recursion=yes ;;
+ -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+ | --oldin | --oldi | --old | --ol | --o)
+ ac_prev=oldincludedir ;;
+ -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+ oldincludedir="$ac_optarg" ;;
+
-prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
ac_prev=prefix ;;
-prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
| -silent | --silent | --silen | --sile | --sil)
silent=yes ;;
+ -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+ ac_prev=sbindir ;;
+ -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+ | --sbi=* | --sb=*)
+ sbindir="$ac_optarg" ;;
+
+ -sharedstatedir | --sharedstatedir | --sharedstatedi \
+ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+ | --sharedst | --shareds | --shared | --share | --shar \
+ | --sha | --sh)
+ ac_prev=sharedstatedir ;;
+ -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+ | --sha=* | --sh=*)
+ sharedstatedir="$ac_optarg" ;;
+
-site | --site | --sit)
ac_prev=site ;;
-site=* | --site=* | --sit=*)
-srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
srcdir="$ac_optarg" ;;
+ -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+ | --syscon | --sysco | --sysc | --sys | --sy)
+ ac_prev=sysconfdir ;;
+ -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+ sysconfdir="$ac_optarg" ;;
+
-target | --target | --targe | --targ | --tar | --ta | --t)
ac_prev=target ;;
-target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
verbose=yes ;;
-version | --version | --versio | --versi | --vers)
- echo "configure generated by autoconf version 2.3"
+ echo "configure generated by autoconf version 2.4.2"
exit 0 ;;
-with-* | --with-*)
ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5 2>&5'
-ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5 2>&5'
+ac_cpp='echo $CPP $CPPFLAGS 1>&5;
+$CPP $CPPFLAGS'
+ac_compile='echo ${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5;
+${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5 2>&5'
+ac_link='echo ${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5;
+${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5 2>&5'
if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
# Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
ac_cv_prog_gcc=no
fi
fi
+
echo "$ac_t""$ac_cv_prog_gcc" 1>&6
if test $ac_cv_prog_gcc = yes; then
GCC=yes
rm -f conftest*
fi
- echo "$ac_t""$ac_cv_prog_gcc_g" 1>&6
+
+echo "$ac_t""$ac_cv_prog_gcc_g" 1>&6
if test $ac_cv_prog_gcc_g = yes; then
CFLAGS="-g -O"
else
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp.
cat > conftest.$ac_ext <<EOF
-#line 498 "configure"
+#line 611 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
-#line 512 "configure"
+#line 625 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
rm -f conftest*
ac_cv_prog_CPP="$CPP"
fi
+ CPP="$ac_cv_prog_CPP"
+else
+ ac_cv_prog_CPP="$CPP"
fi
-CPP="$ac_cv_prog_CPP"
echo "$ac_t""$CPP" 1>&6
echo $ac_n "checking for AIX""... $ac_c" 1>&6
cat > conftest.$ac_ext <<EOF
-#line 537 "configure"
+#line 652 "configure"
#include "confdefs.h"
#ifdef _AIX
yes
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 564 "configure"
+#line 679 "configure"
#include "confdefs.h"
#include <minix/config.h>
EOF
esac
done
IFS="$ac_save_ifs"
- # As a last resort, use the slow shell script.
- test -z "$ac_cv_path_install" && ac_cv_path_install="$ac_install_sh"
+
fi
- INSTALL="$ac_cv_path_install"
+ if test "${ac_cv_path_install+set}" = set; then
+ INSTALL="$ac_cv_path_install"
+ else
+ # As a last resort, use the slow shell script. We don't cache a
+ # path for INSTALL within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the path is relative.
+ INSTALL="$ac_install_sh"
+ fi
fi
echo "$ac_t""$INSTALL" 1>&6
ac_cv_c_cross=yes
else
cat > conftest.$ac_ext <<EOF
-#line 856 "configure"
+#line 978 "configure"
#include "confdefs.h"
main(){return(0);}
EOF
fi
rm -fr conftest*
fi
-cross_compiling=$ac_cv_c_cross
+
echo "$ac_t""$ac_cv_c_cross" 1>&6
+cross_compiling=$ac_cv_c_cross
echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 877 "configure"
+#line 1000 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
if test $ac_cv_header_stdc = yes; then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
-#line 899 "configure"
+#line 1022 "configure"
#include "confdefs.h"
#include <string.h>
EOF
if test $ac_cv_header_stdc = yes; then
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
-#line 917 "configure"
+#line 1040 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
ac_cv_header_stdc=no
else
cat > conftest.$ac_ext <<EOF
-#line 938 "configure"
+#line 1061 "configure"
#include "confdefs.h"
#include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
rm -fr conftest*
fi
fi
+
echo "$ac_t""$ac_cv_header_stdc" 1>&6
if test $ac_cv_header_stdc = yes; then
cat >> confdefs.h <<\EOF
fi
-for ac_hdr in memory.h string.h strings.h unistd.h
+for ac_hdr in memory.h string.h strings.h unistd.h termios.h termio.h sgtty.h
do
ac_safe=`echo "$ac_hdr" | tr './\055' '___'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 975 "configure"
+#line 1099 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
fi
if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
echo "$ac_t""yes" 1>&6
- ac_tr_hdr=HAVE_`echo $ac_hdr | tr '[a-z]./\055' '[A-Z]___'`
+ ac_tr_hdr=HAVE_`echo $ac_hdr | tr 'abcdedfghijklmnopqrstuvwxyz./\055' 'ABCDEDFGHIJKLMNOPQRSTUVWXYZ___'`
cat >> confdefs.h <<EOF
#define $ac_tr_hdr 1
EOF
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1008 "configure"
+#line 1132 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/stat.h>
rm -f conftest*
fi
+
echo "$ac_t""$ac_cv_header_stat_broken" 1>&6
if test $ac_cv_header_stat_broken = yes; then
cat >> confdefs.h <<\EOF
ac_cv_func_mmap=no
else
cat > conftest.$ac_ext <<EOF
-#line 1066 "configure"
+#line 1191 "configure"
#include "confdefs.h"
/* Thanks to Mike Haertel and Jim Avera for this test. */
fi
rm -fr conftest*
fi
+
echo "$ac_t""$ac_cv_func_mmap" 1>&6
if test $ac_cv_func_mmap = yes; then
cat >> confdefs.h <<\EOF
ENABLE_OBS=
# Check whether --enable-netrom or --disable-netrom was given.
-enableval="$enable_netrom"
-if test -n "$enableval"; then
+if test "${enable_netrom+set}" = set; then
+ enableval="$enable_netrom"
case "${enableval}" in
yes) enable_netrom=yes ;;
no) enable_netrom=no ;;
ENABLE_GDBTK=
# Check whether --enable-gdbtk or --disable-gdbtk was given.
-enableval="$enable_gdbtk"
-if test -n "$enableval"; then
+if test "${enable_gdbtk+set}" = set; then
+ enableval="$enable_gdbtk"
case "${enableval}" in
yes) enable_gdbtk=yes ;;
no) enable_gdbtk=no ;;
echo $ac_n "checking for X""... $ac_c" 1>&6
# Check whether --with-x or --without-x was given.
-withval="$with_x"
-if test -n "$withval"; then
+if test "${with_x+set}" = set; then
+ withval="$with_x"
:
fi
# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
eval `make acfindx 2>/dev/null | grep -v make`
# Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR.
- if test ! -f $ac_im_usrlibdir/libX11.a && test -f $ac_im_libdir/libX11.a
- then
- ac_im_usrlibdir=$ac_im_libdir
- fi
+ for ac_extension in a so sl; do
+ if test ! -f $ac_im_usrlibdir/libX11.$ac_extension &&
+ test -f $ac_im_libdir/libX11.$ac_extension; then
+ ac_im_usrlibdir=$ac_im_libdir; break
+ fi
+ done
# Screen out bogus values from the imake configuration.
case "$ac_im_incroot" in
/usr/include) ;;
test -z "$x_direct_test_function" && x_direct_test_function=XtMalloc
test -z "$x_direct_test_include" && x_direct_test_include=X11/Intrinsic.h
cat > conftest.$ac_ext <<EOF
-#line 1252 "configure"
+#line 1380 "configure"
#include "confdefs.h"
#include <$x_direct_test_include>
EOF
ac_save_LIBS="$LIBS"
LIBS="-l$x_direct_test_library $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1315 "configure"
+#line 1443 "configure"
#include "confdefs.h"
int main() { return 0; }
# libraries we check for below, so use a different variable.
# --interran@uluru.Stanford.EDU, kb@cs.umb.edu.
echo $ac_n "checking for -lICE""... $ac_c" 1>&6
-if eval "test \"`echo '$''{'ac_cv_lib_ICE'+set}'`\" = set"; then
+ac_lib_var=`echo ICE | tr '+./' 'p__'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_save_LIBS="$LIBS"
LIBS="-lICE $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1433 "configure"
+#line 1562 "configure"
#include "confdefs.h"
int main() { return 0; }
EOF
if eval $ac_link; then
rm -rf conftest*
- eval "ac_cv_lib_ICE=yes"
+ eval "ac_cv_lib_$ac_lib_var=yes"
else
rm -rf conftest*
- eval "ac_cv_lib_ICE=no"
+ eval "ac_cv_lib_$ac_lib_var=no"
fi
rm -f conftest*
LIBS="$ac_save_LIBS"
fi
-if eval "test \"`echo '$ac_cv_lib_'ICE`\" = yes"; then
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
echo "$ac_t""yes" 1>&6
X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE"
else
# libraries were built with DECnet support. And karl@cs.umb.edu says
# the Alpha needs dnet_stub (dnet does not exist).
echo $ac_n "checking for -ldnet""... $ac_c" 1>&6
-if eval "test \"`echo '$''{'ac_cv_lib_dnet'+set}'`\" = set"; then
+ac_lib_var=`echo dnet | tr '+./' 'p__'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_save_LIBS="$LIBS"
LIBS="-ldnet $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1476 "configure"
+#line 1606 "configure"
#include "confdefs.h"
int main() { return 0; }
EOF
if eval $ac_link; then
rm -rf conftest*
- eval "ac_cv_lib_dnet=yes"
+ eval "ac_cv_lib_$ac_lib_var=yes"
else
rm -rf conftest*
- eval "ac_cv_lib_dnet=no"
+ eval "ac_cv_lib_$ac_lib_var=no"
fi
rm -f conftest*
LIBS="$ac_save_LIBS"
fi
-if eval "test \"`echo '$ac_cv_lib_'dnet`\" = yes"; then
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
echo "$ac_t""yes" 1>&6
X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet"
else
if test $ac_cv_lib_dnet = no; then
echo $ac_n "checking for -ldnet_stub""... $ac_c" 1>&6
-if eval "test \"`echo '$''{'ac_cv_lib_dnet_stub'+set}'`\" = set"; then
+ac_lib_var=`echo dnet_stub | tr '+./' 'p__'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_save_LIBS="$LIBS"
LIBS="-ldnet_stub $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1510 "configure"
+#line 1641 "configure"
#include "confdefs.h"
int main() { return 0; }
EOF
if eval $ac_link; then
rm -rf conftest*
- eval "ac_cv_lib_dnet_stub=yes"
+ eval "ac_cv_lib_$ac_lib_var=yes"
else
rm -rf conftest*
- eval "ac_cv_lib_dnet_stub=no"
+ eval "ac_cv_lib_$ac_lib_var=no"
fi
rm -f conftest*
LIBS="$ac_save_LIBS"
fi
-if eval "test \"`echo '$ac_cv_lib_'dnet_stub`\" = yes"; then
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
echo "$ac_t""yes" 1>&6
X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub"
else
# Not sure which flavor of 386 UNIX this is, but it seems harmless to
# check for it.
echo $ac_n "checking for -lnsl""... $ac_c" 1>&6
-if eval "test \"`echo '$''{'ac_cv_lib_nsl'+set}'`\" = set"; then
+ac_lib_var=`echo nsl | tr '+./' 'p__'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_save_LIBS="$LIBS"
LIBS="-lnsl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1549 "configure"
+#line 1681 "configure"
#include "confdefs.h"
int main() { return 0; }
EOF
if eval $ac_link; then
rm -rf conftest*
- eval "ac_cv_lib_nsl=yes"
+ eval "ac_cv_lib_$ac_lib_var=yes"
else
rm -rf conftest*
- eval "ac_cv_lib_nsl=no"
+ eval "ac_cv_lib_$ac_lib_var=no"
fi
rm -f conftest*
LIBS="$ac_save_LIBS"
fi
-if eval "test \"`echo '$ac_cv_lib_'nsl`\" = yes"; then
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
echo "$ac_t""yes" 1>&6
X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl"
else
# But -lsocket is broken on IRIX, according to simon@lia.di.epfl.ch.
if test "`(uname) 2>/dev/null`" != IRIX; then
echo $ac_n "checking for -lsocket""... $ac_c" 1>&6
-if eval "test \"`echo '$''{'ac_cv_lib_socket'+set}'`\" = set"; then
+ac_lib_var=`echo socket | tr '+./' 'p__'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_save_LIBS="$LIBS"
LIBS="-lsocket $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1587 "configure"
+#line 1720 "configure"
#include "confdefs.h"
int main() { return 0; }
EOF
if eval $ac_link; then
rm -rf conftest*
- eval "ac_cv_lib_socket=yes"
+ eval "ac_cv_lib_$ac_lib_var=yes"
else
rm -rf conftest*
- eval "ac_cv_lib_socket=no"
+ eval "ac_cv_lib_$ac_lib_var=no"
fi
rm -f conftest*
LIBS="$ac_save_LIBS"
fi
-if eval "test \"`echo '$ac_cv_lib_'socket`\" = yes"; then
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
echo "$ac_t""yes" 1>&6
X_EXTRA_LIBS="$X_EXTRA_LIBS -lsocket"
else
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1644 "configure"
+#line 1777 "configure"
#include "confdefs.h"
#include <tk.h>
EOF
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1746 "configure"
+#line 1879 "configure"
#include "confdefs.h"
#include <tclInt.h>
EOF
i[345]86-*-sysv*) gdb_host=i386v ;;
i[345]86-*-isc*) gdb_host=i386v32 ;;
i[345]86-*-os9k) gdb_host=i386os9k ;;
-
+i[345]86-*-win32*) gdb_host=i386win32 ;;
m680[01]0-sun-sunos3*) gdb_host=sun2os3 ;;
m680[01]0-sun-sunos4*) gdb_host=sun2os4 ;;
m68030-sony-*) gdb_host=news1000 ;;
mips*-dec-*) gdb_target=decstation ;;
mips64*el-*-ecoff*) gdb_target=idtl64 ;;
mips64*-idt-ecoff*) gdb_target=idt64 ;;
-# CYGNUS LOCAL jsmith
-mips64*vr4300*el-*-elf*) gdb_target=vr4300el ;;
-mips64*vr4300*-*-elf*) gdb_target=vr4300 ;;
-# END CYGNUS LOCAL
mips64*el-*-elf*) gdb_target=idtl64 ;;
mips64*-*-elf*) gdb_target=idt64 ;;
mips*el-*-ecoff*) gdb_target=idtl ;;
echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
-version | --version | --versio | --versi | --vers | --ver | --ve | --v)
- echo "$CONFIG_STATUS generated by autoconf version 2.3"
+ echo "$CONFIG_STATUS generated by autoconf version 2.4.2"
exit 0 ;;
-help | --help | --hel | --he | --h)
echo "\$ac_cs_usage"; exit 0 ;;
s%@exec_prefix@%$exec_prefix%g
s%@prefix@%$prefix%g
s%@program_transform_name@%$program_transform_name%g
+s%@bindir@%$bindir%g
+s%@sbindir@%$sbindir%g
+s%@libexecdir@%$libexecdir%g
+s%@datadir@%$datadir%g
+s%@sysconfdir@%$sysconfdir%g
+s%@sharedstatedir@%$sharedstatedir%g
+s%@localstatedir@%$localstatedir%g
+s%@libdir@%$libdir%g
+s%@includedir@%$includedir%g
+s%@oldincludedir@%$oldincludedir%g
+s%@infodir@%$infodir%g
+s%@mandir@%$mandir%g
s%@CC@%$CC%g
s%@CPP@%$CPP%g
s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
AC_ARG_PROGRAM
AC_HEADER_STDC
-AC_CHECK_HEADERS(memory.h string.h strings.h unistd.h)
+AC_CHECK_HEADERS(memory.h string.h strings.h unistd.h termios.h termio.h sgtty.h)
AC_HEADER_STAT
AC_FUNC_MMAP
i[345]86-*-sysv*) gdb_host=i386v ;;
i[345]86-*-isc*) gdb_host=i386v32 ;;
i[345]86-*-os9k) gdb_host=i386os9k ;;
-
+i[345]86-*-win32*) gdb_host=i386win32 ;;
m680[01]0-sun-sunos3*) gdb_host=sun2os3 ;;
m680[01]0-sun-sunos4*) gdb_host=sun2os4 ;;
m68030-sony-*) gdb_host=news1000 ;;
hms_insert_breakpoint, hms_remove_breakpoint, /* Breakpoints */
0, 0, 0, 0, 0, /* Terminal handling */
hms_kill, /* FIXME, kill */
- gr_load_image,
+ generic_load,
0, /* lookup_symbol */
hms_create_inferior, /* create_inferior */
hms_mourn, /* mourn_inferior FIXME */
--- /dev/null
+/* Remote debugging for the ARM RDP interface.
+ Copyright 1994, 1995 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.
+
+
+ */
+
+
+/*
+ Much of this file (in particular the SWI stuff) is based on code by
+ David Taylor (djt1000@uk.ac.cam.hermes).
+
+ I hacked on and simplified it by removing a lot of sexy features he
+ had added, and some of the (unix specific) workarounds he'd done
+ for other GDB problems - which if they still exist should be fixed
+ in GDB, not in a remote-foo thing . I also made it conform more to
+ the doc I have; which may be wrong.
+
+ Steve Chamberlain (sac@cygnus.com).
+ */
+
+
+#include "defs.h"
+#include "inferior.h"
+#include "wait.h"
+#include "value.h"
+#include "callback.h"
+#include "command.h"
+#ifdef ANSI_PROTOTYPES
+#include <stdarg.h>
+#else
+#include <varargs.h>
+#endif
+
+#include <fcntl.h>
+#include "symfile.h"
+#include "remote-utils.h"
+
+extern struct target_ops remote_rdp_ops;
+static serial_t io;
+static host_callback *callback = &default_callback;
+
+struct
+{
+ int step_info;
+ int break_info;
+ int model_info;
+ int target_info;
+ int can_step;
+ char command_line[10];
+ int rdi_level;
+ int rdi_stopped_status;
+} ds;
+
+
+
+/* Definitions for the RDP protocol. */
+
+#define RDP_MOUTHFULL (1<<6)
+#define FPU_COPRO_NUMBER 1
+
+#define RDP_OPEN 0
+#define RDP_OPEN_TYPE_COLD 0
+#define RDP_OPEN_TYPE_WARM 1
+#define RDP_OPEN_TYPE_RETURN_SEX (1<<3)
+
+#define RDP_CLOSE 1
+
+#define RDP_MEM_READ 2
+
+#define RDP_MEM_WRITE 3
+
+#define RDP_CPU_READ 4
+#define RDP_CPU_WRITE 5
+#define RDP_CPU_READWRITE_MODE_CURRENT 255
+#define RDP_CPU_READWRITE_MASK_PC (1<<16)
+#define RDP_CPU_READWRITE_MASK_CPSR (1<<17)
+#define RDP_CPU_READWRITE_MASK_SPSR (1<<18)
+
+#define RDP_COPRO_READ 6
+#define RDP_COPRO_WRITE 7
+#define RDP_FPU_READWRITE_MASK_FPS (1<<8)
+
+#define RDP_SET_BREAK 0xa
+#define RDP_SET_BREAK_TYPE_PC_EQUAL 0
+#define RDP_SET_BREAK_TYPE_GET_HANDLE (0x10)
+
+#define RDP_CLEAR_BREAK 0xb
+
+#define RDP_EXEC 0x10
+#define RDP_EXEC_TYPE_SYNC 0
+
+#define RDP_STEP 0x11
+
+#define RDP_INFO 0x12
+#define RDP_INFO_ABOUT_STEP 2
+#define RDP_INFO_ABOUT_STEP_GT_1 1
+#define RDP_INFO_ABOUT_STEP_TO_JMP 2
+#define RDP_INFO_ABOUT_STEP_1 4
+#define RDP_INFO_ABOUT_TARGET 0
+#define RDP_INFO_ABOUT_BREAK 1
+#define RDP_INFO_ABOUT_BREAK_COMP 1
+#define RDP_INFO_ABOUT_BREAK_RANGE 2
+#define RDP_INFO_ABOUT_BREAK_BYTE_READ 4
+#define RDP_INFO_ABOUT_BREAK_HALFWORD_READ 8
+#define RDP_INFO_ABOUT_BREAK_WORD_READ (1<<4)
+#define RDP_INFO_ABOUT_BREAK_BYTE_WRITE (1<<5)
+#define RDP_INFO_ABOUT_BREAK_HALFWORD_WRITE (1<<6)
+#define RDP_INFO_ABOUT_BREAK_WORD_WRITE (1<<7)
+#define RDP_INFO_ABOUT_BREAK_MASK (1<<8)
+#define RDP_INFO_ABOUT_BREAK_THREAD_BREAK (1<<9)
+#define RDP_INFO_ABOUT_BREAK_THREAD_WATCH (1<<10)
+#define RDP_INFO_ABOUT_BREAK_COND (1<<11)
+
+#define RDP_RESET 0x7f
+
+/* Returns from RDP */
+#define RDP_RES_STOPPED 0x20
+#define RDP_RES_SWI 0x21
+#define RDP_RES_FATAL 0x5e
+#define RDP_RES_VALUE 0x5f
+#define RDP_RES_VALUE_LITTLE_ENDIAN 240
+#define RDP_RES_VALUE_BIG_ENDIAN 241
+#define RDP_RES_RESET 0x7f
+#define RDP_RES_AT_BREAKPOINT 143
+
+#define RDP_OSOpReply 0x13
+#define RDP_OSOpWord 2
+#define RDP_OSOpNothing 0
+
+static int timeout = 2;
+
+static int
+remote_rdp_xfer_inferior_memory PARAMS ((CORE_ADDR memaddr,
+ char *myaddr,
+ int len,
+ int write,
+ struct target_ops * target));
+
+
+/* Stuff for talking to the serial layer. */
+
+static unsigned char
+get_byte ()
+{
+ int c = SERIAL_READCHAR (io, timeout);
+
+ if (c == SERIAL_TIMEOUT)
+ {
+ if (timeout == 0)
+ return (unsigned char) c;
+
+ error ("Timeout reading from remote_system");
+ }
+
+ if (remote_debug)
+ printf ("[%02x]", c);
+ return c;
+}
+
+/* Note that the target always speaks little-endian to us,
+ even if it's a big endian machine. */
+static unsigned int
+get_word ()
+{
+ unsigned int val = 0;
+ unsigned int c;
+ int n;
+ for (n = 0; n < 4; n++)
+ {
+ c = get_byte ();
+ val |= c << (n * 8);
+ }
+ return val;
+}
+
+static void
+put_byte (val)
+ char val;
+{
+ SERIAL_WRITE (io, &val, 1);
+}
+
+static void
+put_word (val)
+ long val;
+{
+ /* We always send in little endian */
+ unsigned char b[4];
+ b[0] = val;
+ b[1] = val >> 8;
+ b[2] = val >> 16;
+ b[3] = val >> 24;
+
+ SERIAL_WRITE (io, b, 4);
+}
+
+
+
+/* Stuff for talking to the RDP layer. */
+
+
+/* This is a bit more fancy that need be so that it syncs even in nasty cases. */
+
+static void
+rdp_init ()
+{
+ int oloop;
+
+ for (oloop = 0; oloop < 2; oloop++)
+ {
+ int longtry;
+ SERIAL_FLUSH_INPUT (io);
+ for (longtry = 0; longtry < 2; longtry++)
+ {
+ int try;
+ int flush_and_retry = 0;
+
+ for (try = 0; try < 10 && !flush_and_retry; try++)
+ {
+ int restype;
+
+ put_byte (RDP_OPEN);
+ put_byte (RDP_OPEN_TYPE_COLD | RDP_OPEN_TYPE_RETURN_SEX);
+ put_word (0);
+
+ restype = SERIAL_READCHAR (io, 1);
+
+ switch (restype)
+ {
+ case SERIAL_TIMEOUT:
+ flush_and_retry = 1;
+ break;
+ case RDP_RESET:
+ return;
+ default:
+ printf_unfiltered ("Got res return %d\n", restype);
+ break;
+ case RDP_RES_VALUE:
+ {
+ int resval = SERIAL_READCHAR (io, 1);
+
+ switch (resval)
+ {
+ case SERIAL_TIMEOUT:
+ break;
+ case RDP_RES_VALUE_LITTLE_ENDIAN:
+ target_byte_order = LITTLE_ENDIAN;
+ return;
+ case RDP_RES_VALUE_BIG_ENDIAN:
+ target_byte_order = BIG_ENDIAN;
+ return;
+ default:
+ printf_unfiltered ("Trying to sync, got resval %d\n", resval);
+ }
+ }
+ }
+ }
+ }
+ }
+ error ("Couldn't reset the board, try pressing the reset button");
+}
+
+
+#ifdef ANSI_PROTOTYPES
+void
+send_rdp (char *template,...)
+#else
+void
+send_rdp (char *template, va_alist)
+ va_dcl
+#endif
+{
+ char buf[200];
+ char *dst = buf;
+ va_list alist;
+#ifdef ANSI_PROTOTYPES
+ va_start (alist, template);
+#else
+ va_start (alist);
+#endif
+
+ while (*template)
+ {
+ unsigned int val;
+ int *pi;
+ int *pstat;
+ char *pc;
+ int i;
+ switch (*template++)
+ {
+ case 'b':
+ val = va_arg (alist, int);
+ *dst++ = val;
+ break;
+ case 'w':
+ val = va_arg (alist, int);
+ *dst++ = val;
+ *dst++ = val >> 8;
+ *dst++ = val >> 16;
+ *dst++ = val >> 24;
+ break;
+ case 'S':
+ val = get_byte ();
+ if (val != RDP_RES_VALUE)
+ {
+ printf_unfiltered ("got bad res value of %d, %x\n", val, val);
+ }
+ break;
+ case 'V':
+ pstat = va_arg (alist, int *);
+ pi = va_arg (alist, int *);
+
+ *pstat = get_byte ();
+ /* Check the result was zero, if not read the syndrome */
+ if (*pstat)
+ {
+ *pi = get_word ();
+ }
+ break;
+ case 'Z':
+ /* Check the result code, error if not zero */
+ if (get_byte ())
+ error ("Command garbled");
+ break;
+ case 'W':
+ /* Read a word from the target */
+ pi = va_arg (alist, int *);
+ *pi = get_word ();
+ break;
+ case 'P':
+ /* Read in some bytes from the target. */
+ pc = va_arg (alist, char *);
+ val = va_arg (alist, int);
+ for (i = 0; i < val; i++)
+ {
+ pc[i] = get_byte ();
+ }
+ break;
+ case 'p':
+ /* send what's being pointed at */
+ pc = va_arg (alist, char *);
+ val = va_arg (alist, int);
+ dst = buf;
+ SERIAL_WRITE (io, pc, val);
+ break;
+ case '-':
+ /* Send whats in the queue */
+ if (dst != buf)
+ {
+ SERIAL_WRITE (io, buf, dst - buf);
+ dst = buf;
+ }
+ break;
+ case 'B':
+ pi = va_arg (alist, int *);
+ *pi = get_byte ();
+ break;
+ default:
+ abort ();
+ }
+ }
+ va_end (args);
+
+ if (dst != buf)
+ abort ();
+}
+
+
+static int
+rdp_write (memaddr, buf, len)
+ CORE_ADDR memaddr;
+ char *buf;
+ int len;
+{
+ int res;
+ int val;
+
+ send_rdp ("bww-p-SV", RDP_MEM_WRITE, memaddr, len, buf, len, &res, &val);
+
+ if (res)
+ {
+ return val;
+ }
+ return len;
+}
+
+
+static int
+rdp_read (memaddr, buf, len)
+ CORE_ADDR memaddr;
+ char *buf;
+ int len;
+{
+ int res;
+ int val;
+ send_rdp ("bww-S-P-V",
+ RDP_MEM_READ, memaddr, len,
+ buf, len,
+ &res, &val);
+ if (res)
+ {
+ return val;
+ }
+ return len;
+}
+
+static void
+rdp_fetch_one_register (mask, buf)
+ int mask;
+ char *buf;
+{
+ int val;
+ send_rdp ("bbw-SWZ", RDP_CPU_READ, RDP_CPU_READWRITE_MODE_CURRENT, mask, &val);
+ store_signed_integer (buf, 4, val);
+}
+
+static void
+rdp_fetch_one_fpu_register (mask, buf)
+ int mask;
+ char *buf;
+{
+#if 0
+ /* !!! Since the PIE board doesn't work as documented,
+ and it doesn't have FPU hardware anyway and since it
+ slows everything down, I've disabled this. */
+ int val;
+ if (mask == RDP_FPU_READWRITE_MASK_FPS)
+ {
+ /* this guy is only a word */
+ send_rdp ("bbw-SWZ", RDP_COPRO_READ, FPU_COPRO_NUMBER, mask, &val);
+ store_signed_integer (buf, 4, val);
+ }
+ else
+ {
+ /* There are 12 bytes long
+ !! fixme about endianness
+ */
+ int dummy; /* I've seen these come back as four words !! */
+ send_rdp ("bbw-SWWWWZ", RDP_COPRO_READ, FPU_COPRO_NUMBER, mask, buf + 0, buf + 4, buf + 8, &dummy);
+ }
+#endif
+ memset (buf, 0, MAX_REGISTER_RAW_SIZE);
+}
+
+
+static void
+rdp_store_one_register (mask, buf)
+ int mask;
+ char *buf;
+{
+ int val = extract_unsigned_integer (buf, 4);
+
+ send_rdp ("bbww-SZ",
+ RDP_CPU_WRITE, RDP_CPU_READWRITE_MODE_CURRENT, mask, val);
+}
+
+
+static void
+rdp_store_one_fpu_register (mask, buf)
+ int mask;
+ char *buf;
+{
+#if 0
+ /* See comment in fetch_one_fpu_register */
+ if (mask == RDP_FPU_READWRITE_MASK_FPS)
+ {
+ int val = extract_unsigned_integer (buf, 4);
+ /* this guy is only a word */
+ send_rdp ("bbww-SZ", RDP_COPRO_WRITE,
+ FPU_COPRO_NUMBER,
+ mask, val);
+ }
+ else
+ {
+ /* There are 12 bytes long
+ !! fixme about endianness
+ */
+ int dummy = 0;
+ /* I've seen these come as four words, not the three advertized !! */
+ printf ("Sending mask %x\n", mask);
+ send_rdp ("bbwwwww-SZ",
+ RDP_COPRO_WRITE,
+ FPU_COPRO_NUMBER,
+ mask,
+ *(int *) (buf + 0),
+ *(int *) (buf + 4),
+ *(int *) (buf + 8),
+ 0);
+
+ printf ("done mask %x\n", mask);
+ }
+#endif
+}
+
+\f
+/* Convert between GDB requests and the RDP layer. */
+
+static void
+remote_rdp_fetch_register (regno)
+ int regno;
+{
+ if (regno == -1)
+ {
+ for (regno = 0; regno < NUM_REGS; regno++)
+ remote_rdp_fetch_register (regno);
+ }
+ else
+ {
+ char buf[MAX_REGISTER_RAW_SIZE];
+ if (regno < 15)
+ rdp_fetch_one_register (1 << regno, buf);
+ else if (regno == PC_REGNUM)
+ rdp_fetch_one_register (RDP_CPU_READWRITE_MASK_PC, buf);
+ else if (regno == PS_REGNUM)
+ rdp_fetch_one_register (RDP_CPU_READWRITE_MASK_CPSR, buf);
+ else if (regno == FPS_REGNUM)
+ rdp_fetch_one_fpu_register (RDP_FPU_READWRITE_MASK_FPS, buf);
+ else if (regno >= F0_REGNUM && regno <= F7_REGNUM)
+ rdp_fetch_one_fpu_register (1 << (regno - F0_REGNUM), buf);
+ else
+ {
+ printf ("Help me with fetch reg %d\n", regno);
+ }
+ supply_register (regno, buf);
+ }
+}
+
+
+static void
+remote_rdp_store_register (regno)
+ int regno;
+{
+ if (regno == -1)
+ {
+ for (regno = 0; regno < NUM_REGS; regno++)
+ remote_rdp_store_register (regno);
+ }
+ else
+ {
+ char tmp[MAX_REGISTER_RAW_SIZE];
+ read_register_gen (regno, tmp);
+ if (regno < 15)
+ rdp_store_one_register (1 << regno, tmp);
+ else if (regno == PC_REGNUM)
+ rdp_store_one_register (RDP_CPU_READWRITE_MASK_PC, tmp);
+ else if (regno == PS_REGNUM)
+ rdp_store_one_register (RDP_CPU_READWRITE_MASK_CPSR, tmp);
+ else if (regno >= F0_REGNUM && regno <= F7_REGNUM)
+ rdp_store_one_fpu_register (1 << (regno - F0_REGNUM), tmp);
+ else
+ {
+ printf ("Help me with reg %d\n", regno);
+ }
+ }
+}
+
+static void
+remote_rdp_kill ()
+{
+ callback->shutdown (callback);
+}
+
+
+static void
+rdp_info ()
+{
+ send_rdp ("bw-S-W-Z", RDP_INFO, RDP_INFO_ABOUT_STEP,
+ &ds.step_info);
+ send_rdp ("bw-S-W-Z", RDP_INFO, RDP_INFO_ABOUT_BREAK,
+ &ds.break_info);
+ send_rdp ("bw-S-WW-Z", RDP_INFO, RDP_INFO_ABOUT_TARGET,
+ &ds.target_info,
+ &ds.model_info);
+
+ ds.can_step = ds.step_info & RDP_INFO_ABOUT_STEP_1;
+
+ ds.rdi_level = (ds.target_info >> 5) & 3;
+}
+
+
+static void
+rdp_execute_start ()
+{
+ /* Start it off, but don't wait for it */
+ send_rdp ("bb-", RDP_EXEC, RDP_EXEC_TYPE_SYNC);
+}
+
+
+
+#define a_byte 1
+#define a_word 2
+#define a_string 3
+
+
+typedef struct
+{
+ CORE_ADDR n;
+ const char *s;
+}
+argsin;
+
+#define ABYTE 1
+#define AWORD 2
+#define ASTRING 3
+#define ADDRLEN 4
+
+#define SWI_WriteC 0x0
+#define SWI_Write0 0x2
+#define SWI_ReadC 0x4
+#define SWI_CLI 0x5
+#define SWI_GetEnv 0x10
+#define SWI_Exit 0x11
+#define SWI_EnterOS 0x16
+
+#define SWI_GetErrno 0x60
+#define SWI_Clock 0x61
+
+#define SWI_Time 0x63
+#define SWI_Remove 0x64
+#define SWI_Rename 0x65
+#define SWI_Open 0x66
+
+#define SWI_Close 0x68
+#define SWI_Write 0x69
+#define SWI_Read 0x6a
+#define SWI_Seek 0x6b
+#define SWI_Flen 0x6c
+
+#define SWI_IsTTY 0x6e
+#define SWI_TmpNam 0x6f
+#define SWI_InstallHandler 0x70
+#define SWI_GenerateError 0x71
+
+
+static int
+exec_swi (swi, args)
+ int swi;
+ argsin *args;
+{
+ int i;
+ char c;
+ switch (swi)
+ {
+ case SWI_WriteC:
+ callback->write_stdout (callback, &c, 1);
+ return 0;
+ case SWI_Write0:
+ for (i = 0; i < args->n; i++)
+ callback->write_stdout (callback, args->s, strlen (args->s));
+ return 0;
+ case SWI_ReadC:
+ callback->read_stdin (callback, &c, 1);
+ args->n = c;
+ return 1;
+ case SWI_CLI:
+ args->n = callback->system (callback, args->s);
+ return 1;
+ case SWI_GetErrno:
+ args->n = callback->get_errno (callback);
+ return 1;
+ case SWI_Time:
+ args->n = callback->time (callback, NULL);
+ return 1;
+ case SWI_Remove:
+ args->n = callback->unlink (callback, args->s);
+ return 1;
+ case SWI_Rename:
+ args->n = callback->rename (callback, args[0].s, args[1].s);
+ return 1;
+ case SWI_Open:
+ i = 0;
+
+#ifdef O_BINARY
+ if (args[1].n & 1)
+ i |= O_BINARY;
+#endif
+ if (args[1].n & 2)
+ i |= O_RDWR;
+
+ if (args[1].n & 4)
+ {
+ i |= O_CREAT;
+ }
+
+ if (args[1].n & 8)
+ i |= O_APPEND;
+
+ args->n = callback->open (callback, args->s, i);
+ return 1;
+
+ case SWI_Close:
+ args->n = callback->close (callback, args->n);
+ return 1;
+
+ case SWI_Write:
+ args->n = callback->write (callback, args[0].n, args[1].s, args[1].n);
+ return 1;
+ case SWI_Read:
+ {
+ char *copy = alloca (args[2].n);
+ int done = callback->read (callback, args[0].n, copy, args[2].n);
+ if (done > 0)
+ remote_rdp_xfer_inferior_memory (args[0].n, copy, done, 1, 0);
+ args->n -= done;
+ return 1;
+ }
+
+ case SWI_Seek:
+ args->n = callback->lseek (callback, args[0].n, args[1].n, 0) >= 0;
+ return 1;
+ case SWI_Flen:
+ {
+ long old = callback->lseek (callback, args->n, 1, 1);
+ args->n = callback->lseek (callback, args->n, 2, 0);
+ callback->lseek (callback, args->n, old, 0);
+ return 1;
+ }
+
+ case SWI_IsTTY:
+ args->n = callback->isatty (callback, args->n);
+ return 1;
+
+ default:
+ return 0;
+ }
+}
+
+
+static void
+handle_swi ()
+{
+ argsin args[3];
+ char *buf;
+ int len;
+ int count = 0;
+
+ int swino = get_word ();
+ int type = get_byte ();
+ while (type != 0)
+ {
+ switch (type & 0x3)
+ {
+ case ABYTE:
+ args[count].n = get_byte ();
+ break;
+
+ case AWORD:
+ args[count].n = get_word ();
+ break;
+
+ case ASTRING:
+ /* If the word is under 32 bytes it will be sent otherwise
+ an address to it is passed. Also: Special case of 255 */
+
+ len = get_byte ();
+ if (len > 32)
+ {
+ if (len == 255)
+ {
+ len = get_word ();
+ }
+ buf = alloca (len);
+ remote_rdp_xfer_inferior_memory (get_word (),
+ buf,
+ len,
+ 0,
+ 0);
+ }
+ else
+ {
+ int i;
+ buf = alloca (len + 1);
+ for (i = 0; i < len; i++)
+ buf[i] = get_byte ();
+ buf[i] = 0;
+ }
+ args[count].n = len;
+ args[count].s = buf;
+ break;
+
+ default:
+ error ("Unimplented SWI argument");
+ }
+
+ type = type >> 2;
+ count++;
+ }
+
+ if (exec_swi (swino, args))
+ {
+ /* We have two options here reply with either a byte or a word
+ which is stored in args[0].n. There is no harm in replying with
+ a word all the time, so thats what I do! */
+ send_rdp ("bbw-", RDP_OSOpReply, RDP_OSOpWord, args[0].n);
+ }
+ else
+ {
+ send_rdp ("bb-", RDP_OSOpReply, RDP_OSOpNothing);
+ }
+}
+
+static void
+rdp_execute_finish ()
+{
+ int running = 1;
+
+ while (running)
+ {
+ int res;
+ res = SERIAL_READCHAR (io, 1);
+ while (res == SERIAL_TIMEOUT)
+ {
+ QUIT ;
+ printf_filtered ("Waiting for target..\n");
+ res = SERIAL_READCHAR (io, 1);
+ }
+
+ switch (res)
+ {
+ case RDP_RES_SWI:
+ handle_swi ();
+ break;
+ case RDP_RES_VALUE:
+ send_rdp ("B", &ds.rdi_stopped_status);
+ running = 0;
+ break;
+ case RDP_RESET:
+ printf_filtered ("Target reset\n");
+ running = 0;
+ break;
+ default:
+ printf_filtered ("Ignoring %x\n", res);
+ break;
+ }
+ }
+}
+
+
+static void
+rdp_execute ()
+{
+ rdp_execute_start ();
+ rdp_execute_finish ();
+}
+
+static int
+remote_rdp_insert_breakpoint (addr, save)
+ CORE_ADDR addr;
+ char *save;
+{
+ int res;
+ if (ds.rdi_level > 0)
+ {
+ send_rdp ("bwb-SWB",
+ RDP_SET_BREAK,
+ addr,
+ RDP_SET_BREAK_TYPE_PC_EQUAL | RDP_SET_BREAK_TYPE_GET_HANDLE,
+ save,
+ &res);
+ }
+ else
+ {
+ send_rdp ("bwb-SB",
+ RDP_SET_BREAK,
+ addr,
+ RDP_SET_BREAK_TYPE_PC_EQUAL,
+ &res);
+ }
+ return res;
+}
+
+static int
+remote_rdp_remove_breakpoint (addr, save)
+ CORE_ADDR addr;
+ char *save;
+{
+ int res;
+ if (ds.rdi_level > 0)
+ {
+ send_rdp ("b-p-S-B",
+ RDP_CLEAR_BREAK,
+ save, 4,
+ &res);
+ }
+ else
+ {
+ send_rdp ("bw-S-B",
+ RDP_CLEAR_BREAK,
+ addr,
+ &res);
+ }
+ return res;
+}
+
+static void
+rdp_step ()
+{
+ if (ds.can_step && 0)
+ {
+ /* The pie board can't do steps so I can't test this, and
+ the other code will always work. */
+ int status;
+ send_rdp ("bbw-S-B",
+ RDP_STEP, 0, 1,
+ &status);
+ }
+ else
+ {
+ char handle[4];
+ CORE_ADDR pc = read_register (PC_REGNUM);
+ pc = arm_get_next_pc (pc);
+ remote_rdp_insert_breakpoint (pc, &handle);
+ rdp_execute ();
+ remote_rdp_remove_breakpoint (pc, &handle);
+ }
+}
+
+static void
+remote_rdp_open (args, from_tty)
+ char *args;
+ int from_tty;
+{
+ if (!args)
+ error_no_arg ("serial port device name");
+
+ target_preopen (from_tty);
+
+ io = SERIAL_OPEN (args);
+
+ if (!io)
+ perror_with_name (args);
+
+ SERIAL_RAW (io);
+
+ rdp_init ();
+
+ rdp_info ();
+ if (from_tty)
+ {
+ printf_unfiltered ("Remote RDP debugging using %s\n", args);
+ }
+
+ push_target (&remote_rdp_ops);
+
+ callback->init (callback);
+ flush_cached_frames ();
+ registers_changed ();
+ stop_pc = read_pc ();
+ set_current_frame (create_new_frame (read_fp (), stop_pc));
+ select_frame (get_current_frame (), 0);
+ print_stack_frame (selected_frame, -1, 1);
+}
+
+
+
+/* Close out all files and local state before this target loses control. */
+
+static void
+remote_rdp_close (quitting)
+ int quitting;
+{
+ callback->shutdown (callback);
+ SERIAL_CLOSE (io);
+}
+
+/* Terminate the open connection to the remote debugger. */
+
+static void
+remote_rdp_detach (args, from_tty)
+ char *args;
+ int from_tty;
+{
+ pop_target ();
+}
+
+/* Resume execution of the target process. STEP says whether to single-step
+ or to run free; SIGGNAL is the signal value (e.g. SIGINT) to be given
+ to the target, or zero for no signal. */
+
+static void
+remote_rdp_resume (pid, step, siggnal)
+ int pid, step;
+ enum target_signal siggnal;
+{
+ if (step)
+ rdp_step ();
+ else
+ rdp_execute ();
+}
+
+/* Wait for inferior process to do something. Return pid of child,
+ or -1 in case of error; store status through argument pointer STATUS,
+ just as `wait' would. */
+
+static int
+remote_rdp_wait (pid, status)
+ int pid;
+ struct target_waitstatus *status;
+{
+ switch (ds.rdi_stopped_status)
+ {
+ default:
+ case RDP_RES_RESET:
+ case RDP_RES_SWI:
+ status->kind = TARGET_WAITKIND_EXITED;
+ status->value.integer = read_register (0);
+ break;
+ case RDP_RES_AT_BREAKPOINT:
+ status->kind = TARGET_WAITKIND_STOPPED;
+ /* The signal in sigrc is a host signal. That probably
+ should be fixed. */
+ status->value.sig = TARGET_SIGNAL_TRAP;
+ break;
+#if 0
+ case rdp_signalled:
+ status->kind = TARGET_WAITKIND_SIGNALLED;
+ /* The signal in sigrc is a host signal. That probably
+ should be fixed. */
+ status->value.sig = target_signal_from_host (sigrc);
+ break;
+#endif
+ }
+
+ return inferior_pid;
+}
+
+/* Get ready to modify the registers array. On machines which store
+ individual registers, this doesn't need to do anything. On machines
+ which store all the registers in one fell swoop, this makes sure
+ that registers contains all the registers from the program being
+ debugged. */
+
+static void
+remote_rdp_prepare_to_store ()
+{
+ /* Do nothing, since we can store individual regs */
+}
+
+static int
+remote_rdp_xfer_inferior_memory (memaddr, myaddr, len, write, target)
+ CORE_ADDR memaddr;
+ char *myaddr;
+ int len;
+ int write;
+ struct target_ops *target; /* ignored */
+{
+ /* I infer from D Taylor's code that there's a limit on the amount
+ we can transfer in one chunk.. */
+ int done = 0;
+ while (done < len)
+ {
+ int justdone;
+ int thisbite = len - done;
+ if (thisbite > RDP_MOUTHFULL)
+ thisbite = RDP_MOUTHFULL;
+
+ QUIT;
+
+ if (write)
+ {
+ justdone = rdp_write (memaddr + done, myaddr + done, thisbite);
+ }
+ else
+ {
+ justdone = rdp_read (memaddr + done, myaddr + done, thisbite);
+ }
+
+ done += justdone;
+
+ if (justdone != thisbite)
+ break;
+ }
+ return done;
+}
+
+
+
+struct yn
+{
+ const char *name;
+ int bit;
+};
+static struct yn stepinfo[] =
+{
+ {"Step more than one instruction", RDP_INFO_ABOUT_STEP_GT_1},
+ {"Step to jump", RDP_INFO_ABOUT_STEP_TO_JMP},
+ {"Step one instruction", RDP_INFO_ABOUT_STEP_1},
+ {0}
+};
+
+static struct yn breakinfo[] =
+{
+ {"comparison breakpoints supported", RDP_INFO_ABOUT_BREAK_COMP},
+ {"range breakpoints supported", RDP_INFO_ABOUT_BREAK_RANGE},
+ {"watchpoints for byte reads supported", RDP_INFO_ABOUT_BREAK_BYTE_READ},
+ {"watchpoints for half-word reads supported", RDP_INFO_ABOUT_BREAK_HALFWORD_READ},
+ {"watchpoints for word reads supported", RDP_INFO_ABOUT_BREAK_WORD_READ},
+ {"watchpoints for byte writes supported", RDP_INFO_ABOUT_BREAK_BYTE_WRITE},
+ {"watchpoints for half-word writes supported", RDP_INFO_ABOUT_BREAK_HALFWORD_WRITE},
+ {"watchpoints for word writes supported", RDP_INFO_ABOUT_BREAK_WORD_WRITE},
+ {"mask break/watch-points supported", RDP_INFO_ABOUT_BREAK_MASK},
+ {"thread-specific breakpoints supported", RDP_INFO_ABOUT_BREAK_THREAD_BREAK},
+ {"thread-specific watchpoints supported", RDP_INFO_ABOUT_BREAK_THREAD_WATCH},
+ {"conditional breakpoints supported", RDP_INFO_ABOUT_BREAK_COND},
+ {0}
+};
+
+
+static void
+dump_bits (t, info)
+ struct yn *t;
+ int info;
+{
+ while (t->name)
+ {
+ printf_unfiltered (" %-45s : %s\n", t->name, (info & t->bit) ? "Yes" : "No");
+ t++;
+ }
+}
+
+static void
+remote_rdp_files_info (target)
+ struct target_ops *target;
+{
+ printf_filtered ("Target capabilities:\n");
+ dump_bits (stepinfo, ds.step_info);
+ dump_bits (breakinfo, ds.break_info);
+ printf_unfiltered ("target level RDI %x\n", (ds.target_info >> 5) & 3);
+}
+
+
+/* Define the target subroutine names */
+
+struct target_ops remote_rdp_ops =
+{
+ "rdp", /* to_shortname */
+ /* to_longname */
+ "Remote Target using the RDProtocol",
+ /* to_doc */
+ "Use a remote ARM system which uses the ARM Remote Debugging Protocol",
+ remote_rdp_open, /* to_open */
+ remote_rdp_close, /* to_close */
+ NULL, /* to_attach */
+ NULL, /* to_detach */
+ remote_rdp_resume, /* to_resume */
+ remote_rdp_wait, /* to_wait */
+ remote_rdp_fetch_register, /* to_fetch_registers */
+ remote_rdp_store_register, /* to_store_registers */
+ remote_rdp_prepare_to_store, /* to_prepare_to_store */
+ remote_rdp_xfer_inferior_memory, /* to_xfer_memory */
+ remote_rdp_files_info, /* to_files_info */
+ remote_rdp_insert_breakpoint, /* to_insert_breakpoint */
+ remote_rdp_remove_breakpoint, /* to_remove_breakpoint */
+ NULL, /* to_terminal_init */
+ NULL, /* to_terminal_inferior */
+ NULL, /* to_terminal_ours_for_output */
+ NULL, /* to_terminal_ours */
+ NULL, /* to_terminal_info */
+ remote_rdp_kill, /* to_kill */
+ generic_load, /* to_load */
+ NULL, /* to_lookup_symbol */
+ NULL, /* to_create_inferior */
+ generic_mourn_inferior, /* to_mourn_inferior */
+ 0, /* to_can_run */
+ 0, /* to_notice_signals */
+ 0, /* to_thread_alive */
+ 0, /* to_stop */
+ process_stratum, /* to_stratum */
+ NULL, /* to_next */
+ 1, /* to_has_all_memory */
+ 1, /* to_has_memory */
+ 1, /* to_has_stack */
+ 1, /* to_has_registers */
+ 1, /* to_has_execution */
+ NULL, /* sections */
+ NULL, /* sections_end */
+ OPS_MAGIC, /* to_magic */
+};
+
+void
+_initialize_remote_rdp ()
+{
+ add_target (&remote_rdp_ops);
+}
}
-int
-sim_callback_write_stdout (arg, len)
-char *arg;
-int len;
-{
- int i;
- char b[2];
- for (i = 0; i< len; i++) {
- b[0] = arg[i];
- b[1] = 0;
- if (target_output_hook)
- target_output_hook (b);
- else
- fputs_filtered (b, gdb_stdout);
- }
- return len;
-}
-
static void
gdbsim_store_register (regno)
int regno;
program_loaded = 1;
if (sim_load (prog, fromtty) != 0)
- gr_load_image (prog, fromtty);
+ generic_load (prog, fromtty);
}
{
if (sr_get_debug ())
printf_filtered ("gdbsim_open: args \"%s\"\n", args ? args : "(null)");
-
sim_open (args);
-
push_target (&gdbsim_ops);
target_fetch_registers (-1);
-
printf_filtered ("Connected to the simulator.\n");
}
dcache_poke (gr_get_dcache(), addr, word);
}
-/* general purpose load a file specified on the command line
- into target memory. */
-
-void
-gr_load_image (args, fromtty)
- char *args;
- int fromtty;
-{
- bfd *abfd;
-
- asection *s;
- struct cleanup *old_cleanups;
- int delta = 4096;
- char *buffer = xmalloc (delta);
-
- abfd = bfd_openr (args, (char *) 0);
-
- if (!abfd)
- /* FIXME: should be using bfd_errmsg, not assuming it was
- bfd_error_system_call. */
- perror_with_name (args);
-
- /* FIXME: should be checking for errors from bfd_close (for one thing,
- on error it does not free all the storage associated with the
- bfd). */
- old_cleanups = make_cleanup (bfd_close, abfd);
-
- QUIT;
-
- if (!bfd_check_format (abfd, bfd_object))
- error ("It doesn't seem to be an object file.\n");
-
- for (s = abfd->sections; s && !quit_flag; s = s->next)
- {
- if (bfd_get_section_flags (abfd, s) & SEC_LOAD)
- {
- int i;
- printf_filtered ("%s\t: 0x%4x .. 0x%4x ",
- s->name, s->vma, s->vma + s->_raw_size);
- fflush (stdout);
- for (i = 0; i < s->_raw_size && !quit_flag; i += delta)
- {
- int sub_delta = delta;
- if (sub_delta > s->_raw_size - i)
- sub_delta = s->_raw_size - i;
- QUIT;
- bfd_get_section_contents (abfd, s, buffer, i, sub_delta);
- target_write_memory (s->vma + i, buffer, sub_delta);
- printf_filtered ("*");
- fflush (stdout);
- }
- printf_filtered ("\n");
- }
- }
-
- free (buffer);
- write_pc (bfd_get_start_address (abfd));
- if (!bfd_close (abfd))
- warning ("cannot close \"%s\": %s",
- args, bfd_errmsg (bfd_get_error ()));
- discard_cleanups (old_cleanups);
-}
-
-
void
_initialize_sr_support ()
{
#include "serial.h"
#include <fcntl.h>
#include <sys/types.h>
-
-#if !defined (HAVE_TERMIOS) && !defined (HAVE_TERMIO) && !defined (HAVE_SGTTY)
-#define HAVE_SGTTY
+#include "terminal.h"
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
#endif
#ifdef HAVE_TERMIOS
-#include <termios.h>
-#include <unistd.h>
struct hardwire_ttystate
{
#endif /* termios */
#ifdef HAVE_TERMIO
-#include <termio.h>
/* It is believed that all systems which have added job control to SVR3
(e.g. sco) have also added termios. Even if not, trying to figure out
too if it existed on all systems. */
#include <sys/time.h>
-#include <sgtty.h>
-
struct hardwire_ttystate
{
struct sgttyb sgttyb;
hardwire_flush_input (scb)
serial_t scb;
{
+ scb->bufcnt = 0;
+ scb->bufp = scb->buf;
+
#ifdef HAVE_TERMIOS
return tcflush (scb->fd, TCIFLUSH);
#endif
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "defs.h"
#if !defined(__GO32__) && !defined(WIN32)
}
-#if defined(__GO32__)||defined(WIN32)
+#if defined(__GO32__)||defined(WINGDB)
/* In the absence of signals, poll keyboard for a quit.
Called from #define QUIT pollquit() in xm-go32.h. */
#endif
-#if defined(__GO32__)||defined(WIN32)
+#if defined(__GO32__)||defined(WINGDB)
void notice_quit()
{
if (kbhit ())
int signo;
{
quit_flag = 1;
-
/* Restore the signal handler. Harmless with BSD-style signals, needed
for System V-style signals. So just always do it, rather than worrying
about USG defines and stuff like that. */
#ifdef REQUEST_QUIT
REQUEST_QUIT;
#else
- if (immediate_quit)
+ if (immediate_quit)
quit ();
#endif
}