* elf32-ppc.h: New file.
[deliverable/binutils-gdb.git] / gdb / gdbserver / low-sun3.c
index c84b79f2f684b3edcdf49e6d5956f1fa787df633..ccaded826cca9d0bf1b2ad68bb5b4b34c8d8413f 100644 (file)
@@ -1,23 +1,25 @@
 /* Low level interface to ptrace, for the remote server for GDB.
-   Copyright (C) 1986, 1987, 1993 Free Software Foundation, Inc.
+   Copyright 1986, 1987, 1993, 1994, 1995, 1999, 2000, 2001, 2002
+   Free Software Foundation, Inc.
 
-This file is part of GDB.
+   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 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.
+   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.  */
+   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 "defs.h"
+#include "server.h"
 #include "<sys/wait.h>"
 #include "frame.h"
 #include "inferior.h"
@@ -32,14 +34,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #include <fcntl.h>
 
 /***************Begin MY defs*********************/
-int quit_flag = 0;
-char registers[REGISTER_BYTES];
-
-/* Index within `registers' of the first byte of the space for
-   register N.  */
-
-
-char buf2[MAX_REGISTER_RAW_SIZE];
+static char my_registers[REGISTER_BYTES];
+char *registers = my_registers;
 /***************End MY defs*********************/
 
 #include <sys/ptrace.h>
@@ -47,20 +43,13 @@ char buf2[MAX_REGISTER_RAW_SIZE];
 
 extern int sys_nerr;
 extern char **sys_errlist;
-extern char **environ;
 extern int errno;
-extern int inferior_pid;
-void quit (), perror_with_name ();
-int query ();
 
 /* Start an inferior process and returns its pid.
-   ALLARGS is a vector of program-name and args.
-   ENV is the environment vector to pass.  */
+   ALLARGS is a vector of program-name and args. */
 
 int
-create_inferior (program, allargs)
-     char *program;
-     char **allargs;
+create_inferior (char *program, char **allargs)
 {
   int pid;
 
@@ -83,22 +72,28 @@ create_inferior (program, allargs)
   return pid;
 }
 
+/* Attaching is not supported.  */
+int
+myattach (int pid)
+{
+  return -1;
+}
+
 /* Kill the inferior process.  Make us have no inferior.  */
 
 void
-kill_inferior ()
+kill_inferior (void)
 {
   if (inferior_pid == 0)
     return;
   ptrace (8, inferior_pid, 0, 0);
   wait (0);
-  /*************inferior_died ();****VK**************/
+/*************inferior_died ();****VK**************/
 }
 
 /* Return nonzero if the given thread is still alive.  */
 int
-mythread_alive (pid)
-     int pid;
+mythread_alive (int pid)
 {
   return 1;
 }
@@ -106,8 +101,7 @@ mythread_alive (pid)
 /* Wait for process, returns status */
 
 unsigned char
-mywait (status)
-     char *status;
+mywait (char *status)
 {
   int pid;
   union wait w;
@@ -140,9 +134,7 @@ mywait (status)
    If SIGNAL is nonzero, give it that signal.  */
 
 void
-myresume (step, signal)
-     int step;
-     int signal;
+myresume (int step, int signal)
 {
   errno = 0;
   ptrace (step ? PTRACE_SINGLESTEP : PTRACE_CONT, inferior_pid, 1, signal);
@@ -155,32 +147,31 @@ myresume (step, signal)
    marking them as valid so we won't fetch them again.  */
 
 void
-fetch_inferior_registers (ignored)
-     int ignored;
+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);
+         (PTRACE_ARG3_TYPE) & inferior_registers);
 #ifdef FP0_REGNUM
   ptrace (PTRACE_GETFPREGS, inferior_pid,
-         (PTRACE_ARG3_TYPE) &inferior_fp_registers);
-#endif 
-  
+         (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;
+#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 
+#endif
 }
 
 /* Store our register values back into the inferior.
@@ -188,8 +179,7 @@ fetch_inferior_registers (ignored)
    Otherwise, REGNO specifies which register (so we can save time).  */
 
 void
-store_inferior_registers (ignored)
-     int ignored;
+store_inferior_registers (int ignored)
 {
   struct regs inferior_registers;
   struct fp_status inferior_fp_registers;
@@ -200,8 +190,8 @@ store_inferior_registers (ignored)
          &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)];
+  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,
@@ -211,10 +201,10 @@ store_inferior_registers (ignored)
 #endif
 
   ptrace (PTRACE_SETREGS, inferior_pid,
-         (PTRACE_ARG3_TYPE) &inferior_registers);
+         (PTRACE_ARG3_TYPE) & inferior_registers);
 #if FP0_REGNUM
   ptrace (PTRACE_SETFPREGS, inferior_pid,
-         (PTRACE_ARG3_TYPE) &inferior_fp_registers);
+         (PTRACE_ARG3_TYPE) & inferior_fp_registers);
 #endif
 }
 
@@ -227,14 +217,12 @@ store_inferior_registers (ignored)
 /* Copy LEN bytes from inferior's memory starting at MEMADDR
    to debugger memory starting at MYADDR.  */
 
-read_inferior_memory (memaddr, myaddr, len)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
+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 & -sizeof (int);
+  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);
@@ -257,14 +245,11 @@ read_inferior_memory (memaddr, myaddr, len)
    returns the value of errno.  */
 
 int
-write_inferior_memory (memaddr, myaddr, len)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
+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 & -sizeof (int);
+  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);
@@ -301,13 +286,6 @@ write_inferior_memory (memaddr, myaddr, len)
 }
 \f
 void
-initialize ()
-{
-  inferior_pid = 0;
-}
-
-int
-have_inferior_p ()
+initialize_low (void)
 {
-  return inferior_pid != 0;
 }
This page took 0.03206 seconds and 4 git commands to generate.