* stabsread.c (get_substring): Declare second arg as int.
[deliverable/binutils-gdb.git] / gdb / sparcl-tdep.c
index 0d081ec64311349ed09d76a2aa2056cbbdc139ae..ed9afb82e0ae36f90b96733c62d82f84750cd278 100644 (file)
@@ -1,5 +1,5 @@
 /* Target dependent code for the Fujitsu SPARClite for GDB, the GNU debugger.
-   Copyright 1994, 1995  Free Software Foundation, Inc.
+   Copyright 1994, 1995, 1996  Free Software Foundation, Inc.
 
 This file is part of GDB.
 
@@ -239,17 +239,21 @@ sparclite_check_watch_resources (type, cnt, ot)
      int ot;
 {
   if (type == bp_hardware_breakpoint)
-    if (TARGET_HW_BREAK_LIMIT == 0)
-      return 0;
-    else if (cnt <= TARGET_HW_BREAK_LIMIT)
-      return 1;
+    {
+      if (TARGET_HW_BREAK_LIMIT == 0)
+       return 0;
+      else if (cnt <= TARGET_HW_BREAK_LIMIT)
+       return 1;
+    }
   else
-    if (TARGET_HW_WATCH_LIMIT == 0)
-      return 0;
-    else if (ot)
-      return -1;
-    else if (cnt <= TARGET_HW_WATCH_LIMIT)
-      return 1;
+    {
+      if (TARGET_HW_WATCH_LIMIT == 0)
+       return 0;
+      else if (ot)
+       return -1;
+      else if (cnt <= TARGET_HW_WATCH_LIMIT)
+       return 1;
+    }
   return -1;
 }
 
@@ -296,30 +300,39 @@ open_tty (name)
   return desc;
 }
 
+/* Read a single character from the remote end, masking it down to 7 bits. */
+
 static int
-send_resp (desc, c)
+readchar (desc, timeout)
      serial_t desc;
-     char c;
+     int timeout;
 {
-  int i;
-
-  SERIAL_WRITE (desc, &c, 1);
-  i = SERIAL_READCHAR (desc, 2);
+  int ch;
 
-  if (i >= 0)
-    return i;
+  ch = SERIAL_READCHAR (desc, timeout);
 
-  switch (i)
+  switch (ch)
     {
+    case SERIAL_EOF:
+      error ("SPARClite remote connection closed");
     case SERIAL_ERROR:
-      perror_with_name ("Remote communication error");
+      perror_with_name ("SPARClite communication error");
     case SERIAL_TIMEOUT:
-      error ("Remote timeout");
-    case SERIAL_EOF:
-      error ("Remote connection closed");
+      error ("SPARClite remote timeout");
+    default:
+      return ch;
     }
 }
 
+static int
+send_resp (desc, c)
+     serial_t desc;
+     char c;
+{
+  SERIAL_WRITE (desc, &c, 1);
+  return readchar (desc, 2);
+}
+
 static void
 close_tty (ignore)
      int ignore;
@@ -652,7 +665,7 @@ sparclite_serial_start (entry)
   store_unsigned_integer (buffer + 1, 4, entry);
 
   SERIAL_WRITE (remote_desc, buffer, 1 + 4);
-  i = SERIAL_READCHAR (remote_desc, 2);
+  i = readchar (remote_desc, 2);
   if (i != 0x55)
     error ("Can't start SparcLite.  Error code %d\n", i);
 }
@@ -684,9 +697,7 @@ sparclite_serial_write (from_bfd, from_sec, from_addr, to_addr, len)
     error ("Bad response from load command (0x%x)", i);
 
   SERIAL_WRITE (remote_desc, buffer, 4 + 4 + len);
-  i = SERIAL_READCHAR (remote_desc, 2);
-  if (i < 0)
-    error ("I/O error in serial code.  Return code %d\n", i);
+  i = readchar (remote_desc, 2);
 
   if (i != checksum)
     error ("Bad checksum from load command (0x%x)", i);
This page took 0.025695 seconds and 4 git commands to generate.