Eliminate some uses of __STDC__.
[deliverable/binutils-gdb.git] / gdb / remote-mm.c
index 1f25640a30ea9411c190e8439304729cfb63df08..ed72d4bb6426f5bfd4a4c54cf9923917069d8e55 100644 (file)
@@ -1,5 +1,6 @@
 /* Remote debugging interface for Am290*0 running MiniMON monitor, for GDB.
-   Copyright 1990, 1991, 1992 Free Software Foundation, Inc.
+   Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000,
+   2001 Free Software Foundation, Inc.
    Originally written by Daniel Mann at AMD.
 
    This file is part of GDB.
@@ -32,7 +33,6 @@
 
 #include "defs.h"
 #include "inferior.h"
-#include "wait.h"
 #include "value.h"
 #include <ctype.h>
 #include <fcntl.h>
@@ -42,6 +42,7 @@
 #include "terminal.h"
 #include "minimon.h"
 #include "target.h"
+#include "regcache.h"
 
 /* Offset of member MEMBER in a struct of type TYPE.  */
 #define offsetof(TYPE, MEMBER) ((int) &((TYPE *)0)->MEMBER)
@@ -117,16 +118,10 @@ FILE *mm_stream;
 /* Called when SIGALRM signal sent due to alarm() timeout.  */
 #ifndef HAVE_TERMIO
 
-#ifndef __STDC__
-#ifndef volatile
-#define volatile
-/**/
-# endif
-#endif
 volatile int n_alarms;
 
 static void
-mm_timer ()
+mm_timer (void)
 {
 #if 0
   if (kiodebug)
@@ -148,10 +143,7 @@ static char *prog_name = NULL;
 /* This is called not only when we first attach, but also when the
    user types "run" after having attached.  */
 static void
-mm_create_inferior (execfile, args, env)
-     char *execfile;
-     char *args;
-     char **env;
+mm_create_inferior (char *execfile, char *args, char **env)
 {
 #define MAX_TOKENS 25
 #define BUFFER_SIZE 256
@@ -188,7 +180,7 @@ Assuming you are at NYU debuging a kernel, i.e., no need to download.\n\n");
 }
 /**************************************************** REMOTE_MOURN_INFERIOR */
 static void
-mm_mourn ()
+mm_mourn (void)
 {
   pop_target ();               /* Pop back to no-child state */
   generic_mourn_inferior ();
@@ -283,8 +275,7 @@ baudtab[] =
 };
 
 static int
-damn_b (rate)
-     int rate;
+damn_b (int rate)
 {
   int i;
 
@@ -305,9 +296,7 @@ damn_b (rate)
 static char *dev_name;
 int baudrate = 9600;
 static void
-mm_open (name, from_tty)
-     char *name;
-     int from_tty;
+mm_open (char *name, int from_tty)
 {
   TERMINAL sg;
   unsigned int prl;
@@ -339,7 +328,7 @@ mm_open (name, from_tty)
     /*EMPTY */ ;
 
   if (prog_name != NULL)
-    free (prog_name);
+    xfree (prog_name);
   prog_name = savestring (p, strlen (p));
 
 
@@ -457,8 +446,8 @@ mm_open (name, from_tty)
    Use this when you want to detach and do something else
    with your gdb.  */
 static void
-mm_close (quitting)            /*FIXME: how is quitting used */
-     int quitting;
+mm_close (                     /*FIXME: how is quitting used */
+          int quitting)
 {
   if (mm_desc < 0)
     error ("Can't close remote connection: not debugging remotely.");
@@ -492,9 +481,7 @@ mm_close (quitting)         /*FIXME: how is quitting used */
  * Upon exiting the process's execution is stopped.
  */
 static void
-mm_attach (args, from_tty)
-     char *args;
-     int from_tty;
+mm_attach (char *args, int from_tty)
 {
 
   if (!mm_stream)
@@ -522,9 +509,7 @@ mm_attach (args, from_tty)
    Use this when you want to detach and do something else
    with your gdb.  Leave remote process running (with no breakpoints set). */
 static void
-mm_detach (args, from_tty)
-     char *args;
-     int from_tty;
+mm_detach (char *args, int from_tty)
 {
   remove_breakpoints ();       /* Just in case there were any left in */
   out_msg_buf->go_msg.code = GO;
@@ -538,9 +523,7 @@ mm_detach (args, from_tty)
 ** Tell the remote machine to resume.  */
 
 static void
-mm_resume (pid, step, sig)
-     int pid, step;
-     enum target_signal sig;
+mm_resume (int pid, int step, enum target_signal sig)
 {
   if (sig != TARGET_SIGNAL_0)
     warning ("Can't send signals to a remote MiniMon system.");
@@ -565,8 +548,7 @@ mm_resume (pid, step, sig)
    storing status in STATUS just as `wait' would.  */
 
 static int
-mm_wait (status)
-     struct target_waitstatus *status;
+mm_wait (struct target_waitstatus *status)
 {
   int i, result;
   int old_timeout = timeout;
@@ -718,8 +700,7 @@ halted:
  * If regno==-1 then read all the registers.
  */
 static void
-mm_fetch_registers (regno)
-     int regno;
+mm_fetch_registers (int regno)
 {
   INT32 *data_p;
 
@@ -833,8 +814,7 @@ mm_fetch_registers (regno)
  */
 
 static void
-mm_store_registers (regno)
-     int regno;
+mm_store_registers (int regno)
 {
   int result;
 
@@ -972,15 +952,14 @@ mm_store_registers (regno)
    debugged.  */
 
 static void
-mm_prepare_to_store ()
+mm_prepare_to_store (void)
 {
   /* Do nothing, since we can store individual regs */
 }
 
 /******************************************************* REMOTE_XFER_MEMORY */
 static CORE_ADDR
-translate_addr (addr)
-     CORE_ADDR addr;
+translate_addr (CORE_ADDR addr)
 {
 #if defined(KERNEL_DEBUGGING)
   /* Check for a virtual address in the kernel */
@@ -1003,7 +982,7 @@ translate_addr (addr)
 
 /******************************************************* REMOTE_FILES_INFO */
 static void
-mm_files_info ()
+mm_files_info (void)
 {
   printf ("\tAttached to %s at %d baud and running program %s.\n",
          dev_name, baudrate, prog_name);
@@ -1011,9 +990,7 @@ mm_files_info ()
 
 /************************************************* REMOTE_INSERT_BREAKPOINT */
 static int
-mm_insert_breakpoint (addr, contents_cache)
-     CORE_ADDR addr;
-     char *contents_cache;
+mm_insert_breakpoint (CORE_ADDR addr, char *contents_cache)
 {
   out_msg_buf->bkpt_set_msg.code = BKPT_SET;
   out_msg_buf->bkpt_set_msg.length = 4 * 4;
@@ -1034,9 +1011,7 @@ mm_insert_breakpoint (addr, contents_cache)
 
 /************************************************* REMOTE_DELETE_BREAKPOINT */
 static int
-mm_remove_breakpoint (addr, contents_cache)
-     CORE_ADDR addr;
-     char *contents_cache;
+mm_remove_breakpoint (CORE_ADDR addr, char *contents_cache)
 {
   out_msg_buf->bkpt_rm_msg.code = BKPT_RM;
   out_msg_buf->bkpt_rm_msg.length = 4 * 3;
@@ -1056,9 +1031,7 @@ mm_remove_breakpoint (addr, contents_cache)
 
 /******************************************************* REMOTE_KILL */
 static void
-mm_kill (arg, from_tty)
-     char *arg;
-     int from_tty;
+mm_kill (char *arg, int from_tty)
 {
   char buf[4];
 
@@ -1097,9 +1070,7 @@ mm_kill (arg, from_tty)
  * Load a program into the target.
  */
 static void
-mm_load (arg_string, from_tty)
-     char *arg_string;
-     int from_tty;
+mm_load (char *arg_string, int from_tty)
 {
   dont_repeat ();
 
@@ -1110,7 +1081,7 @@ mm_load (arg_string, from_tty)
     error ("The load command takes a file name");
 
   arg_string = tilde_expand (arg_string);
-  make_cleanup (free, arg_string);
+  make_cleanup (xfree, arg_string);
   QUIT;
   immediate_quit++;
   error ("File loading is not yet supported for MiniMon.");
@@ -1118,7 +1089,7 @@ mm_load (arg_string, from_tty)
   /* You may need to do an init_target_mm() */
   /* init_target_mm(?,?,?,?,?,?,?,?); */
   immediate_quit--;
-  /* symbol_file_add (arg_string, from_tty, text_addr, 0, 0, 0, 0); */
+  /* symbol_file_add (arg_string, from_tty, text_addr, 0, 0); */
 #endif
 
 }
@@ -1127,10 +1098,7 @@ mm_load (arg_string, from_tty)
 ** Copy LEN bytes of data from debugger memory at MYADDR
    to inferior's memory at MEMADDR.  Returns number of bytes written.  */
 static int
-mm_write_inferior_memory (memaddr, myaddr, len)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
+mm_write_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len)
 {
   int i, nwritten;
 
@@ -1166,10 +1134,7 @@ mm_write_inferior_memory (memaddr, myaddr, len)
 ** Read LEN bytes from inferior memory at MEMADDR.  Put the result
    at debugger address MYADDR.  Returns number of bytes read.  */
 static int
-mm_read_inferior_memory (memaddr, myaddr, len)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
+mm_read_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len)
 {
   int i, nread;
 
@@ -1203,11 +1168,9 @@ mm_read_inferior_memory (memaddr, myaddr, len)
 
 /* FIXME!  Merge these two.  */
 static int
-mm_xfer_inferior_memory (memaddr, myaddr, len, write)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
-     int write;
+mm_xfer_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
+                        struct mem_attrib *attrib ATTRIBUTE_UNUSED,
+                        struct target_ops *target ATTRIBUTE_UNUSED)
 {
 
   memaddr = translate_addr (memaddr);
@@ -1232,8 +1195,7 @@ mm_xfer_inferior_memory (memaddr, myaddr, len, write)
 */
 
 int
-msg_send_serial (msg_ptr)
-     union msg_t *msg_ptr;
+msg_send_serial (union msg_t *msg_ptr)
 {
   INT32 message_size;
   int byte_count;
@@ -1269,8 +1231,7 @@ msg_send_serial (msg_ptr)
 */
 
 int
-msg_recv_serial (msg_ptr)
-     union msg_t *msg_ptr;
+msg_recv_serial (union msg_t *msg_ptr)
 {
   static INT32 length = 0;
   static INT32 byte_count = 0;
@@ -1339,7 +1300,7 @@ msg_recv_serial (msg_ptr)
 TERMINAL kbd_tbuf;
 
 int
-kbd_raw ()
+kbd_raw (void)
 {
   int result;
   TERMINAL tbuf;
@@ -1398,7 +1359,7 @@ kbd_raw ()
 */
 
 int
-kbd_restore ()
+kbd_restore (void)
 {
   int result;
 
@@ -1421,8 +1382,7 @@ kbd_restore ()
  * Returns 0/-1 on success/failure.  
  */
 static int
-fetch_register (regno)
-     int regno;
+fetch_register (int regno)
 {
   int result;
   out_msg_buf->read_req_msg.code = READ_REQ;
@@ -1481,8 +1441,7 @@ fetch_register (regno)
  * Returns 0/-1 on success/failure.  
  */
 static int
-store_register (regno)
-     int regno;
+store_register (int regno)
 {
   int result;
 
@@ -1548,8 +1507,7 @@ store_register (regno)
  * Convert a gdb special register number to a 29000 special register number.
  */
 static int
-regnum_to_srnum (regno)
-     int regno;
+regnum_to_srnum (int regno)
 {
   switch (regno)
     {
@@ -1616,10 +1574,8 @@ regnum_to_srnum (regno)
  * Initialize the target debugger (minimon only).
  */
 static void
-init_target_mm (tstart, tend, dstart, dend, entry, ms_size, rs_size, arg_start)
-     ADDR32 tstart, tend, dstart, dend, entry;
-     INT32 ms_size, rs_size;
-     ADDR32 arg_start;
+init_target_mm (ADDR32 tstart, ADDR32 tend, ADDR32 dstart, ADDR32 dend,
+               ADDR32 entry, INT32 ms_size, INT32 rs_size, ADDR32 arg_start)
 {
   out_msg_buf->init_msg.code = INIT;
   out_msg_buf->init_msg.length = sizeof (struct init_msg_t) - 2 * sizeof (INT32);
@@ -1641,8 +1597,7 @@ init_target_mm (tstart, tend, dstart, dend, entry, ms_size, rs_size, arg_start)
  * to be called with.
  */
 static char *
-msg_str (code)
-     INT32 code;
+msg_str (INT32 code)
 {
   static char cbuf[32];
 
@@ -1680,8 +1635,7 @@ msg_str (code)
  * Selected (not all of them) error codes that we might get.
  */
 static char *
-error_msg_str (code)
-     INT32 code;
+error_msg_str (INT32 code)
 {
   static char cbuf[50];
 
@@ -1741,15 +1695,15 @@ error_msg_str (code)
   return (cbuf);
 }
 /****************************************************************************/
-/* 
- *  Receive a message and expect it to be of type msgcode.
- *  Returns 0/1 on failure/success.
- */
+
+/* Receive a message, placing it in MSG_BUF, and expect it to be of
+   type MSGCODE.  If an error occurs, a non-zero FROM_TTY indicates
+   that the message should be printed.
+   
+   Return 0 for failure, 1 for success.  */
+
 static int
-expect_msg (msgcode, msg_buf, from_tty)
-     INT32 msgcode;            /* Msg code we expect */
-     union msg_t *msg_buf;     /* Where to put  the message received */
-     int from_tty;             /* Print message on error if non-zero */
+expect_msg (INT32 msgcode, union msg_t *msg_buf, int from_tty)
 {
   int retries = 0;
   while (msg_recv_serial (msg_buf) && (retries++ < MAX_RETRIES));
@@ -1780,8 +1734,7 @@ expect_msg (msgcode, msg_buf, from_tty)
  * FIXME: Doesn't know anything about I_CACHE/D_CACHE.
  */
 static int
-mm_memory_space (addr)
-     CORE_ADDR *addr;
+mm_memory_space (CORE_ADDR *addr)
 {
   ADDR32 tstart = target_config.I_mem_start;
   ADDR32 tend = tstart + target_config.I_mem_size;
@@ -1882,15 +1835,14 @@ init_mm_ops (void)
 };
 
 void
-_initialize_remote_mm ()
+_initialize_remote_mm (void)
 {
   init_mm_ops ();
   add_target (&mm_ops);
 }
 
 #ifdef NO_HIF_SUPPORT
-service_HIF (msg)
-     union msg_t *msg;
+service_HIF (union msg_t *msg)
 {
   return (0);                  /* Emulate a failure */
 }
This page took 0.031111 seconds and 4 git commands to generate.