* Makefile.in (SFILES): Update.
authorDaniel Jacobowitz <drow@false.org>
Fri, 20 Jun 2003 14:08:16 +0000 (14:08 +0000)
committerDaniel Jacobowitz <drow@false.org>
Fri, 20 Jun 2003 14:08:16 +0000 (14:08 +0000)
* low-hppabsd.c, low-lynx.c, low-nbsd.c, low-sim.c, low-sparc.c,
low-sun3.c: Remove files.

gdb/gdbserver/ChangeLog
gdb/gdbserver/Makefile.in
gdb/gdbserver/low-hppabsd.c [deleted file]
gdb/gdbserver/low-lynx.c [deleted file]
gdb/gdbserver/low-nbsd.c [deleted file]
gdb/gdbserver/low-sim.c [deleted file]
gdb/gdbserver/low-sparc.c [deleted file]
gdb/gdbserver/low-sun3.c [deleted file]

index c86533457e21967360e6c2011a1b2d991c3cc882..8886aceb1c3c80ad7ca51b3ce7a260582b59dd80 100644 (file)
@@ -1,3 +1,9 @@
+2003-06-20  Daniel Jacobowitz  <drow@mvista.com>
+
+       * Makefile.in (SFILES): Update.
+       * low-hppabsd.c, low-lynx.c, low-nbsd.c, low-sim.c, low-sparc.c,
+       low-sun3.c: Remove files.
+
 2003-06-17  Daniel Jacobowitz  <drow@mvista.com>
 
        * linux-low.c: Move comment to linux_thread_alive where it belonged.
index 763c21ed7b2fe261a3338c8811530252f1b9b78f..80667f9c6ceaf0e9938ab8e27387eaca59fbe4f4 100644 (file)
@@ -113,10 +113,16 @@ LINTFLAGS= $(BFD_CFLAGS)
 
 # All source files that go into linking GDB remote server.
 
-SFILES = $(srcdir)/low-hppabsd.c $(srcdir)/low-linux.c $(srcdir)/low-lynx.c \
-        $(srcdir)/low-nbsd.c $(srcdir)/low-sim.c $(srcdir)/low-sparc.c \
-        $(srcdir)/low-sun3.c $(srcdir)/utils.c $(srcdir)/server.c \
-        $(srcdir)/remote-utils.c
+SFILES=        $(srcdir)/gdbreplay.c $(srcdir)/inferiors.c \
+       $(srcdir)/mem-break.c $(srcdir)/proc-service.c $(srcdir)/regcache.c \
+       $(srcdir)/remote-utils.c $(srcdir)/server.c $(srcdir)/target.c \
+       $(srcdir)/thread-db.c $(srcdir)/utils.c \
+       $(srcdir)/linux-arm-low.c $(srcdir)/linux-i386-low.c \
+       $(srcdir)/i387-fp.c \
+       $(srcdir)/linux-ia64-low.c $(srcdir)/linux-low.c \
+       $(srcdir)/linux-m68k-low.c $(srcdir)/linux-mips-low.c \
+       $(srcdir)/linux-ppc-low.c $(srcdir)/linux-s390-low.c \
+       $(srcdir)/linux-sh-low.c $(srcdir)/linux-x86-64-low.c
 
 DEPFILES = @GDBSERVER_DEPFILES@
 
diff --git a/gdb/gdbserver/low-hppabsd.c b/gdb/gdbserver/low-hppabsd.c
deleted file mode 100644 (file)
index 3287923..0000000
+++ /dev/null
@@ -1,355 +0,0 @@
-/* Low level interface to ptrace, for the remote server for GDB.
-   Copyright 1995, 1996, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
-
-   This file is part of GDB.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
-
-#include "server.h"
-#include <sys/wait.h>
-#include "frame.h"
-#include "inferior.h"
-
-#include <stdio.h>
-#include <sys/param.h>
-#include <sys/dir.h>
-#include <sys/user.h>
-#include <signal.h>
-#include <sys/ioctl.h>
-#include <sgtty.h>
-#include <fcntl.h>
-
-/***************Begin MY defs*********************/
-static char my_registers[REGISTER_BYTES];
-char *registers = my_registers;
-/***************End MY defs*********************/
-
-#include <sys/ptrace.h>
-#include <machine/reg.h>
-
-extern int errno;
-
-/* Start an inferior process and returns its pid.
-   ALLARGS is a vector of program-name and args. */
-
-int
-create_inferior (char *program, char **allargs)
-{
-  int pid;
-
-  pid = fork ();
-  if (pid < 0)
-    perror_with_name ("fork");
-
-  if (pid == 0)
-    {
-      ptrace (PT_TRACE_ME, 0, 0, 0, 0);
-
-      execv (program, allargs);
-
-      fprintf (stderr, "Cannot exec %s: %s.\n", program,
-              errno < sys_nerr ? sys_errlist[errno] : "unknown error");
-      fflush (stderr);
-      _exit (0177);
-    }
-
-  return pid;
-}
-
-/* Kill the inferior process.  Make us have no inferior.  */
-
-void
-kill_inferior (void)
-{
-  if (inferior_pid == 0)
-    return;
-  ptrace (8, inferior_pid, 0, 0, 0);
-  wait (0);
-/*************inferior_died ();****VK**************/
-}
-
-/* Attaching is not supported.  */
-int
-myattach (int pid)
-{
-  return -1;
-}
-
-/* Return nonzero if the given thread is still alive.  */
-int
-mythread_alive (int pid)
-{
-  return 1;
-}
-
-/* Wait for process, returns status */
-
-unsigned char
-mywait (char *status)
-{
-  int pid;
-  union wait w;
-
-  enable_async_io ();
-  pid = waitpid (inferior_pid, &w, 0);
-  disable_async_io ();
-  if (pid != inferior_pid)
-    perror_with_name ("wait");
-
-  if (WIFEXITED (w))
-    {
-      fprintf (stderr, "\nChild exited with retcode = %x \n", WEXITSTATUS (w));
-      *status = 'W';
-      return ((unsigned char) WEXITSTATUS (w));
-    }
-  else if (!WIFSTOPPED (w))
-    {
-      fprintf (stderr, "\nChild terminated with signal = %x \n", WTERMSIG (w));
-      *status = 'X';
-      return ((unsigned char) WTERMSIG (w));
-    }
-
-  fetch_inferior_registers (0);
-
-  *status = 'T';
-  return ((unsigned char) WSTOPSIG (w));
-}
-
-/* Resume execution of the inferior process.
-   If STEP is nonzero, single-step it.
-   If SIGNAL is nonzero, give it that signal.  */
-
-void
-myresume (int step, int signal)
-{
-  errno = 0;
-  ptrace (step ? PT_STEP : PT_CONTINUE, inferior_pid, 1, signal, 0);
-  if (errno)
-    perror_with_name ("ptrace");
-}
-
-
-#if !defined (offsetof)
-#define offsetof(TYPE, MEMBER) ((unsigned long) &((TYPE *)0)->MEMBER)
-#endif
-
-/* U_REGS_OFFSET is the offset of the registers within the u area.  */
-#if !defined (U_REGS_OFFSET)
-#define U_REGS_OFFSET \
-  ptrace (PT_READ_U, inferior_pid, \
-          (PTRACE_ARG3_TYPE) (offsetof (struct user, u_ar0)), 0) \
-    - KERNEL_U_ADDR
-#endif
-
-CORE_ADDR
-register_addr (int regno, CORE_ADDR blockend)
-{
-  CORE_ADDR addr;
-
-  if (regno < 0 || regno >= NUM_REGS)
-    error ("Invalid register number %d.", regno);
-
-  REGISTER_U_ADDR (addr, blockend, regno);
-
-  return addr;
-}
-
-/* Fetch one register.  */
-
-static void
-fetch_register (int regno)
-{
-  register unsigned int regaddr;
-  char buf[MAX_REGISTER_RAW_SIZE];
-  register int i;
-
-  /* Offset of registers within the u area.  */
-  unsigned int offset;
-
-  offset = U_REGS_OFFSET;
-
-  regaddr = register_addr (regno, offset);
-  for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int))
-    {
-      errno = 0;
-      *(int *) &registers[regno * 4 + i] = ptrace (PT_RUREGS, inferior_pid,
-                                         (PTRACE_ARG3_TYPE) regaddr, 0, 0);
-      regaddr += sizeof (int);
-      if (errno != 0)
-       {
-         /* Warning, not error, in case we are attached; sometimes the
-            kernel doesn't let us at the registers.  */
-         char *err = strerror (errno);
-         char *msg = alloca (strlen (err) + 128);
-         sprintf (msg, "reading register %d: %s", regno, err);
-         error (msg);
-         goto error_exit;
-       }
-    }
-error_exit:;
-}
-
-/* Fetch all registers, or just one, from the child process.  */
-
-void
-fetch_inferior_registers (int regno)
-{
-  if (regno == -1 || regno == 0)
-    for (regno = 0; regno < NUM_REGS; regno++)
-      fetch_register (regno);
-  else
-    fetch_register (regno);
-}
-
-/* Store our register values back into the inferior.
-   If REGNO is -1, do this for all registers.
-   Otherwise, REGNO specifies which register (so we can save time).  */
-
-void
-store_inferior_registers (int regno)
-{
-  register unsigned int regaddr;
-  char buf[80];
-  extern char registers[];
-  register int i;
-  unsigned int offset = U_REGS_OFFSET;
-  int scratch;
-
-  if (regno >= 0)
-    {
-      if (CANNOT_STORE_REGISTER (regno))
-       return;
-      regaddr = register_addr (regno, offset);
-      errno = 0;
-      if (regno == PCOQ_HEAD_REGNUM || regno == PCOQ_TAIL_REGNUM)
-       {
-         scratch = *(int *) &registers[REGISTER_BYTE (regno)] | 0x3;
-         ptrace (PT_WUREGS, inferior_pid, (PTRACE_ARG3_TYPE) regaddr,
-                 scratch, 0);
-         if (errno != 0)
-           {
-             /* Error, even if attached.  Failing to write these two
-                registers is pretty serious.  */
-             sprintf (buf, "writing register number %d", regno);
-             perror_with_name (buf);
-           }
-       }
-      else
-       for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int))
-         {
-           errno = 0;
-           ptrace (PT_WUREGS, inferior_pid, (PTRACE_ARG3_TYPE) regaddr,
-                   *(int *) &registers[REGISTER_BYTE (regno) + i], 0);
-           if (errno != 0)
-             {
-               /* Warning, not error, in case we are attached; sometimes the
-                  kernel doesn't let us at the registers.  */
-               char *err = strerror (errno);
-               char *msg = alloca (strlen (err) + 128);
-               sprintf (msg, "writing register %d: %s",
-                        regno, err);
-               error (msg);
-               return;
-             }
-           regaddr += sizeof (int);
-         }
-    }
-  else
-    for (regno = 0; regno < NUM_REGS; regno++)
-      store_inferior_registers (regno);
-}
-
-/* NOTE! I tried using PTRACE_READDATA, etc., to read and write memory
-   in the NEW_SUN_PTRACE case.
-   It ought to be straightforward.  But it appears that writing did
-   not write the data that I specified.  I cannot understand where
-   it got the data that it actually did write.  */
-
-/* Copy LEN bytes from inferior's memory starting at MEMADDR
-   to debugger memory starting at MYADDR.  */
-
-void
-read_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len)
-{
-  register int i;
-  /* Round starting address down to longword boundary.  */
-  register CORE_ADDR addr = memaddr & -(CORE_ADDR) sizeof (int);
-  /* Round ending address up; get number of longwords that makes.  */
-  register int count
-  = (((memaddr + len) - addr) + sizeof (int) - 1) / sizeof (int);
-  /* Allocate buffer of that many longwords.  */
-  register int *buffer = (int *) alloca (count * sizeof (int));
-
-  /* Read all the longwords */
-  for (i = 0; i < count; i++, addr += sizeof (int))
-    {
-      buffer[i] = ptrace (1, inferior_pid, addr, 0, 0);
-    }
-
-  /* Copy appropriate bytes out of the buffer.  */
-  memcpy (myaddr, (char *) buffer + (memaddr & (sizeof (int) - 1)), len);
-}
-
-/* Copy LEN bytes of data from debugger memory at MYADDR
-   to inferior's memory at MEMADDR.
-   On failure (cannot write the inferior)
-   returns the value of errno.  */
-
-int
-write_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len)
-{
-  register int i;
-  /* Round starting address down to longword boundary.  */
-  register CORE_ADDR addr = memaddr & -(CORE_ADDR) sizeof (int);
-  /* Round ending address up; get number of longwords that makes.  */
-  register int count
-  = (((memaddr + len) - addr) + sizeof (int) - 1) / sizeof (int);
-  /* Allocate buffer of that many longwords.  */
-  register int *buffer = (int *) alloca (count * sizeof (int));
-  extern int errno;
-
-  /* Fill start and end extra bytes of buffer with existing memory data.  */
-
-  buffer[0] = ptrace (1, inferior_pid, addr, 0, 0);
-
-  if (count > 1)
-    {
-      buffer[count - 1]
-       = ptrace (1, inferior_pid,
-                 addr + (count - 1) * sizeof (int), 0, 0);
-    }
-
-  /* Copy data to be written over corresponding part of buffer */
-
-  memcpy ((char *) buffer + (memaddr & (sizeof (int) - 1)), myaddr, len);
-
-  /* Write the entire buffer.  */
-
-  for (i = 0; i < count; i++, addr += sizeof (int))
-    {
-      errno = 0;
-      ptrace (4, inferior_pid, addr, buffer[i], 0);
-      if (errno)
-       return errno;
-    }
-
-  return 0;
-}
-\f
-void
-initialize_low (void)
-{
-}
diff --git a/gdb/gdbserver/low-lynx.c b/gdb/gdbserver/low-lynx.c
deleted file mode 100644 (file)
index 90e18db..0000000
+++ /dev/null
@@ -1,745 +0,0 @@
-/* Low level interface to ptrace, for the remote server for GDB.
-   Copyright 1986, 1987, 1993, 1994, 1995, 1999, 2000, 2001, 2002
-   Free Software Foundation, Inc.
-
-   This file is part of GDB.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
-
-#include "server.h"
-#include "frame.h"
-#include "inferior.h"
-
-#include <stdio.h>
-#include <sys/param.h>
-#include <sys/dir.h>
-#define LYNXOS
-#include <sys/mem.h>
-#include <sys/signal.h>
-#include <sys/file.h>
-#include <sys/kernel.h>
-#ifndef __LYNXOS
-#define __LYNXOS
-#endif
-#include <sys/itimer.h>
-#include <sys/time.h>
-#include <sys/resource.h>
-#include <sys/proc.h>
-#include <signal.h>
-#include <sys/ioctl.h>
-#include <sgtty.h>
-#include <fcntl.h>
-#include <sys/wait.h>
-#include <sys/fpp.h>
-
-static char my_registers[REGISTER_BYTES];
-char *registers = my_registers;
-
-#include <sys/ptrace.h>
-
-/* Start an inferior process and returns its pid.
-   ALLARGS is a vector of program-name and args. */
-
-int
-create_inferior (char *program, char **allargs)
-{
-  int pid;
-
-  pid = fork ();
-  if (pid < 0)
-    perror_with_name ("fork");
-
-  if (pid == 0)
-    {
-      int pgrp;
-
-      /* Switch child to it's own process group so that signals won't
-         directly affect gdbserver. */
-
-      pgrp = getpid ();
-      setpgrp (0, pgrp);
-      ioctl (0, TIOCSPGRP, &pgrp);
-
-      ptrace (PTRACE_TRACEME, 0, (PTRACE_ARG3_TYPE) 0, 0);
-
-      execv (program, allargs);
-
-      fprintf (stderr, "GDBserver (process %d):  Cannot exec %s: %s.\n",
-              getpid (), program,
-              errno < sys_nerr ? sys_errlist[errno] : "unknown error");
-      fflush (stderr);
-      _exit (0177);
-    }
-
-  return pid;
-}
-
-/* Attaching is not supported.  */
-int
-myattach (int pid)
-{
-  return -1;
-}
-
-/* Kill the inferior process.  Make us have no inferior.  */
-
-void
-kill_inferior (void)
-{
-  if (inferior_pid == 0)
-    return;
-  ptrace (PTRACE_KILL, inferior_pid, 0, 0);
-  wait (0);
-
-  inferior_pid = 0;
-}
-
-/* Return nonzero if the given thread is still alive.  */
-int
-mythread_alive (int pid)
-{
-  /* Arggh.  Apparently pthread_kill only works for threads within
-     the process that calls pthread_kill.
-
-     We want to avoid the lynx signal extensions as they simply don't
-     map well to the generic gdb interface we want to keep.
-
-     All we want to do is determine if a particular thread is alive;
-     it appears as if we can just make a harmless thread specific
-     ptrace call to do that.  */
-  return (ptrace (PTRACE_THREADUSER,
-                 BUILDPID (PIDGET (inferior_pid), pid), 0, 0) != -1);
-}
-
-/* Wait for process, returns status */
-
-unsigned char
-mywait (char *status)
-{
-  int pid;
-  union wait w;
-
-  while (1)
-    {
-      enable_async_io ();
-
-      pid = wait (&w);
-
-      disable_async_io ();
-
-      if (pid != PIDGET (inferior_pid))
-       perror_with_name ("wait");
-
-      thread_from_wait = w.w_tid;
-      inferior_pid = BUILDPID (inferior_pid, w.w_tid);
-
-      if (WIFSTOPPED (w)
-         && WSTOPSIG (w) == SIGTRAP)
-       {
-         int realsig;
-
-         realsig = ptrace (PTRACE_GETTRACESIG, inferior_pid,
-                           (PTRACE_ARG3_TYPE) 0, 0);
-
-         if (realsig == SIGNEWTHREAD)
-           {
-             /* It's a new thread notification.  Nothing to do here since
-                the machine independent code in wait_for_inferior will
-                add the thread to the thread list and restart the thread
-                when pid != inferior_pid and pid is not in the thread list.
-                We don't even want to muck with realsig -- the code in
-                wait_for_inferior expects SIGTRAP.  */
-             ;
-           }
-       }
-      break;
-    }
-
-  if (WIFEXITED (w))
-    {
-      *status = 'W';
-      return ((unsigned char) WEXITSTATUS (w));
-    }
-  else if (!WIFSTOPPED (w))
-    {
-      *status = 'X';
-      return ((unsigned char) WTERMSIG (w));
-    }
-
-  fetch_inferior_registers (0);
-
-  *status = 'T';
-  return ((unsigned char) WSTOPSIG (w));
-}
-
-/* Resume execution of the inferior process.
-   If STEP is nonzero, single-step it.
-   If SIGNAL is nonzero, give it that signal.  */
-
-void
-myresume (int step, int signal)
-{
-  errno = 0;
-  ptrace (step ? PTRACE_SINGLESTEP_ONE : PTRACE_CONT,
-         BUILDPID (inferior_pid, cont_thread == -1 ? 0 : cont_thread),
-         1, signal);
-  if (errno)
-    perror_with_name ("ptrace");
-}
-
-#undef offsetof
-#define offsetof(TYPE, MEMBER) ((unsigned long) &((TYPE *)0)->MEMBER)
-
-/* Mapping between GDB register #s and offsets into econtext.  Must be
-   consistent with REGISTER_NAMES macro in various tmXXX.h files. */
-
-#define X(ENTRY)(offsetof(struct econtext, ENTRY))
-
-#ifdef I386
-/* Mappings from tm-i386v.h */
-
-static int regmap[] =
-{
-  X (eax),
-  X (ecx),
-  X (edx),
-  X (ebx),
-  X (esp),                     /* sp */
-  X (ebp),                     /* fp */
-  X (esi),
-  X (edi),
-  X (eip),                     /* pc */
-  X (flags),                   /* ps */
-  X (cs),
-  X (ss),
-  X (ds),
-  X (es),
-  X (ecode),                   /* Lynx doesn't give us either fs or gs, so */
-  X (fault),                   /* we just substitute these two in the hopes
-                                  that they are useful. */
-};
-#endif
-
-#ifdef M68K
-/* Mappings from tm-m68k.h */
-
-static int regmap[] =
-{
-  X (regs[0]),                 /* d0 */
-  X (regs[1]),                 /* d1 */
-  X (regs[2]),                 /* d2 */
-  X (regs[3]),                 /* d3 */
-  X (regs[4]),                 /* d4 */
-  X (regs[5]),                 /* d5 */
-  X (regs[6]),                 /* d6 */
-  X (regs[7]),                 /* d7 */
-  X (regs[8]),                 /* a0 */
-  X (regs[9]),                 /* a1 */
-  X (regs[10]),                        /* a2 */
-  X (regs[11]),                        /* a3 */
-  X (regs[12]),                        /* a4 */
-  X (regs[13]),                        /* a5 */
-  X (regs[14]),                        /* fp */
-  0,                           /* sp */
-  X (status),                  /* ps */
-  X (pc),
-
-  X (fregs[0 * 3]),            /* fp0 */
-  X (fregs[1 * 3]),            /* fp1 */
-  X (fregs[2 * 3]),            /* fp2 */
-  X (fregs[3 * 3]),            /* fp3 */
-  X (fregs[4 * 3]),            /* fp4 */
-  X (fregs[5 * 3]),            /* fp5 */
-  X (fregs[6 * 3]),            /* fp6 */
-  X (fregs[7 * 3]),            /* fp7 */
-
-  X (fcregs[0]),               /* fpcontrol */
-  X (fcregs[1]),               /* fpstatus */
-  X (fcregs[2]),               /* fpiaddr */
-  X (ssw),                     /* fpcode */
-  X (fault),                   /* fpflags */
-};
-#endif
-
-#ifdef SPARC
-/* Mappings from tm-sparc.h */
-
-#define FX(ENTRY)(offsetof(struct fcontext, ENTRY))
-
-static int regmap[] =
-{
-  -1,                          /* g0 */
-  X (g1),
-  X (g2),
-  X (g3),
-  X (g4),
-  -1,                          /* g5->g7 aren't saved by Lynx */
-  -1,
-  -1,
-
-  X (o[0]),
-  X (o[1]),
-  X (o[2]),
-  X (o[3]),
-  X (o[4]),
-  X (o[5]),
-  X (o[6]),                    /* sp */
-  X (o[7]),                    /* ra */
-
-  -1, -1, -1, -1, -1, -1, -1, -1,      /* l0 -> l7 */
-
-  -1, -1, -1, -1, -1, -1, -1, -1,      /* i0 -> i7 */
-
-  FX (f.fregs[0]),             /* f0 */
-  FX (f.fregs[1]),
-  FX (f.fregs[2]),
-  FX (f.fregs[3]),
-  FX (f.fregs[4]),
-  FX (f.fregs[5]),
-  FX (f.fregs[6]),
-  FX (f.fregs[7]),
-  FX (f.fregs[8]),
-  FX (f.fregs[9]),
-  FX (f.fregs[10]),
-  FX (f.fregs[11]),
-  FX (f.fregs[12]),
-  FX (f.fregs[13]),
-  FX (f.fregs[14]),
-  FX (f.fregs[15]),
-  FX (f.fregs[16]),
-  FX (f.fregs[17]),
-  FX (f.fregs[18]),
-  FX (f.fregs[19]),
-  FX (f.fregs[20]),
-  FX (f.fregs[21]),
-  FX (f.fregs[22]),
-  FX (f.fregs[23]),
-  FX (f.fregs[24]),
-  FX (f.fregs[25]),
-  FX (f.fregs[26]),
-  FX (f.fregs[27]),
-  FX (f.fregs[28]),
-  FX (f.fregs[29]),
-  FX (f.fregs[30]),
-  FX (f.fregs[31]),
-
-  X (y),
-  X (psr),
-  X (wim),
-  X (tbr),
-  X (pc),
-  X (npc),
-  FX (fsr),                    /* fpsr */
-  -1,                          /* cpsr */
-};
-#endif
-
-#ifdef SPARC
-
-/* This routine handles some oddball cases for Sparc registers and LynxOS.
-   In partucular, it causes refs to G0, g5->7, and all fp regs to return zero.
-   It also handles knows where to find the I & L regs on the stack.  */
-
-void
-fetch_inferior_registers (int regno)
-{
-#if 0
-  int whatregs = 0;
-
-#define WHATREGS_FLOAT 1
-#define WHATREGS_GEN 2
-#define WHATREGS_STACK 4
-
-  if (regno == -1)
-    whatregs = WHATREGS_FLOAT | WHATREGS_GEN | WHATREGS_STACK;
-  else if (regno >= L0_REGNUM && regno <= I7_REGNUM)
-    whatregs = WHATREGS_STACK;
-  else if (regno >= FP0_REGNUM && regno < FP0_REGNUM + 32)
-    whatregs = WHATREGS_FLOAT;
-  else
-    whatregs = WHATREGS_GEN;
-
-  if (whatregs & WHATREGS_GEN)
-    {
-      struct econtext ec;      /* general regs */
-      char buf[MAX_REGISTER_RAW_SIZE];
-      int retval;
-      int i;
-
-      errno = 0;
-      retval = ptrace (PTRACE_GETREGS,
-                      BUILDPID (inferior_pid, general_thread),
-                      (PTRACE_ARG3_TYPE) & ec,
-                      0);
-      if (errno)
-       perror_with_name ("Sparc fetch_inferior_registers(ptrace)");
-
-      memset (buf, 0, REGISTER_RAW_SIZE (G0_REGNUM));
-      supply_register (G0_REGNUM, buf);
-      supply_register (TBR_REGNUM, (char *) &ec.tbr);
-
-      memcpy (&registers[REGISTER_BYTE (G1_REGNUM)], &ec.g1,
-             4 * REGISTER_RAW_SIZE (G1_REGNUM));
-      for (i = G1_REGNUM; i <= G1_REGNUM + 3; i++)
-       register_valid[i] = 1;
-
-      supply_register (PS_REGNUM, (char *) &ec.psr);
-      supply_register (Y_REGNUM, (char *) &ec.y);
-      supply_register (PC_REGNUM, (char *) &ec.pc);
-      supply_register (NPC_REGNUM, (char *) &ec.npc);
-      supply_register (WIM_REGNUM, (char *) &ec.wim);
-
-      memcpy (&registers[REGISTER_BYTE (O0_REGNUM)], ec.o,
-             8 * REGISTER_RAW_SIZE (O0_REGNUM));
-      for (i = O0_REGNUM; i <= O0_REGNUM + 7; i++)
-       register_valid[i] = 1;
-    }
-
-  if (whatregs & WHATREGS_STACK)
-    {
-      CORE_ADDR sp;
-      int i;
-
-      sp = read_register (SP_REGNUM);
-
-      target_xfer_memory (sp + FRAME_SAVED_I0,
-                         &registers[REGISTER_BYTE (I0_REGNUM)],
-                         8 * REGISTER_RAW_SIZE (I0_REGNUM), 0);
-      for (i = I0_REGNUM; i <= I7_REGNUM; i++)
-       register_valid[i] = 1;
-
-      target_xfer_memory (sp + FRAME_SAVED_L0,
-                         &registers[REGISTER_BYTE (L0_REGNUM)],
-                         8 * REGISTER_RAW_SIZE (L0_REGNUM), 0);
-      for (i = L0_REGNUM; i <= L0_REGNUM + 7; i++)
-       register_valid[i] = 1;
-    }
-
-  if (whatregs & WHATREGS_FLOAT)
-    {
-      struct fcontext fc;      /* fp regs */
-      int retval;
-      int i;
-
-      errno = 0;
-      retval = ptrace (PTRACE_GETFPREGS, BUILDPID (inferior_pid, general_thread), (PTRACE_ARG3_TYPE) & fc,
-                      0);
-      if (errno)
-       perror_with_name ("Sparc fetch_inferior_registers(ptrace)");
-
-      memcpy (&registers[REGISTER_BYTE (FP0_REGNUM)], fc.f.fregs,
-             32 * REGISTER_RAW_SIZE (FP0_REGNUM));
-      for (i = FP0_REGNUM; i <= FP0_REGNUM + 31; i++)
-       register_valid[i] = 1;
-
-      supply_register (FPS_REGNUM, (char *) &fc.fsr);
-    }
-#endif
-}
-
-/* This routine handles storing of the I & L regs for the Sparc.  The trick
-   here is that they actually live on the stack.  The really tricky part is
-   that when changing the stack pointer, the I & L regs must be written to
-   where the new SP points, otherwise the regs will be incorrect when the
-   process is started up again.   We assume that the I & L regs are valid at
-   this point.  */
-
-void
-store_inferior_registers (int regno)
-{
-#if 0
-  int whatregs = 0;
-
-  if (regno == -1)
-    whatregs = WHATREGS_FLOAT | WHATREGS_GEN | WHATREGS_STACK;
-  else if (regno >= L0_REGNUM && regno <= I7_REGNUM)
-    whatregs = WHATREGS_STACK;
-  else if (regno >= FP0_REGNUM && regno < FP0_REGNUM + 32)
-    whatregs = WHATREGS_FLOAT;
-  else if (regno == SP_REGNUM)
-    whatregs = WHATREGS_STACK | WHATREGS_GEN;
-  else
-    whatregs = WHATREGS_GEN;
-
-  if (whatregs & WHATREGS_GEN)
-    {
-      struct econtext ec;      /* general regs */
-      int retval;
-
-      ec.tbr = read_register (TBR_REGNUM);
-      memcpy (&ec.g1, &registers[REGISTER_BYTE (G1_REGNUM)],
-             4 * REGISTER_RAW_SIZE (G1_REGNUM));
-
-      ec.psr = read_register (PS_REGNUM);
-      ec.y = read_register (Y_REGNUM);
-      ec.pc = read_register (PC_REGNUM);
-      ec.npc = read_register (NPC_REGNUM);
-      ec.wim = read_register (WIM_REGNUM);
-
-      memcpy (ec.o, &registers[REGISTER_BYTE (O0_REGNUM)],
-             8 * REGISTER_RAW_SIZE (O0_REGNUM));
-
-      errno = 0;
-      retval = ptrace (PTRACE_SETREGS, BUILDPID (inferior_pid, general_thread), (PTRACE_ARG3_TYPE) & ec,
-                      0);
-      if (errno)
-       perror_with_name ("Sparc fetch_inferior_registers(ptrace)");
-    }
-
-  if (whatregs & WHATREGS_STACK)
-    {
-      int regoffset;
-      CORE_ADDR sp;
-
-      sp = read_register (SP_REGNUM);
-
-      if (regno == -1 || regno == SP_REGNUM)
-       {
-         if (!register_valid[L0_REGNUM + 5])
-           abort ();
-         target_xfer_memory (sp + FRAME_SAVED_I0,
-                             &registers[REGISTER_BYTE (I0_REGNUM)],
-                             8 * REGISTER_RAW_SIZE (I0_REGNUM), 1);
-
-         target_xfer_memory (sp + FRAME_SAVED_L0,
-                             &registers[REGISTER_BYTE (L0_REGNUM)],
-                             8 * REGISTER_RAW_SIZE (L0_REGNUM), 1);
-       }
-      else if (regno >= L0_REGNUM && regno <= I7_REGNUM)
-       {
-         if (!register_valid[regno])
-           abort ();
-         if (regno >= L0_REGNUM && regno <= L0_REGNUM + 7)
-           regoffset = REGISTER_BYTE (regno) - REGISTER_BYTE (L0_REGNUM)
-             + FRAME_SAVED_L0;
-         else
-           regoffset = REGISTER_BYTE (regno) - REGISTER_BYTE (I0_REGNUM)
-             + FRAME_SAVED_I0;
-         target_xfer_memory (sp + regoffset, &registers[REGISTER_BYTE (regno)],
-                             REGISTER_RAW_SIZE (regno), 1);
-       }
-    }
-
-  if (whatregs & WHATREGS_FLOAT)
-    {
-      struct fcontext fc;      /* fp regs */
-      int retval;
-
-/* We read fcontext first so that we can get good values for fq_t... */
-      errno = 0;
-      retval = ptrace (PTRACE_GETFPREGS, BUILDPID (inferior_pid, general_thread), (PTRACE_ARG3_TYPE) & fc,
-                      0);
-      if (errno)
-       perror_with_name ("Sparc fetch_inferior_registers(ptrace)");
-
-      memcpy (fc.f.fregs, &registers[REGISTER_BYTE (FP0_REGNUM)],
-             32 * REGISTER_RAW_SIZE (FP0_REGNUM));
-
-      fc.fsr = read_register (FPS_REGNUM);
-
-      errno = 0;
-      retval = ptrace (PTRACE_SETFPREGS, BUILDPID (inferior_pid, general_thread), (PTRACE_ARG3_TYPE) & fc,
-                      0);
-      if (errno)
-       perror_with_name ("Sparc fetch_inferior_registers(ptrace)");
-    }
-#endif
-}
-#endif /* SPARC */
-
-#ifndef SPARC
-
-/* Return the offset relative to the start of the per-thread data to the
-   saved context block.  */
-
-static unsigned long
-lynx_registers_addr (void)
-{
-  CORE_ADDR stblock;
-  int ecpoff = offsetof (st_t, ecp);
-  CORE_ADDR ecp;
-
-  errno = 0;
-  stblock = (CORE_ADDR) ptrace (PTRACE_THREADUSER, BUILDPID (inferior_pid, general_thread),
-                               (PTRACE_ARG3_TYPE) 0, 0);
-  if (errno)
-    perror_with_name ("PTRACE_THREADUSER");
-
-  ecp = (CORE_ADDR) ptrace (PTRACE_PEEKTHREAD, BUILDPID (inferior_pid, general_thread),
-                           (PTRACE_ARG3_TYPE) ecpoff, 0);
-  if (errno)
-    perror_with_name ("lynx_registers_addr(PTRACE_PEEKTHREAD)");
-
-  return ecp - stblock;
-}
-
-/* Fetch one or more registers from the inferior.  REGNO == -1 to get
-   them all.  We actually fetch more than requested, when convenient,
-   marking them as valid so we won't fetch them again.  */
-
-void
-fetch_inferior_registers (int ignored)
-{
-  int regno;
-  unsigned long reg;
-  unsigned long ecp;
-
-  ecp = lynx_registers_addr ();
-
-  for (regno = 0; regno < NUM_REGS; regno++)
-    {
-      int ptrace_fun = PTRACE_PEEKTHREAD;
-
-#ifdef PTRACE_PEEKUSP
-      ptrace_fun = regno == SP_REGNUM ? PTRACE_PEEKUSP : PTRACE_PEEKTHREAD;
-#endif
-
-      errno = 0;
-      reg = ptrace (ptrace_fun, BUILDPID (inferior_pid, general_thread),
-                   (PTRACE_ARG3_TYPE) (ecp + regmap[regno]), 0);
-      if (errno)
-       perror_with_name ("fetch_inferior_registers(PTRACE_PEEKTHREAD)");
-
-      *(unsigned long *) &registers[REGISTER_BYTE (regno)] = reg;
-    }
-}
-
-/* Store our register values back into the inferior.
-   If REGNO is -1, do this for all registers.
-   Otherwise, REGNO specifies which register (so we can save time).  */
-
-void
-store_inferior_registers (int ignored)
-{
-  int regno;
-  unsigned long reg;
-  unsigned long ecp;
-
-  ecp = lynx_registers_addr ();
-
-  for (regno = 0; regno < NUM_REGS; regno++)
-    {
-      int ptrace_fun = PTRACE_POKEUSER;
-
-#ifdef PTRACE_POKEUSP
-      ptrace_fun = regno == SP_REGNUM ? PTRACE_POKEUSP : PTRACE_POKEUSER;
-#endif
-
-      reg = *(unsigned long *) &registers[REGISTER_BYTE (regno)];
-
-      errno = 0;
-      ptrace (ptrace_fun, BUILDPID (inferior_pid, general_thread),
-             (PTRACE_ARG3_TYPE) (ecp + regmap[regno]), reg);
-      if (errno)
-       perror_with_name ("PTRACE_POKEUSER");
-    }
-}
-
-#endif /* ! SPARC */
-
-/* NOTE! I tried using PTRACE_READDATA, etc., to read and write memory
-   in the NEW_SUN_PTRACE case.
-   It ought to be straightforward.  But it appears that writing did
-   not write the data that I specified.  I cannot understand where
-   it got the data that it actually did write.  */
-
-/* Copy LEN bytes from inferior's memory starting at MEMADDR
-   to debugger memory starting at MYADDR.  */
-
-void
-read_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len)
-{
-  register int i;
-  /* Round starting address down to longword boundary.  */
-  register CORE_ADDR addr = memaddr & -(CORE_ADDR) sizeof (int);
-  /* Round ending address up; get number of longwords that makes.  */
-  register int count
-  = (((memaddr + len) - addr) + sizeof (int) - 1) / sizeof (int);
-  /* Allocate buffer of that many longwords.  */
-  register int *buffer = (int *) alloca (count * sizeof (int));
-
-  /* Read all the longwords */
-  for (i = 0; i < count; i++, addr += sizeof (int))
-    {
-      buffer[i] = ptrace (PTRACE_PEEKTEXT, BUILDPID (inferior_pid, general_thread), addr, 0);
-    }
-
-  /* Copy appropriate bytes out of the buffer.  */
-  memcpy (myaddr, (char *) buffer + (memaddr & (sizeof (int) - 1)), len);
-}
-
-/* Copy LEN bytes of data from debugger memory at MYADDR
-   to inferior's memory at MEMADDR.
-   On failure (cannot write the inferior)
-   returns the value of errno.  */
-
-int
-write_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len)
-{
-  register int i;
-  /* Round starting address down to longword boundary.  */
-  register CORE_ADDR addr = memaddr & -(CORE_ADDR) sizeof (int);
-  /* Round ending address up; get number of longwords that makes.  */
-  register int count
-  = (((memaddr + len) - addr) + sizeof (int) - 1) / sizeof (int);
-  /* Allocate buffer of that many longwords.  */
-  register int *buffer = (int *) alloca (count * sizeof (int));
-  extern int errno;
-
-  /* Fill start and end extra bytes of buffer with existing memory data.  */
-
-  buffer[0] = ptrace (PTRACE_PEEKTEXT, BUILDPID (inferior_pid, general_thread), addr, 0);
-
-  if (count > 1)
-    {
-      buffer[count - 1]
-       = ptrace (PTRACE_PEEKTEXT, BUILDPID (inferior_pid, general_thread),
-                 addr + (count - 1) * sizeof (int), 0);
-    }
-
-  /* Copy data to be written over corresponding part of buffer */
-
-  memcpy ((char *) buffer + (memaddr & (sizeof (int) - 1)), myaddr, len);
-
-  /* Write the entire buffer.  */
-
-  for (i = 0; i < count; i++, addr += sizeof (int))
-    {
-      while (1)
-       {
-         errno = 0;
-         ptrace (PTRACE_POKETEXT, BUILDPID (inferior_pid, general_thread), addr, buffer[i]);
-         if (errno)
-           {
-             fprintf (stderr, "\
-ptrace (PTRACE_POKETEXT): errno=%d, pid=0x%x, addr=0x%x, buffer[i] = 0x%x\n",
-                      errno, BUILDPID (inferior_pid, general_thread),
-                      addr, buffer[i]);
-             fprintf (stderr, "Sleeping for 1 second\n");
-             sleep (1);
-           }
-         else
-           break;
-       }
-    }
-
-  return 0;
-}
-\f
-void
-initialize_low (void)
-{
-}
diff --git a/gdb/gdbserver/low-nbsd.c b/gdb/gdbserver/low-nbsd.c
deleted file mode 100644 (file)
index 8bec0d9..0000000
+++ /dev/null
@@ -1,599 +0,0 @@
-/* Low level interface to ptrace, for the remote server for GDB.
-   Copyright 1986, 1987, 1993, 2000, 2001, 2002 Free Software Foundation, Inc.
-
-This file is part of GDB.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
-
-#include "server.h"
-#include <sys/types.h>
-#include <sys/wait.h>
-#include "frame.h"
-#include "inferior.h"
-
-#include <stdio.h>
-#include <errno.h>
-
-/***************Begin MY defs*********************/
-static char my_registers[REGISTER_BYTES];
-char *registers = my_registers;
-/***************End MY defs*********************/
-
-#include <sys/ptrace.h>
-#include <machine/reg.h>
-
-#define RF(dst, src) \
-       memcpy(&registers[REGISTER_BYTE(dst)], &src, sizeof(src))
-
-#define RS(src, dst) \
-       memcpy(&dst, &registers[REGISTER_BYTE(src)], sizeof(dst))
-
-#ifdef __i386__
-struct env387
-  {
-    unsigned short control;
-    unsigned short r0;
-    unsigned short status;
-    unsigned short r1;
-    unsigned short tag;  
-    unsigned short r2;
-    unsigned long eip;
-    unsigned short code_seg;
-    unsigned short opcode;
-    unsigned long operand; 
-    unsigned short operand_seg;
-    unsigned short r3;
-    unsigned char regs[8][10];
-  };
-
-/* i386_register_raw_size[i] is the number of bytes of storage in the
-   actual machine representation for register i.  */
-int i386_register_raw_size[MAX_NUM_REGS] = {
-   4,  4,  4,  4,
-   4,  4,  4,  4,
-   4,  4,  4,  4,  
-   4,  4,  4,  4,
-  10, 10, 10, 10, 
-  10, 10, 10, 10,
-   4,  4,  4,  4,
-   4,  4,  4,  4, 
-  16, 16, 16, 16,
-  16, 16, 16, 16, 
-  4
-}; 
-   
-int i386_register_byte[MAX_NUM_REGS];
-
-static void       
-initialize_arch (void)
-{
-  /* Initialize the table saying where each register starts in the
-     register file.  */
-  {
-    int i, offset;
-
-    offset = 0;
-    for (i = 0; i < MAX_NUM_REGS; i++)
-      {
-        i386_register_byte[i] = offset;
-        offset += i386_register_raw_size[i];
-      }
-  }   
-}       
-#endif /* !__i386__ */
-
-#ifdef __m68k__
-static void
-initialize_arch (void)
-{
-}
-#endif /* !__m68k__ */
-
-#ifdef __ns32k__
-static void
-initialize_arch (void)
-{
-}
-#endif /* !__ns32k__ */
-
-#ifdef __powerpc__
-#include "ppc-tdep.h"
-
-static void
-initialize_arch (void)
-{
-}
-#endif /* !__powerpc__ */
-
-
-/* Start an inferior process and returns its pid.
-   ALLARGS is a vector of program-name and args. */
-
-int
-create_inferior (char *program, char **allargs)
-{
-  int pid;
-
-  pid = fork ();
-  if (pid < 0)
-    perror_with_name ("fork");
-
-  if (pid == 0)
-    {
-      ptrace (PT_TRACE_ME, 0, 0, 0);
-
-      execv (program, allargs);
-
-      fprintf (stderr, "Cannot exec %s: %s.\n", program,
-              errno < sys_nerr ? sys_errlist[errno] : "unknown error");
-      fflush (stderr);
-      _exit (0177);
-    }
-
-  return pid;
-}
-
-/* Attaching is not supported.  */
-int
-myattach (int pid)
-{
-  return -1;
-}
-
-/* Kill the inferior process.  Make us have no inferior.  */
-
-void
-kill_inferior (void)
-{
-  if (inferior_pid == 0)
-    return;
-  ptrace (PT_KILL, inferior_pid, 0, 0);
-  wait (0);
-  /*************inferior_died ();****VK**************/
-}
-
-/* Return nonzero if the given thread is still alive.  */
-int
-mythread_alive (int pid)
-{
-  return 1;
-}
-
-/* Wait for process, returns status */
-
-unsigned char
-mywait (char *status)
-{
-  int pid;
-  int w;
-
-  enable_async_io ();
-  pid = waitpid (inferior_pid, &w, 0);
-  disable_async_io ();
-  if (pid != inferior_pid)
-    perror_with_name ("wait");
-
-  if (WIFEXITED (w))
-    {
-      fprintf (stderr, "\nChild exited with retcode = %x \n", WEXITSTATUS (w));
-      *status = 'W';
-      return ((unsigned char) WEXITSTATUS (w));
-    }
-  else if (!WIFSTOPPED (w))
-    {
-      fprintf (stderr, "\nChild terminated with signal = %x \n", WTERMSIG (w));
-      *status = 'X';
-      return ((unsigned char) WTERMSIG (w));
-    }
-
-  fetch_inferior_registers (0);
-
-  *status = 'T';
-  return ((unsigned char) WSTOPSIG (w));
-}
-
-/* Resume execution of the inferior process.
-   If STEP is nonzero, single-step it.
-   If SIGNAL is nonzero, give it that signal.  */
-
-void
-myresume (int step, int signal)
-{
-  errno = 0;
-  ptrace (step ? PT_STEP : PT_CONTINUE, inferior_pid, 
-         (PTRACE_ARG3_TYPE) 1, signal);
-  if (errno)
-    perror_with_name ("ptrace");
-}
-
-
-#ifdef __i386__
-/* Fetch one or more registers from the inferior.  REGNO == -1 to get
-   them all.  We actually fetch more than requested, when convenient,
-   marking them as valid so we won't fetch them again.  */
-
-void
-fetch_inferior_registers (int ignored)
-{
-  struct reg inferior_registers;
-  struct env387 inferior_fp_registers;
-
-  ptrace (PT_GETREGS, inferior_pid,
-         (PTRACE_ARG3_TYPE) &inferior_registers, 0);
-  ptrace (PT_GETFPREGS, inferior_pid,
-         (PTRACE_ARG3_TYPE) &inferior_fp_registers, 0);
-
-  RF ( 0, inferior_registers.r_eax); 
-  RF ( 1, inferior_registers.r_ecx);
-  RF ( 2, inferior_registers.r_edx);
-  RF ( 3, inferior_registers.r_ebx);
-  RF ( 4, inferior_registers.r_esp);
-  RF ( 5, inferior_registers.r_ebp);
-  RF ( 6, inferior_registers.r_esi);
-  RF ( 7, inferior_registers.r_edi);
-  RF ( 8, inferior_registers.r_eip);
-  RF ( 9, inferior_registers.r_eflags);
-  RF (10, inferior_registers.r_cs);
-  RF (11, inferior_registers.r_ss);
-  RF (12, inferior_registers.r_ds);
-  RF (13, inferior_registers.r_es);
-  RF (14, inferior_registers.r_fs);
-  RF (15, inferior_registers.r_gs);
-
-  RF (FP0_REGNUM,     inferior_fp_registers.regs[0]);
-  RF (FP0_REGNUM + 1, inferior_fp_registers.regs[1]);
-  RF (FP0_REGNUM + 2, inferior_fp_registers.regs[2]);
-  RF (FP0_REGNUM + 3, inferior_fp_registers.regs[3]);
-  RF (FP0_REGNUM + 4, inferior_fp_registers.regs[4]);
-  RF (FP0_REGNUM + 5, inferior_fp_registers.regs[5]);
-  RF (FP0_REGNUM + 6, inferior_fp_registers.regs[6]);
-  RF (FP0_REGNUM + 7, inferior_fp_registers.regs[7]);
-  
-  RF (FCTRL_REGNUM,   inferior_fp_registers.control);
-  RF (FSTAT_REGNUM,   inferior_fp_registers.status);
-  RF (FTAG_REGNUM,    inferior_fp_registers.tag);
-  RF (FCS_REGNUM,     inferior_fp_registers.code_seg);
-  RF (FCOFF_REGNUM,   inferior_fp_registers.eip);
-  RF (FDS_REGNUM,     inferior_fp_registers.operand_seg);
-  RF (FDOFF_REGNUM,   inferior_fp_registers.operand);
-  RF (FOP_REGNUM,     inferior_fp_registers.opcode);
-}
-
-/* Store our register values back into the inferior.
-   If REGNO is -1, do this for all registers.
-   Otherwise, REGNO specifies which register (so we can save time).  */
-
-void
-store_inferior_registers (int ignored)
-{
-  struct reg inferior_registers;
-  struct env387 inferior_fp_registers;
-
-  RS ( 0, inferior_registers.r_eax); 
-  RS ( 1, inferior_registers.r_ecx);
-  RS ( 2, inferior_registers.r_edx);
-  RS ( 3, inferior_registers.r_ebx);
-  RS ( 4, inferior_registers.r_esp);
-  RS ( 5, inferior_registers.r_ebp);
-  RS ( 6, inferior_registers.r_esi);
-  RS ( 7, inferior_registers.r_edi);
-  RS ( 8, inferior_registers.r_eip);
-  RS ( 9, inferior_registers.r_eflags);
-  RS (10, inferior_registers.r_cs);
-  RS (11, inferior_registers.r_ss);
-  RS (12, inferior_registers.r_ds);
-  RS (13, inferior_registers.r_es);
-  RS (14, inferior_registers.r_fs);
-  RS (15, inferior_registers.r_gs);
-
-  RS (FP0_REGNUM,     inferior_fp_registers.regs[0]);
-  RS (FP0_REGNUM + 1, inferior_fp_registers.regs[1]);
-  RS (FP0_REGNUM + 2, inferior_fp_registers.regs[2]);
-  RS (FP0_REGNUM + 3, inferior_fp_registers.regs[3]);
-  RS (FP0_REGNUM + 4, inferior_fp_registers.regs[4]);
-  RS (FP0_REGNUM + 5, inferior_fp_registers.regs[5]);
-  RS (FP0_REGNUM + 6, inferior_fp_registers.regs[6]);
-  RS (FP0_REGNUM + 7, inferior_fp_registers.regs[7]);
-  
-  RS (FCTRL_REGNUM,   inferior_fp_registers.control);
-  RS (FSTAT_REGNUM,   inferior_fp_registers.status);
-  RS (FTAG_REGNUM,    inferior_fp_registers.tag);
-  RS (FCS_REGNUM,     inferior_fp_registers.code_seg);
-  RS (FCOFF_REGNUM,   inferior_fp_registers.eip);
-  RS (FDS_REGNUM,     inferior_fp_registers.operand_seg);
-  RS (FDOFF_REGNUM,   inferior_fp_registers.operand);
-  RS (FOP_REGNUM,     inferior_fp_registers.opcode);
-
-  ptrace (PT_SETREGS, inferior_pid,
-         (PTRACE_ARG3_TYPE) &inferior_registers, 0);
-  ptrace (PT_SETFPREGS, inferior_pid,
-         (PTRACE_ARG3_TYPE) &inferior_fp_registers, 0);
-}
-#endif /* !__i386__ */
-
-#ifdef __m68k__
-/* Fetch one or more registers from the inferior.  REGNO == -1 to get
-   them all.  We actually fetch more than requested, when convenient,
-   marking them as valid so we won't fetch them again.  */
-
-void
-fetch_inferior_registers (int regno)
-{
-  struct reg inferior_registers;
-  struct fpreg inferior_fp_registers;
-
-  ptrace (PT_GETREGS, inferior_pid,
-          (PTRACE_ARG3_TYPE) & inferior_registers, 0);
-  memcpy (&registers[REGISTER_BYTE (0)], &inferior_registers,
-          sizeof (inferior_registers));
-
-  ptrace (PT_GETFPREGS, inferior_pid,
-          (PTRACE_ARG3_TYPE) & inferior_fp_registers, 0);
-  memcpy (&registers[REGISTER_BYTE (FP0_REGNUM)], &inferior_fp_registers,
-          sizeof (inferior_fp_registers));
-}
-
-/* Store our register values back into the inferior.
-   If REGNO is -1, do this for all registers.
-   Otherwise, REGNO specifies which register (so we can save time).  */
-
-void
-store_inferior_registers (int regno)
-{
-  struct reg inferior_registers;
-  struct fpreg inferior_fp_registers;
-
-  memcpy (&inferior_registers, &registers[REGISTER_BYTE (0)],
-          sizeof (inferior_registers));
-  ptrace (PT_SETREGS, inferior_pid,
-          (PTRACE_ARG3_TYPE) & inferior_registers, 0);
-
-  memcpy (&inferior_fp_registers, &registers[REGISTER_BYTE (FP0_REGNUM)],
-          sizeof (inferior_fp_registers));
-  ptrace (PT_SETFPREGS, inferior_pid,
-          (PTRACE_ARG3_TYPE) & inferior_fp_registers, 0);
-}
-#endif /* !__m68k__ */
-
-
-#ifdef __ns32k__
-/* Fetch one or more registers from the inferior.  REGNO == -1 to get
-   them all.  We actually fetch more than requested, when convenient,
-   marking them as valid so we won't fetch them again.  */
-
-void
-fetch_inferior_registers (int regno)
-{
-  struct reg inferior_registers;
-  struct fpreg inferior_fpregisters;
-
-  ptrace (PT_GETREGS, inferior_pid,
-          (PTRACE_ARG3_TYPE) & inferior_registers, 0);
-  ptrace (PT_GETFPREGS, inferior_pid,
-          (PTRACE_ARG3_TYPE) & inferior_fpregisters, 0);
-
-  RF (R0_REGNUM + 0, inferior_registers.r_r0);
-  RF (R0_REGNUM + 1, inferior_registers.r_r1);
-  RF (R0_REGNUM + 2, inferior_registers.r_r2);
-  RF (R0_REGNUM + 3, inferior_registers.r_r3);
-  RF (R0_REGNUM + 4, inferior_registers.r_r4);
-  RF (R0_REGNUM + 5, inferior_registers.r_r5);
-  RF (R0_REGNUM + 6, inferior_registers.r_r6);
-  RF (R0_REGNUM + 7, inferior_registers.r_r7);
-
-  RF (SP_REGNUM, inferior_registers.r_sp);
-  RF (DEPRECATED_FP_REGNUM, inferior_registers.r_fp);
-  RF (PC_REGNUM, inferior_registers.r_pc);
-  RF (PS_REGNUM, inferior_registers.r_psr);
-
-  RF (FPS_REGNUM, inferior_fpregisters.r_fsr);
-  RF (FP0_REGNUM + 0, inferior_fpregisters.r_freg[0]);
-  RF (FP0_REGNUM + 2, inferior_fpregisters.r_freg[2]);
-  RF (FP0_REGNUM + 4, inferior_fpregisters.r_freg[4]);
-  RF (FP0_REGNUM + 6, inferior_fpregisters.r_freg[6]);
-  RF (LP0_REGNUM + 1, inferior_fpregisters.r_freg[1]);
-  RF (LP0_REGNUM + 3, inferior_fpregisters.r_freg[3]);
-  RF (LP0_REGNUM + 5, inferior_fpregisters.r_freg[5]);
-  RF (LP0_REGNUM + 7, inferior_fpregisters.r_freg[7]);
-}
-
-/* Store our register values back into the inferior.
-   If REGNO is -1, do this for all registers.
-   Otherwise, REGNO specifies which register (so we can save time).  */
-
-void
-store_inferior_registers (int regno)
-{
-  struct reg inferior_registers;
-  struct fpreg inferior_fpregisters;
-
-  RS (R0_REGNUM + 0, inferior_registers.r_r0);
-  RS (R0_REGNUM + 1, inferior_registers.r_r1);
-  RS (R0_REGNUM + 2, inferior_registers.r_r2);
-  RS (R0_REGNUM + 3, inferior_registers.r_r3);
-  RS (R0_REGNUM + 4, inferior_registers.r_r4);
-  RS (R0_REGNUM + 5, inferior_registers.r_r5);
-  RS (R0_REGNUM + 6, inferior_registers.r_r6);
-  RS (R0_REGNUM + 7, inferior_registers.r_r7);
-  
-  RS (SP_REGNUM, inferior_registers.r_sp);
-  RS (DEPRECATED_FP_REGNUM, inferior_registers.r_fp);
-  RS (PC_REGNUM, inferior_registers.r_pc);
-  RS (PS_REGNUM, inferior_registers.r_psr);
-  
-  RS (FPS_REGNUM, inferior_fpregisters.r_fsr);
-  RS (FP0_REGNUM + 0, inferior_fpregisters.r_freg[0]);
-  RS (FP0_REGNUM + 2, inferior_fpregisters.r_freg[2]);
-  RS (FP0_REGNUM + 4, inferior_fpregisters.r_freg[4]);
-  RS (FP0_REGNUM + 6, inferior_fpregisters.r_freg[6]);
-  RS (LP0_REGNUM + 1, inferior_fpregisters.r_freg[1]);
-  RS (LP0_REGNUM + 3, inferior_fpregisters.r_freg[3]);
-  RS (LP0_REGNUM + 5, inferior_fpregisters.r_freg[5]);
-  RS (LP0_REGNUM + 7, inferior_fpregisters.r_freg[7]);
-  
-  ptrace (PT_SETREGS, inferior_pid,
-          (PTRACE_ARG3_TYPE) & inferior_registers, 0);
-  ptrace (PT_SETFPREGS, inferior_pid,
-          (PTRACE_ARG3_TYPE) & inferior_fpregisters, 0);
-
-}
-#endif /* !__ns32k__ */
-
-#ifdef __powerpc__
-/* Fetch one or more registers from the inferior.  REGNO == -1 to get
-   them all.  We actually fetch more than requested, when convenient,
-   marking them as valid so we won't fetch them again.  */
-
-void
-fetch_inferior_registers (int regno)
-{
-  struct reg inferior_registers;
-#ifdef PT_GETFPREGS
-  struct fpreg inferior_fp_registers;
-#endif
-  int i;
-
-  ptrace (PT_GETREGS, inferior_pid,
-         (PTRACE_ARG3_TYPE) & inferior_registers, 0);
-  for (i = 0; i < 32; i++)
-    RF (i, inferior_registers.fixreg[i]);
-  RF (PPC_LR_REGNUM, inferior_registers.lr);
-  RF (PPC_CR_REGNUM, inferior_registers.cr);
-  RF (PPC_XER_REGNUM, inferior_registers.xer);
-  RF (PPC_CTR_REGNUM, inferior_registers.ctr);
-  RF (PC_REGNUM, inferior_registers.pc);
-
-#ifdef PT_GETFPREGS
-  ptrace (PT_GETFPREGS, inferior_pid,
-         (PTRACE_ARG3_TYPE) & inferior_fp_registers, 0);
-  for (i = 0; i < 32; i++)
-    RF (FP0_REGNUM + i, inferior_fp_registers.r_regs[i]);
-#endif
-}
-
-/* Store our register values back into the inferior.
-   If REGNO is -1, do this for all registers.
-   Otherwise, REGNO specifies which register (so we can save time).  */
-
-void
-store_inferior_registers (int regno)
-{
-  struct reg inferior_registers;
-#ifdef PT_SETFPREGS
-  struct fpreg inferior_fp_registers;
-#endif
-  int i;
-
-  for (i = 0; i < 32; i++)
-    RS (i, inferior_registers.fixreg[i]);
-  RS (PPC_LR_REGNUM, inferior_registers.lr);
-  RS (PPC_CR_REGNUM, inferior_registers.cr);
-  RS (PPC_XER_REGNUM, inferior_registers.xer);
-  RS (PPC_CTR_REGNUM, inferior_registers.ctr);
-  RS (PC_REGNUM, inferior_registers.pc);
-  ptrace (PT_SETREGS, inferior_pid,
-         (PTRACE_ARG3_TYPE) & inferior_registers, 0);
-
-#ifdef PT_SETFPREGS
-  for (i = 0; i < 32; i++)
-    RS (FP0_REGNUM + i, inferior_fp_registers.r_regs[i]);
-  ptrace (PT_SETFPREGS, inferior_pid,
-         (PTRACE_ARG3_TYPE) & inferior_fp_registers, 0);
-#endif
-}
-#endif /* !__powerpc__ */
-
-/* NOTE! I tried using PTRACE_READDATA, etc., to read and write memory
-   in the NEW_SUN_PTRACE case.
-   It ought to be straightforward.  But it appears that writing did
-   not write the data that I specified.  I cannot understand where
-   it got the data that it actually did write.  */
-
-/* Copy LEN bytes from inferior's memory starting at MEMADDR
-   to debugger memory starting at MYADDR.  */
-
-void
-read_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len)
-{
-  register int i;
-  /* Round starting address down to longword boundary.  */
-  register CORE_ADDR addr = memaddr & -(CORE_ADDR) sizeof (int);
-  /* Round ending address up; get number of longwords that makes.  */
-  register int count
-  = (((memaddr + len) - addr) + sizeof (int) - 1) / sizeof (int);
-  /* Allocate buffer of that many longwords.  */
-  register int *buffer = (int *) alloca (count * sizeof (int));
-
-  /* Read all the longwords */
-  for (i = 0; i < count; i++, addr += sizeof (int))
-    {
-      buffer[i] = ptrace (PT_READ_D, inferior_pid, (PTRACE_ARG3_TYPE) addr, 0);
-    }
-
-  /* Copy appropriate bytes out of the buffer.  */
-  memcpy (myaddr, (char *) buffer + (memaddr & (sizeof (int) - 1)), len);
-}
-
-/* Copy LEN bytes of data from debugger memory at MYADDR
-   to inferior's memory at MEMADDR.
-   On failure (cannot write the inferior)
-   returns the value of errno.  */
-
-int
-write_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len)
-{
-  register int i;
-  /* Round starting address down to longword boundary.  */
-  register CORE_ADDR addr = memaddr & -(CORE_ADDR) sizeof (int);
-  /* Round ending address up; get number of longwords that makes.  */
-  register int count
-  = (((memaddr + len) - addr) + sizeof (int) - 1) / sizeof (int);
-  /* Allocate buffer of that many longwords.  */
-  register int *buffer = (int *) alloca (count * sizeof (int));
-  extern int errno;
-
-  /* Fill start and end extra bytes of buffer with existing memory data.  */
-
-  buffer[0] = ptrace (PT_READ_D, inferior_pid, (PTRACE_ARG3_TYPE) addr, 0);
-
-  if (count > 1)
-    {
-      buffer[count - 1]
-       = ptrace (PT_READ_D, inferior_pid,
-                 (PTRACE_ARG3_TYPE) addr + (count - 1) * sizeof (int), 0);
-    }
-
-  /* Copy data to be written over corresponding part of buffer */
-
-  memcpy ((char *) buffer + (memaddr & (sizeof (int) - 1)), myaddr, len);
-
-  /* Write the entire buffer.  */
-
-  for (i = 0; i < count; i++, addr += sizeof (int))
-    {
-      errno = 0;
-      ptrace (PT_WRITE_D, inferior_pid, (PTRACE_ARG3_TYPE) addr, buffer[i]);
-      if (errno)
-       return errno;
-    }
-
-  return 0;
-}
-\f
-void 
-initialize_low (void)
-{
-  initialize_arch ();
-}
diff --git a/gdb/gdbserver/low-sim.c b/gdb/gdbserver/low-sim.c
deleted file mode 100644 (file)
index 86a0406..0000000
+++ /dev/null
@@ -1,269 +0,0 @@
-/* Low level interface to simulators, for the remote server for GDB.
-   Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
-   Free Software Foundation, Inc.
-
-   This file is part of GDB.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
-
-#include "server.h"
-#include "bfd.h"
-#include "callback.h"          /* GDB simulator callback interface */
-#include "remote-sim.h"                /* GDB simulator interface */
-
-extern int remote_debug;
-
-extern host_callback default_callback; /* in sim/common/callback.c */
-
-static char my_registers[REGISTER_BYTES] __attribute__ ((aligned));
-char * registers = my_registers;
-
-int target_byte_order;         /* used by simulator */
-
-/* We record the result of sim_open so we can pass it
-   back to the other sim_foo routines.  */
-static SIM_DESC gdbsim_desc = 0;
-
-/* This version of "load" should be usable for any simulator that
-   does not support loading itself.  */
-
-static void
-mygeneric_load (bfd *loadfile_bfd)
-{
-  asection *s;
-
-  for (s = loadfile_bfd->sections; s; s = s->next)
-    {
-      if (s->flags & SEC_LOAD)
-       {
-         bfd_size_type size;
-
-         size = bfd_get_section_size_before_reloc (s);
-         if (size > 0)
-           {
-             char *buffer;
-             bfd_vma lma;      /* use load address, not virtual address */
-
-             buffer = xmalloc (size);
-             lma = s->lma;
-
-             /* Is this really necessary?  I guess it gives the user something
-                to look at during a long download.  */
-             printf ("Loading section %s, size 0x%lx lma 0x%lx\n",
-                     bfd_get_section_name (loadfile_bfd, s),
-                     (unsigned long) size,
-                     (unsigned long) lma);     /* chops high 32 bits.  FIXME!! */
-
-             bfd_get_section_contents (loadfile_bfd, s, buffer, 0, size);
-
-             write_inferior_memory (lma, buffer, size);
-             free (buffer);
-           }
-       }
-    }
-
-  printf ("Start address 0x%lx\n",
-         (unsigned long) loadfile_bfd->start_address);
-
-  /* We were doing this in remote-mips.c, I suspect it is right
-     for other targets too.  */
-  /* write_pc (loadfile_bfd->start_address); *//* FIXME!! */
-}
-
-int
-create_inferior (char *program, char **argv)
-{
-  bfd *abfd;
-  int pid = 0;
-  char **new_argv;
-  int nargs;
-
-  abfd = bfd_openr (program, 0);
-  if (!abfd)
-    {
-      fprintf (stderr, "gdbserver: can't open %s: %s\n",
-              program, bfd_errmsg (bfd_get_error ()));
-      exit (1);
-    }
-
-  if (!bfd_check_format (abfd, bfd_object))
-    {
-      fprintf (stderr, "gdbserver: unknown load format for %s: %s\n",
-              program, bfd_errmsg (bfd_get_error ()));
-      exit (1);
-    }
-
-  /* Add "-E big" or "-E little" to the argument list depending on the
-     endianness of the program to be loaded.  */
-  for (nargs = 0; argv[nargs] != NULL; nargs++)                /* count the args */
-    ;
-  new_argv = alloca (sizeof (char *) * (nargs + 3));   /* allocate new args */
-  for (nargs = 0; argv[nargs] != NULL; nargs++)                /* copy old to new */
-    new_argv[nargs] = argv[nargs];
-  new_argv[nargs] = "-E";
-  new_argv[nargs + 1] = bfd_big_endian (abfd) ? "big" : "little";
-  new_argv[nargs + 2] = NULL;
-  argv = new_argv;
-
-  /* Create an instance of the simulator.  */
-  default_callback.init (&default_callback);
-  gdbsim_desc = sim_open (SIM_OPEN_STANDALONE, &default_callback, abfd, argv);
-  if (gdbsim_desc == 0)
-    exit (1);
-
-  /* Load the program into the simulator.  */
-  if (abfd)
-    if (sim_load (gdbsim_desc, program, NULL, 0) == SIM_RC_FAIL)
-      mygeneric_load (abfd);
-
-  /* Create an inferior process in the simulator.  This initializes SP.  */
-  sim_create_inferior (gdbsim_desc, abfd, argv, /* env */ NULL);
-  sim_resume (gdbsim_desc, 1, 0);      /* execute one instr */
-  return pid;
-}
-
-/* Attaching is not supported.  */
-int
-myattach (int pid)
-{
-  return -1;
-}
-
-/* Kill the inferior process.  Make us have no inferior.  */
-
-void
-kill_inferior (void)
-{
-  sim_close (gdbsim_desc, 0);
-  default_callback.shutdown (&default_callback);
-}
-
-/* Fetch one register.  */
-
-static void
-fetch_register (int regno)
-{
-  sim_fetch_register (gdbsim_desc, regno, &registers[REGISTER_BYTE (regno)],
-                     REGISTER_RAW_SIZE (regno));
-}
-
-/* Fetch all registers, or just one, from the child process.  */
-
-void
-fetch_inferior_registers (int regno)
-{
-  if (regno == -1 || regno == 0)
-    for (regno = 0; regno < NUM_REGS /*-NUM_FREGS*/ ; regno++)
-      fetch_register (regno);
-  else
-    fetch_register (regno);
-}
-
-/* Store our register values back into the inferior.
-   If REGNO is -1, do this for all registers.
-   Otherwise, REGNO specifies which register (so we can save time).  */
-
-void
-store_inferior_registers (int regno)
-{
-  if (regno == -1)
-    {
-      for (regno = 0; regno < NUM_REGS; regno++)
-       store_inferior_registers (regno);
-    }
-  else
-    sim_store_register (gdbsim_desc, regno, &registers[REGISTER_BYTE (regno)],
-                       REGISTER_RAW_SIZE (regno));
-}
-
-/* Return nonzero if the given thread is still alive.  */
-int
-mythread_alive (int pid)
-{
-  return 1;
-}
-
-/* Wait for process, returns status */
-
-unsigned char
-mywait (char *status)
-{
-  int sigrc;
-  enum sim_stop reason;
-
-  sim_stop_reason (gdbsim_desc, &reason, &sigrc);
-  switch (reason)
-    {
-    case sim_exited:
-      if (remote_debug)
-       printf ("\nChild exited with retcode = %x \n", sigrc);
-      *status = 'W';
-      return sigrc;
-
-#if 0
-    case sim_stopped:
-      if (remote_debug)
-       printf ("\nChild terminated with signal = %x \n", sigrc);
-      *status = 'X';
-      return sigrc;
-#endif
-
-    default:                   /* should this be sim_signalled or sim_stopped?  FIXME!! */
-      if (remote_debug)
-       printf ("\nChild received signal = %x \n", sigrc);
-      fetch_inferior_registers (0);
-      *status = 'T';
-      return (unsigned char) sigrc;
-    }
-}
-
-/* Resume execution of the inferior process.
-   If STEP is nonzero, single-step it.
-   If SIGNAL is nonzero, give it that signal.  */
-
-void
-myresume (int step, int signo)
-{
-  /* Should be using target_signal_to_host() or signal numbers in target.h
-     to convert GDB signal number to target signal number.  */
-  sim_resume (gdbsim_desc, step, signo);
-}
-
-/* Copy LEN bytes from inferior's memory starting at MEMADDR
-   to debugger memory starting at MYADDR.  */
-
-void
-read_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len)
-{
-  sim_read (gdbsim_desc, memaddr, myaddr, len);
-}
-
-/* Copy LEN bytes of data from debugger memory at MYADDR
-   to inferior's memory at MEMADDR.
-   On failure (cannot write the inferior)
-   returns the value of errno.  */
-
-int
-write_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len)
-{
-  sim_write (gdbsim_desc, memaddr, myaddr, len);       /* should check for error.  FIXME!! */
-  return 0;
-}
-
-void
-initialize_low (void)
-{
-}
diff --git a/gdb/gdbserver/low-sparc.c b/gdb/gdbserver/low-sparc.c
deleted file mode 100644 (file)
index 4b03140..0000000
+++ /dev/null
@@ -1,314 +0,0 @@
-/* Low level interface to ptrace, for the remote server for GDB.
-   Copyright 1986, 1987, 1993, 1994, 1995, 1997, 1999, 2000, 2001, 2002
-   Free Software Foundation, Inc.
-
-   This file is part of GDB.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
-
-#include "server.h"
-#include <sys/wait.h>
-#include "frame.h"
-#include "inferior.h"
-/***************************
-#include "initialize.h"
-****************************/
-
-#include <stdio.h>
-#include <sys/param.h>
-#include <sys/dir.h>
-#include <sys/user.h>
-#include <signal.h>
-#include <sys/ioctl.h>
-#include <sgtty.h>
-#include <fcntl.h>
-
-/***************Begin MY defs*********************/
-static char my_registers[REGISTER_BYTES];
-char *registers = my_registers;
-/***************End MY defs*********************/
-
-#include <sys/ptrace.h>
-#include <sys/reg.h>
-
-extern int sys_nerr;
-extern char **sys_errlist;
-extern int errno;
-
-/* Start an inferior process and returns its pid.
-   ALLARGS is a vector of program-name and args. */
-
-int
-create_inferior (char *program, char **allargs)
-{
-  int pid;
-
-  pid = fork ();
-  if (pid < 0)
-    perror_with_name ("fork");
-
-  if (pid == 0)
-    {
-      ptrace (PTRACE_TRACEME);
-
-      execv (program, allargs);
-
-      fprintf (stderr, "Cannot exec %s: %s.\n", program,
-              errno < sys_nerr ? sys_errlist[errno] : "unknown error");
-      fflush (stderr);
-      _exit (0177);
-    }
-
-  return pid;
-}
-
-/* Attaching is not supported.  */
-int
-myattach (int pid)
-{
-  return -1;
-}
-
-/* Kill the inferior process.  Make us have no inferior.  */
-
-void
-kill_inferior (void)
-{
-  if (inferior_pid == 0)
-    return;
-  ptrace (8, inferior_pid, 0, 0);
-  wait (0);
-/*************inferior_died ();****VK**************/
-}
-
-/* Return nonzero if the given thread is still alive.  */
-int
-mythread_alive (int pid)
-{
-  return 1;
-}
-
-/* Wait for process, returns status */
-
-unsigned char
-mywait (char *status)
-{
-  int pid;
-  union wait w;
-
-  enable_async_io ();
-  pid = waitpid (inferior_pid, &w, 0);
-  disable_async_io ();
-  if (pid != inferior_pid)
-    perror_with_name ("wait");
-
-  if (WIFEXITED (w))
-    {
-      fprintf (stderr, "\nChild exited with retcode = %x \n", WEXITSTATUS (w));
-      *status = 'W';
-      return ((unsigned char) WEXITSTATUS (w));
-    }
-  else if (!WIFSTOPPED (w))
-    {
-      fprintf (stderr, "\nChild terminated with signal = %x \n", WTERMSIG (w));
-      *status = 'X';
-      return ((unsigned char) WTERMSIG (w));
-    }
-
-  fetch_inferior_registers (0);
-
-  *status = 'T';
-  return ((unsigned char) WSTOPSIG (w));
-}
-
-/* Resume execution of the inferior process.
-   If STEP is nonzero, single-step it.
-   If SIGNAL is nonzero, give it that signal.  */
-
-void
-myresume (int step, int signal)
-{
-  errno = 0;
-  ptrace (step ? PTRACE_SINGLESTEP : PTRACE_CONT, inferior_pid, 1, signal);
-  if (errno)
-    perror_with_name ("ptrace");
-}
-
-/* Fetch one or more registers from the inferior.  REGNO == -1 to get
-   them all.  We actually fetch more than requested, when convenient,
-   marking them as valid so we won't fetch them again.  */
-
-void
-fetch_inferior_registers (int ignored)
-{
-  struct regs inferior_registers;
-  struct fp_status inferior_fp_registers;
-  int i;
-
-  /* Global and Out regs are fetched directly, as well as the control
-     registers.  If we're getting one of the in or local regs,
-     and the stack pointer has not yet been fetched,
-     we have to do that first, since they're found in memory relative
-     to the stack pointer.  */
-
-  if (ptrace (PTRACE_GETREGS, inferior_pid,
-             (PTRACE_ARG3_TYPE) & inferior_registers, 0))
-    perror ("ptrace_getregs");
-
-  registers[REGISTER_BYTE (0)] = 0;
-  memcpy (&registers[REGISTER_BYTE (1)], &inferior_registers.r_g1,
-         15 * REGISTER_RAW_SIZE (G0_REGNUM));
-  *(int *) &registers[REGISTER_BYTE (PS_REGNUM)] = inferior_registers.r_ps;
-  *(int *) &registers[REGISTER_BYTE (PC_REGNUM)] = inferior_registers.r_pc;
-  *(int *) &registers[REGISTER_BYTE (NPC_REGNUM)] = inferior_registers.r_npc;
-  *(int *) &registers[REGISTER_BYTE (Y_REGNUM)] = inferior_registers.r_y;
-
-  /* Floating point registers */
-
-  if (ptrace (PTRACE_GETFPREGS, inferior_pid,
-             (PTRACE_ARG3_TYPE) & inferior_fp_registers,
-             0))
-    perror ("ptrace_getfpregs");
-  memcpy (&registers[REGISTER_BYTE (FP0_REGNUM)], &inferior_fp_registers,
-         sizeof inferior_fp_registers.fpu_fr);
-
-  /* These regs are saved on the stack by the kernel.  Only read them
-     all (16 ptrace calls!) if we really need them.  */
-
-  read_inferior_memory (*(CORE_ADDR *) & registers[REGISTER_BYTE (SP_REGNUM)],
-                       &registers[REGISTER_BYTE (L0_REGNUM)],
-                       16 * REGISTER_RAW_SIZE (L0_REGNUM));
-}
-
-/* Store our register values back into the inferior.
-   If REGNO is -1, do this for all registers.
-   Otherwise, REGNO specifies which register (so we can save time).  */
-
-void
-store_inferior_registers (int ignored)
-{
-  struct regs inferior_registers;
-  struct fp_status inferior_fp_registers;
-  CORE_ADDR sp = *(CORE_ADDR *) & registers[REGISTER_BYTE (SP_REGNUM)];
-
-  write_inferior_memory (sp, &registers[REGISTER_BYTE (L0_REGNUM)],
-                        16 * REGISTER_RAW_SIZE (L0_REGNUM));
-
-  memcpy (&inferior_registers.r_g1, &registers[REGISTER_BYTE (G1_REGNUM)],
-         15 * REGISTER_RAW_SIZE (G1_REGNUM));
-
-  inferior_registers.r_ps =
-    *(int *) &registers[REGISTER_BYTE (PS_REGNUM)];
-  inferior_registers.r_pc =
-    *(int *) &registers[REGISTER_BYTE (PC_REGNUM)];
-  inferior_registers.r_npc =
-    *(int *) &registers[REGISTER_BYTE (NPC_REGNUM)];
-  inferior_registers.r_y =
-    *(int *) &registers[REGISTER_BYTE (Y_REGNUM)];
-
-  if (ptrace (PTRACE_SETREGS, inferior_pid,
-             (PTRACE_ARG3_TYPE) & inferior_registers, 0))
-    perror ("ptrace_setregs");
-
-  memcpy (&inferior_fp_registers, &registers[REGISTER_BYTE (FP0_REGNUM)],
-         sizeof inferior_fp_registers.fpu_fr);
-
-  if (ptrace (PTRACE_SETFPREGS, inferior_pid,
-             (PTRACE_ARG3_TYPE) & inferior_fp_registers, 0))
-    perror ("ptrace_setfpregs");
-}
-
-/* NOTE! I tried using PTRACE_READDATA, etc., to read and write memory
-   in the NEW_SUN_PTRACE case.
-   It ought to be straightforward.  But it appears that writing did
-   not write the data that I specified.  I cannot understand where
-   it got the data that it actually did write.  */
-
-/* Copy LEN bytes from inferior's memory starting at MEMADDR
-   to debugger memory starting at MYADDR.  */
-
-void
-read_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len)
-{
-  register int i;
-  /* Round starting address down to longword boundary.  */
-  register CORE_ADDR addr = memaddr & -(CORE_ADDR) sizeof (int);
-  /* Round ending address up; get number of longwords that makes.  */
-  register int count
-  = (((memaddr + len) - addr) + sizeof (int) - 1) / sizeof (int);
-  /* Allocate buffer of that many longwords.  */
-  register int *buffer = (int *) alloca (count * sizeof (int));
-
-  /* Read all the longwords */
-  for (i = 0; i < count; i++, addr += sizeof (int))
-    {
-      buffer[i] = ptrace (1, inferior_pid, addr, 0);
-    }
-
-  /* Copy appropriate bytes out of the buffer.  */
-  memcpy (myaddr, (char *) buffer + (memaddr & (sizeof (int) - 1)), len);
-}
-
-/* Copy LEN bytes of data from debugger memory at MYADDR
-   to inferior's memory at MEMADDR.
-   On failure (cannot write the inferior)
-   returns the value of errno.  */
-
-int
-write_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len)
-{
-  register int i;
-  /* Round starting address down to longword boundary.  */
-  register CORE_ADDR addr = memaddr & -(CORE_ADDR) sizeof (int);
-  /* Round ending address up; get number of longwords that makes.  */
-  register int count
-  = (((memaddr + len) - addr) + sizeof (int) - 1) / sizeof (int);
-  /* Allocate buffer of that many longwords.  */
-  register int *buffer = (int *) alloca (count * sizeof (int));
-  extern int errno;
-
-  /* Fill start and end extra bytes of buffer with existing memory data.  */
-
-  buffer[0] = ptrace (1, inferior_pid, addr, 0);
-
-  if (count > 1)
-    {
-      buffer[count - 1]
-       = ptrace (1, inferior_pid,
-                 addr + (count - 1) * sizeof (int), 0);
-    }
-
-  /* Copy data to be written over corresponding part of buffer */
-
-  bcopy (myaddr, (char *) buffer + (memaddr & (sizeof (int) - 1)), len);
-
-  /* Write the entire buffer.  */
-
-  for (i = 0; i < count; i++, addr += sizeof (int))
-    {
-      errno = 0;
-      ptrace (4, inferior_pid, addr, buffer[i]);
-      if (errno)
-       return errno;
-    }
-
-  return 0;
-}
-\f
-void
-initialize_low (void)
-{
-}
diff --git a/gdb/gdbserver/low-sun3.c b/gdb/gdbserver/low-sun3.c
deleted file mode 100644 (file)
index ccaded8..0000000
+++ /dev/null
@@ -1,291 +0,0 @@
-/* Low level interface to ptrace, for the remote server for GDB.
-   Copyright 1986, 1987, 1993, 1994, 1995, 1999, 2000, 2001, 2002
-   Free Software Foundation, Inc.
-
-   This file is part of GDB.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
-
-#include "server.h"
-#include "<sys/wait.h>"
-#include "frame.h"
-#include "inferior.h"
-
-#include <stdio.h>
-#include <sys/param.h>
-#include <sys/dir.h>
-#include <sys/user.h>
-#include <signal.h>
-#include <sys/ioctl.h>
-#include <sgtty.h>
-#include <fcntl.h>
-
-/***************Begin MY defs*********************/
-static char my_registers[REGISTER_BYTES];
-char *registers = my_registers;
-/***************End MY defs*********************/
-
-#include <sys/ptrace.h>
-#include <machine/reg.h>
-
-extern int sys_nerr;
-extern char **sys_errlist;
-extern int errno;
-
-/* Start an inferior process and returns its pid.
-   ALLARGS is a vector of program-name and args. */
-
-int
-create_inferior (char *program, char **allargs)
-{
-  int pid;
-
-  pid = fork ();
-  if (pid < 0)
-    perror_with_name ("fork");
-
-  if (pid == 0)
-    {
-      ptrace (PTRACE_TRACEME);
-
-      execv (program, allargs);
-
-      fprintf (stderr, "Cannot exec %s: %s.\n", program,
-              errno < sys_nerr ? sys_errlist[errno] : "unknown error");
-      fflush (stderr);
-      _exit (0177);
-    }
-
-  return pid;
-}
-
-/* Attaching is not supported.  */
-int
-myattach (int pid)
-{
-  return -1;
-}
-
-/* Kill the inferior process.  Make us have no inferior.  */
-
-void
-kill_inferior (void)
-{
-  if (inferior_pid == 0)
-    return;
-  ptrace (8, inferior_pid, 0, 0);
-  wait (0);
-/*************inferior_died ();****VK**************/
-}
-
-/* Return nonzero if the given thread is still alive.  */
-int
-mythread_alive (int pid)
-{
-  return 1;
-}
-
-/* Wait for process, returns status */
-
-unsigned char
-mywait (char *status)
-{
-  int pid;
-  union wait w;
-
-  pid = wait (&w);
-  if (pid != inferior_pid)
-    perror_with_name ("wait");
-
-  if (WIFEXITED (w))
-    {
-      fprintf (stderr, "\nChild exited with retcode = %x \n", WEXITSTATUS (w));
-      *status = 'W';
-      return ((unsigned char) WEXITSTATUS (w));
-    }
-  else if (!WIFSTOPPED (w))
-    {
-      fprintf (stderr, "\nChild terminated with signal = %x \n", WTERMSIG (w));
-      *status = 'X';
-      return ((unsigned char) WTERMSIG (w));
-    }
-
-  fetch_inferior_registers (0);
-
-  *status = 'T';
-  return ((unsigned char) WSTOPSIG (w));
-}
-
-/* Resume execution of the inferior process.
-   If STEP is nonzero, single-step it.
-   If SIGNAL is nonzero, give it that signal.  */
-
-void
-myresume (int step, int signal)
-{
-  errno = 0;
-  ptrace (step ? PTRACE_SINGLESTEP : PTRACE_CONT, inferior_pid, 1, signal);
-  if (errno)
-    perror_with_name ("ptrace");
-}
-
-/* Fetch one or more registers from the inferior.  REGNO == -1 to get
-   them all.  We actually fetch more than requested, when convenient,
-   marking them as valid so we won't fetch them again.  */
-
-void
-fetch_inferior_registers (int ignored)
-{
-  struct regs inferior_registers;
-  struct fp_status inferior_fp_registers;
-
-  ptrace (PTRACE_GETREGS, inferior_pid,
-         (PTRACE_ARG3_TYPE) & inferior_registers);
-#ifdef FP0_REGNUM
-  ptrace (PTRACE_GETFPREGS, inferior_pid,
-         (PTRACE_ARG3_TYPE) & inferior_fp_registers);
-#endif
-
-  memcpy (registers, &inferior_registers, 16 * 4);
-#ifdef FP0_REGNUM
-  memcpy (&registers[REGISTER_BYTE (FP0_REGNUM)], &inferior_fp_registers,
-         sizeof inferior_fp_registers.fps_regs);
-#endif
-  *(int *) &registers[REGISTER_BYTE (PS_REGNUM)] = inferior_registers.r_ps;
-  *(int *) &registers[REGISTER_BYTE (PC_REGNUM)] = inferior_registers.r_pc;
-#ifdef FP0_REGNUM
-  memcpy
-    (&registers[REGISTER_BYTE (FPC_REGNUM)],
-     &inferior_fp_registers.fps_control,
-     sizeof inferior_fp_registers - sizeof inferior_fp_registers.fps_regs);
-#endif
-}
-
-/* Store our register values back into the inferior.
-   If REGNO is -1, do this for all registers.
-   Otherwise, REGNO specifies which register (so we can save time).  */
-
-void
-store_inferior_registers (int ignored)
-{
-  struct regs inferior_registers;
-  struct fp_status inferior_fp_registers;
-
-  memcpy (&inferior_registers, registers, 16 * 4);
-#ifdef FP0_REGNUM
-  memcpy (&inferior_fp_registers,
-         &registers[REGISTER_BYTE (FP0_REGNUM)],
-         sizeof inferior_fp_registers.fps_regs);
-#endif
-  inferior_registers.r_ps = *(int *) &registers[REGISTER_BYTE (PS_REGNUM)];
-  inferior_registers.r_pc = *(int *) &registers[REGISTER_BYTE (PC_REGNUM)];
-
-#ifdef FP0_REGNUM
-  memcpy (&inferior_fp_registers.fps_control,
-         &registers[REGISTER_BYTE (FPC_REGNUM)],
-         (sizeof inferior_fp_registers
-          - sizeof inferior_fp_registers.fps_regs));
-#endif
-
-  ptrace (PTRACE_SETREGS, inferior_pid,
-         (PTRACE_ARG3_TYPE) & inferior_registers);
-#if FP0_REGNUM
-  ptrace (PTRACE_SETFPREGS, inferior_pid,
-         (PTRACE_ARG3_TYPE) & inferior_fp_registers);
-#endif
-}
-
-/* NOTE! I tried using PTRACE_READDATA, etc., to read and write memory
-   in the NEW_SUN_PTRACE case.
-   It ought to be straightforward.  But it appears that writing did
-   not write the data that I specified.  I cannot understand where
-   it got the data that it actually did write.  */
-
-/* Copy LEN bytes from inferior's memory starting at MEMADDR
-   to debugger memory starting at MYADDR.  */
-
-void
-read_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len)
-{
-  register int i;
-  /* Round starting address down to longword boundary.  */
-  register CORE_ADDR addr = memaddr & -(CORE_ADDR) sizeof (int);
-  /* Round ending address up; get number of longwords that makes.  */
-  register int count
-  = (((memaddr + len) - addr) + sizeof (int) - 1) / sizeof (int);
-  /* Allocate buffer of that many longwords.  */
-  register int *buffer = (int *) alloca (count * sizeof (int));
-
-  /* Read all the longwords */
-  for (i = 0; i < count; i++, addr += sizeof (int))
-    {
-      buffer[i] = ptrace (1, inferior_pid, addr, 0);
-    }
-
-  /* Copy appropriate bytes out of the buffer.  */
-  memcpy (myaddr, (char *) buffer + (memaddr & (sizeof (int) - 1)), len);
-}
-
-/* Copy LEN bytes of data from debugger memory at MYADDR
-   to inferior's memory at MEMADDR.
-   On failure (cannot write the inferior)
-   returns the value of errno.  */
-
-int
-write_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len)
-{
-  register int i;
-  /* Round starting address down to longword boundary.  */
-  register CORE_ADDR addr = memaddr & -(CORE_ADDR) sizeof (int);
-  /* Round ending address up; get number of longwords that makes.  */
-  register int count
-  = (((memaddr + len) - addr) + sizeof (int) - 1) / sizeof (int);
-  /* Allocate buffer of that many longwords.  */
-  register int *buffer = (int *) alloca (count * sizeof (int));
-  extern int errno;
-
-  /* Fill start and end extra bytes of buffer with existing memory data.  */
-
-  buffer[0] = ptrace (1, inferior_pid, addr, 0);
-
-  if (count > 1)
-    {
-      buffer[count - 1]
-       = ptrace (1, inferior_pid,
-                 addr + (count - 1) * sizeof (int), 0);
-    }
-
-  /* Copy data to be written over corresponding part of buffer */
-
-  memcpy ((char *) buffer + (memaddr & (sizeof (int) - 1)), myaddr, len);
-
-  /* Write the entire buffer.  */
-
-  for (i = 0; i < count; i++, addr += sizeof (int))
-    {
-      errno = 0;
-      ptrace (4, inferior_pid, addr, buffer[i]);
-      if (errno)
-       return errno;
-    }
-
-  return 0;
-}
-\f
-void
-initialize_low (void)
-{
-}
This page took 0.051434 seconds and 4 git commands to generate.