Update/correct copyright notices.
[deliverable/binutils-gdb.git] / gdb / remote-os9k.c
index fd758b5a1b189c4c6173830e45d3899544faa52d..8694ee6a63c763c3533ece7bd63c5d5c85cd35ce 100644 (file)
@@ -1,5 +1,6 @@
 /* Remote debugging interface for boot monitors, for GDB.
-   Copyright 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
+   Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000,
+   2001 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -40,8 +41,6 @@
 #include "defs.h"
 #include "gdbcore.h"
 #include "target.h"
-#include "gdb_wait.h"
-#include <signal.h>
 #include "gdb_string.h"
 #include <sys/types.h>
 #include "command.h"
@@ -52,6 +51,7 @@
 #include "symfile.h"
 #include "objfiles.h"
 #include "gdb-stabs.h"
+#include "regcache.h"
 
 struct cmd_list_element *showlist;
 extern struct target_ops rombug_ops;   /* Forward declaration */
@@ -105,8 +105,7 @@ printf_monitor (char *pattern,...)
 
 /* Read a character from the remote system, doing all the fancy timeout stuff */
 static int
-readchar (timeout)
-     int timeout;
+readchar (int timeout)
 {
   int c;
 
@@ -136,9 +135,7 @@ readchar (timeout)
    non-zero, then discard non-matching input, else print it out.
    Let the user break out immediately.  */
 static void
-expect (string, discard)
-     char *string;
-     int discard;
+expect (char *string, int discard)
 {
   char *p = string;
   int c;
@@ -146,7 +143,7 @@ expect (string, discard)
   if (sr_get_debug ())
     printf ("Expecting \"%s\"\n", string);
 
-  immediate_quit = 1;
+  immediate_quit++;
   while (1)
     {
       c = readchar (timeout);
@@ -156,7 +153,7 @@ expect (string, discard)
        {
          if (*p == '\0')
            {
-             immediate_quit = 0;
+             immediate_quit--;
              if (sr_get_debug ())
                printf ("\nMatched\n");
              return;
@@ -190,8 +187,7 @@ expect (string, discard)
    necessary to prevent getting into states from which we can't
    recover.  */
 static void
-expect_prompt (discard)
-     int discard;
+expect_prompt (int discard)
 {
   if (monitor_log)
     /* This is a convenient place to do this.  The idea is to do it often
@@ -211,8 +207,7 @@ expect_prompt (discard)
 /* Get a hex digit from the remote system & return its value.
    If ignore_space is nonzero, ignore spaces (not newline, tab, etc).  */
 static int
-get_hex_digit (ignore_space)
-     int ignore_space;
+get_hex_digit (int ignore_space)
 {
   int ch;
   while (1)
@@ -237,8 +232,7 @@ get_hex_digit (ignore_space)
 /* Get a byte from monitor and put it in *BYT.  Accept any number
    leading spaces.  */
 static void
-get_hex_byte (byt)
-     char *byt;
+get_hex_byte (char *byt)
 {
   int val;
 
@@ -250,9 +244,7 @@ get_hex_byte (byt)
 /* Get N 32-bit words from remote, each preceded by a space,
    and put them in registers starting at REGNO.  */
 static void
-get_hex_regs (n, regno)
-     int n;
-     int regno;
+get_hex_regs (int n, int regno)
 {
   long val;
   int i;
@@ -278,10 +270,7 @@ get_hex_regs (n, regno)
 /* This is called not only when we first attach, but also when the
    user types "run" after having attached.  */
 static void
-rombug_create_inferior (execfile, args, env)
-     char *execfile;
-     char *args;
-     char **env;
+rombug_create_inferior (char *execfile, char *args, char **env)
 {
   int entry_pt;
 
@@ -310,9 +299,7 @@ rombug_create_inferior (execfile, args, env)
 static char dev_name[100];
 
 static void
-rombug_open (args, from_tty)
-     char *args;
-     int from_tty;
+rombug_open (char *args, int from_tty)
 {
   if (args == NULL)
     error ("Use `target RomBug DEVICE-NAME' to use a serial port, or \n\
@@ -380,8 +367,7 @@ rombug_open (args, from_tty)
  */
 
 static void
-rombug_close (quitting)
-     int quitting;
+rombug_close (int quitting)
 {
   if (rombug_is_open)
     {
@@ -401,9 +387,7 @@ rombug_close (quitting)
 }
 
 int
-rombug_link (mod_name, text_reloc)
-     char *mod_name;
-     CORE_ADDR *text_reloc;
+rombug_link (char *mod_name, CORE_ADDR *text_reloc)
 {
   int i, j;
   unsigned long val;
@@ -431,8 +415,7 @@ rombug_link (mod_name, text_reloc)
    Use this when you want to detach and do something else
    with your gdb.  */
 static void
-rombug_detach (from_tty)
-     int from_tty;
+rombug_detach (int from_tty)
 {
   if (attach_flag)
     {
@@ -448,9 +431,7 @@ rombug_detach (from_tty)
  * Tell the remote machine to resume.
  */
 static void
-rombug_resume (pid, step, sig)
-     int pid, step;
-     enum target_signal sig;
+rombug_resume (int pid, int step, enum target_signal sig)
 {
   if (monitor_log)
     fprintf (log_file, "\nIn Resume (step=%d, sig=%d)\n", step, sig);
@@ -480,9 +461,7 @@ rombug_resume (pid, step, sig)
  */
 
 static int
-rombug_wait (pid, status)
-     int pid;
-     struct target_waitstatus *status;
+rombug_wait (int pid, struct target_waitstatus *status)
 {
   int old_timeout = timeout;
   struct section_offsets *offs;
@@ -514,8 +493,8 @@ rombug_wait (pid, status)
        new_symfile_objfile (obj_sec->objfile, 1, 0);
       offs = (struct section_offsets *) alloca (SIZEOF_SECTION_OFFSETS);
       memcpy (offs, symfile_objfile->section_offsets, SIZEOF_SECTION_OFFSETS);
-      ANOFFSET (offs, SECT_OFF_DATA (symfile_objfile)) = addr;
-      ANOFFSET (offs, SECT_OFF_BSS (symfile_objfile)) = addr;
+      offs->offsets[SECT_OFF_DATA (symfile_objfile)]  = addr;
+      offs->offsets[SECT_OFF_BSS (symfile_objfile)]  = addr;
 
       objfile_relocate (symfile_objfile, offs);
     }
@@ -528,8 +507,7 @@ rombug_wait (pid, status)
    monitor wants.  Lets take advantage of that just as long as possible! */
 
 static char *
-get_reg_name (regno)
-     int regno;
+get_reg_name (int regno)
 {
   static char buf[50];
   char *p;
@@ -554,7 +532,7 @@ get_reg_name (regno)
 /* read the remote registers into the block regs.  */
 
 static void
-rombug_fetch_registers ()
+rombug_fetch_registers (void)
 {
   int regno, j, i;
   long val;
@@ -615,8 +593,7 @@ rombug_fetch_registers ()
 /* Fetch register REGNO, or all registers if REGNO is -1.
    Returns errno value.  */
 static void
-rombug_fetch_register (regno)
-     int regno;
+rombug_fetch_register (int regno)
 {
   int val, j;
   unsigned char b;
@@ -683,7 +660,7 @@ rombug_fetch_register (regno)
 /* Store the remote registers from the contents of the block REGS.  */
 
 static void
-rombug_store_registers ()
+rombug_store_registers (void)
 {
   int regno;
 
@@ -696,8 +673,7 @@ rombug_store_registers ()
 /* Store register REGNO, or all if REGNO == 0.
    return errno value.  */
 static void
-rombug_store_register (regno)
-     int regno;
+rombug_store_register (int regno)
 {
   char *name;
 
@@ -728,13 +704,13 @@ rombug_store_register (regno)
    debugged.  */
 
 static void
-rombug_prepare_to_store ()
+rombug_prepare_to_store (void)
 {
   /* Do nothing, since we can store individual regs */
 }
 
 static void
-rombug_files_info ()
+rombug_files_info (void)
 {
   printf ("\tAttached to %s at %d baud.\n",
          dev_name, sr_get_baud_rate ());
@@ -743,10 +719,7 @@ rombug_files_info ()
 /* Copy LEN bytes of data from debugger memory at MYADDR
    to inferior's memory at MEMADDR.  Returns length moved.  */
 static int
-rombug_write_inferior_memory (memaddr, myaddr, len)
-     CORE_ADDR memaddr;
-     unsigned char *myaddr;
-     int len;
+rombug_write_inferior_memory (CORE_ADDR memaddr, unsigned char *myaddr, int len)
 {
   int i;
   char buf[10];
@@ -776,10 +749,7 @@ rombug_write_inferior_memory (memaddr, myaddr, len)
 /* Read LEN bytes from inferior memory at MEMADDR.  Put the result
    at debugger address MYADDR.  Returns length moved.  */
 static int
-rombug_read_inferior_memory (memaddr, myaddr, len)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
+rombug_read_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len)
 {
   int i, j;
 
@@ -848,14 +818,17 @@ rombug_read_inferior_memory (memaddr, myaddr, len)
   return len;
 }
 
-/* FIXME-someday!  merge these two.  */
+/* Transfer LEN bytes between GDB address MYADDR and target address
+   MEMADDR.  If WRITE is non-zero, transfer them to the target,
+   otherwise transfer them from the target.  TARGET is unused.
+
+   Returns the number of bytes transferred. */
+
 static int
-rombug_xfer_inferior_memory (memaddr, myaddr, len, write, target)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
-     int write;
-     struct target_ops *target;        /* ignored */
+rombug_xfer_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len,
+                            int write, 
+                            struct mem_attrib *attrib ATTRIBUTE_UNUSED,
+                            struct target_ops *target ATTRIBUTE_UNUSED)
 {
   if (write)
     return rombug_write_inferior_memory (memaddr, myaddr, len);
@@ -864,9 +837,7 @@ rombug_xfer_inferior_memory (memaddr, myaddr, len, write, target)
 }
 
 static void
-rombug_kill (args, from_tty)
-     char *args;
-     int from_tty;
+rombug_kill (char *args, int from_tty)
 {
   return;                      /* ignore attempts to kill target system */
 }
@@ -877,7 +848,7 @@ rombug_kill (args, from_tty)
    instructions.  */
 
 static void
-rombug_mourn_inferior ()
+rombug_mourn_inferior (void)
 {
   remove_breakpoints ();
   generic_mourn_inferior ();   /* Do all the proper things now */
@@ -889,9 +860,7 @@ static CORE_ADDR breakaddr[MAX_MONITOR_BREAKPOINTS] =
 {0};
 
 static int
-rombug_insert_breakpoint (addr, shadow)
-     CORE_ADDR addr;
-     char *shadow;
+rombug_insert_breakpoint (CORE_ADDR addr, char *shadow)
 {
   int i;
   CORE_ADDR bp_addr = addr;
@@ -922,9 +891,7 @@ rombug_insert_breakpoint (addr, shadow)
  * _remove_breakpoint -- Tell the monitor to remove a breakpoint
  */
 static int
-rombug_remove_breakpoint (addr, shadow)
-     CORE_ADDR addr;
-     char *shadow;
+rombug_remove_breakpoint (CORE_ADDR addr, char *shadow)
 {
   int i;
 
@@ -950,8 +917,7 @@ rombug_remove_breakpoint (addr, shadow)
 
 #define DOWNLOAD_LINE_SIZE 100
 static void
-rombug_load (arg)
-     char *arg;
+rombug_load (char *arg)
 {
 /* this part comment out for os9* */
 #if 0
@@ -1013,9 +979,7 @@ rombug_load (arg)
    is seen. */
 
 static void
-rombug_command (args, fromtty)
-     char *args;
-     int fromtty;
+rombug_command (char *args, int fromtty)
 {
   if (monitor_desc == NULL)
     error ("monitor target not open.");
@@ -1037,16 +1001,14 @@ rombug_command (args, fromtty)
 static struct ttystate ttystate;
 
 static void
-cleanup_tty ()
+cleanup_tty (void)
 {
   printf ("\r\n[Exiting connect mode]\r\n");
   /*SERIAL_RESTORE(0, &ttystate); */
 }
 
 static void
-connect_command (args, fromtty)
-     char *args;
-     int fromtty;
+connect_command (char *args, int fromtty)
 {
   fd_set readfds;
   int numfds;
@@ -1221,7 +1183,7 @@ Specify the serial device it is connected to (e.g. /dev/ttya).",
 }
 
 void
-_initialize_remote_os9k ()
+_initialize_remote_os9k (void)
 {
   init_rombug_ops ();
   add_target (&rombug_ops);
This page took 0.027381 seconds and 4 git commands to generate.