* elf64-sparc.c (sparc64_elf_relocate_section): Ignore overflows
[deliverable/binutils-gdb.git] / gdb / remote-sds.c
index 4cab4b08a7e132e783c381100364f6d37294ba49..0bf1c01c82af7c0e6c05f690aba6f27c51988694 100644 (file)
@@ -1,6 +1,6 @@
 /* Remote target communications for serial-line targets using SDS' protocol.
 
-   Copyright 1997, 1998, 1999, 2000, 2001, 2002 Free Software
+   Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2004 Free Software
    Foundation, Inc.
 
    This file is part of GDB.
 #include "gdbcore.h"
 #include "regcache.h"
 
-#ifdef USG
-#include <sys/types.h>
-#endif
-
 #include <signal.h>
 #include "serial.h"
 
@@ -66,7 +62,7 @@ static void sds_fetch_registers (int);
 
 static void sds_resume (ptid_t, int, enum target_signal);
 
-static int sds_start_remote (PTR);
+static int sds_start_remote (void *);
 
 static void sds_open (char *, int);
 
@@ -76,8 +72,6 @@ static void sds_store_registers (int);
 
 static void sds_mourn (void);
 
-static void sds_create_inferior (char *, char *, char **);
-
 static void sds_load (char *, int);
 
 static int getmessage (unsigned char *, int);
@@ -92,8 +86,6 @@ static ptid_t sds_wait (ptid_t, struct target_waitstatus *);
 
 static void sds_kill (void);
 
-static int tohex (int);
-
 static int fromhex (int);
 
 static void sds_detach (char *, int);
@@ -148,7 +140,6 @@ static int message_pending;
 
 /* Clean up connection to a remote debugger.  */
 
-/* ARGSUSED */
 static void
 sds_close (int quitting)
 {
@@ -160,7 +151,7 @@ sds_close (int quitting)
 /* Stub for catch_errors.  */
 
 static int
-sds_start_remote (PTR dummy)
+sds_start_remote (void *dummy)
 {
   int c;
   unsigned char buf[200];
@@ -279,17 +270,6 @@ fromhex (int a)
     error ("Reply contains invalid hex digit %d", a);
 }
 
-/* Convert number NIB to a hex digit.  */
-
-static int
-tohex (int nib)
-{
-  if (nib < 10)
-    return '0' + nib;
-  else
-    return 'a' + nib - 10;
-}
-
 static int
 tob64 (unsigned char *inbuf, char *outbuf, int len)
 {
@@ -405,7 +385,7 @@ interrupt_query (void)
 Give up (and stop debugging it)? "))
     {
       target_mourn_inferior ();
-      return_to_top_level (RETURN_QUIT);
+      throw_exception (RETURN_QUIT);
     }
 
   target_terminal_inferior ();
@@ -467,16 +447,15 @@ static unsigned char sprs[16];
 /* Read the remote registers into the block REGS.  */
 /* Currently we just read all the registers, so we don't use regno.  */
 
-/* ARGSUSED */
 static void
 sds_fetch_registers (int regno)
 {
   unsigned char buf[PBUFSIZ];
   int i, retlen;
-  char regs[REGISTER_BYTES];
+  char *regs = alloca (deprecated_register_bytes ());
 
   /* Unimplemented registers read as all bits zero.  */
-  memset (regs, 0, REGISTER_BYTES);
+  memset (regs, 0, deprecated_register_bytes ());
 
   buf[0] = 18;
   buf[1] = 1;
@@ -499,7 +478,8 @@ sds_fetch_registers (int regno)
   /* (should warn about reply too short) */
 
   for (i = 0; i < NUM_REGS; i++)
-    supply_register (i, &regs[REGISTER_BYTE (i)]);
+    regcache_raw_supply (current_regcache, i,
+                        &regs[DEPRECATED_REGISTER_BYTE (i)]);
 }
 
 /* Prepare to store registers.  Since we may send them all, we have to
@@ -509,7 +489,7 @@ static void
 sds_prepare_to_store (void)
 {
   /* Make sure the entire registers array is valid.  */
-  read_register_bytes (0, (char *) NULL, REGISTER_BYTES);
+  deprecated_read_register_bytes (0, (char *) NULL, deprecated_register_bytes ());
 }
 
 /* Store register REGNO, or all registers if REGNO == -1, from the contents
@@ -528,7 +508,7 @@ sds_store_registers (int regno)
   *p++ = 0;
   *p++ = 0;
   for (i = 0; i < 4 * 6; i++)
-    *p++ = registers[i + 4 * 32 + 8 * 32];
+    *p++ = deprecated_registers[i + 4 * 32 + 8 * 32];
   for (i = 0; i < 4 * 1; i++)
     *p++ = 0;
   for (i = 0; i < 4 * 4; i++)
@@ -543,7 +523,7 @@ sds_store_registers (int regno)
   *p++ = 0;
   *p++ = 0;
   for (i = 0; i < 4 * 32; i++)
-    *p++ = registers[i];
+    *p++ = deprecated_registers[i];
 
   sds_send (buf, p - buf);
 
@@ -657,7 +637,6 @@ sds_read_bytes (CORE_ADDR memaddr, char *myaddr, int len)
    if SHOULD_WRITE is nonzero.  Returns length of data written or
    read; 0 for error.  TARGET is unused.  */
 
-/* ARGSUSED */
 static int
 sds_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int should_write,
                 struct mem_attrib *attrib, struct target_ops *target)
@@ -978,6 +957,7 @@ getmessage (unsigned char *buf, int forever)
       /* Try the whole thing again.  */
     retry:
       /* need to do something here */
+      ;
     }
 
   /* We have tried hard enough, and just can't receive the packet.  Give up. */
@@ -1000,7 +980,7 @@ sds_mourn (void)
 }
 
 static void
-sds_create_inferior (char *exec_file, char *args, char **env)
+sds_create_inferior (char *exec_file, char *args, char **env, int from_tty)
 {
   inferior_ptid = pid_to_ptid (42000);
 
@@ -1081,7 +1061,7 @@ Specify the serial device it is connected to (e.g. /dev/ttya).";
   sds_ops.to_fetch_registers = sds_fetch_registers;
   sds_ops.to_store_registers = sds_store_registers;
   sds_ops.to_prepare_to_store = sds_prepare_to_store;
-  sds_ops.to_xfer_memory = sds_xfer_memory;
+  sds_ops.deprecated_xfer_memory = sds_xfer_memory;
   sds_ops.to_files_info = sds_files_info;
   sds_ops.to_insert_breakpoint = sds_insert_breakpoint;
   sds_ops.to_remove_breakpoint = sds_remove_breakpoint;
@@ -1135,10 +1115,11 @@ _initialize_remote_sds (void)
   init_sds_ops ();
   add_target (&sds_ops);
 
-  add_show_from_set (add_set_cmd ("sdstimeout", no_class,
-                                 var_integer, (char *) &sds_timeout,
-                            "Set timeout value for sds read.\n", &setlist),
-                    &showlist);
+  deprecated_add_show_from_set
+    (add_set_cmd ("sdstimeout", no_class,
+                 var_integer, (char *) &sds_timeout,
+                 "Set timeout value for sds read.\n", &setlist),
+     &showlist);
 
   add_com ("sds", class_obscure, sds_command,
           "Send a command to the SDS monitor.");
This page took 0.026154 seconds and 4 git commands to generate.