Fix ARC TLS support.
[deliverable/binutils-gdb.git] / gdb / remote-mips.c
index 236f3cdab45b10be90816b42c8a418fcdd4d4b21..2f6663b593f844e449e24aae344e7702847b3601 100644 (file)
@@ -1,6 +1,6 @@
 /* Remote debugging interface for MIPS remote debugging protocol.
 
-   Copyright (C) 1993-2014 Free Software Foundation, Inc.
+   Copyright (C) 1993-2016 Free Software Foundation, Inc.
 
    Contributed by Cygnus Support.  Written by Ian Lance Taylor
    <ian@cygnus.com>.
@@ -29,8 +29,6 @@
 #include "gdbcore.h"
 #include "serial.h"
 #include "target.h"
-#include "exceptions.h"
-#include <string.h>
 #include <sys/stat.h>
 #include "gdb_usleep.h"
 #include "regcache.h"
@@ -848,7 +846,7 @@ mips_send_packet (const char *s, int get_ack)
   /* unsigned */ int len;
   unsigned char *packet;
   int cksum;
-  int try;
+  int attempt;
 
   len = strlen (s);
   if (len > DATA_MAXLEN)
@@ -875,7 +873,7 @@ mips_send_packet (const char *s, int get_ack)
   /* We can only have one outstanding data packet, so we just wait for
      the acknowledgement here.  Keep retransmitting the packet until
      we get one, or until we've tried too many times.  */
-  for (try = 0; try < mips_send_retries; try++)
+  for (attempt = 0; attempt < mips_send_retries; attempt++)
     {
       int garbage;
       int ch;
@@ -2162,7 +2160,7 @@ mips_xfer_memory (gdb_byte *readbuf, const gdb_byte *writebuf,
   /* Round ending address up; get number of longwords that makes.  */
   count = (((memaddr + len) - addr) + 3) / 4;
   /* Allocate buffer of that many longwords.  */
-  buffer = alloca (count * 4);
+  buffer = (gdb_byte *) alloca (count * 4);
 
   if (writebuf != NULL)
     {
@@ -2233,7 +2231,8 @@ mips_xfer_memory (gdb_byte *readbuf, const gdb_byte *writebuf,
       /* Copy appropriate bytes out of the buffer.  */
       memcpy (readbuf, buffer + (memaddr & 3), len);
     }
-  return len;
+  *xfered_len = len;
+  return TARGET_XFER_OK;
 }
 
 /* Target to_xfer_partial implementation.  */
@@ -2375,8 +2374,11 @@ mips_insert_breakpoint (struct target_ops *ops, struct gdbarch *gdbarch,
                        struct bp_target_info *bp_tgt)
 {
   if (monitor_supports_breakpoints)
-    return mips_set_breakpoint (bp_tgt->placed_address, MIPS_INSN32_SIZE,
-                               BREAK_FETCH);
+    {
+      bp_tgt->placed_address = bp_tgt->reqstd_address;
+      return mips_set_breakpoint (bp_tgt->placed_address, MIPS_INSN32_SIZE,
+                                 BREAK_FETCH);
+    }
   else
     return memory_insert_breakpoint (ops, gdbarch, bp_tgt);
 }
@@ -2400,7 +2402,7 @@ mips_remove_breakpoint (struct target_ops *ops, struct gdbarch *gdbarch,
 
 static int
 mips_can_use_watchpoint (struct target_ops *self,
-                        int type, int cnt, int othertype)
+                        enum bptype type, int cnt, int othertype)
 {
   return cnt < MAX_LSI_BREAKPOINTS && strcmp (target_shortname, "lsi") == 0;
 }
@@ -2435,10 +2437,13 @@ calculate_mask (CORE_ADDR addr, int len)
 
 static int
 mips_insert_watchpoint (struct target_ops *self,
-                       CORE_ADDR addr, int len, int type,
+                       CORE_ADDR addr, int len, enum target_hw_bp_type type,
                        struct expression *cond)
 {
-  if (mips_set_breakpoint (addr, len, type))
+  /* These enum types are compatible by design.  */
+  enum break_type btype = (enum break_type) type;
+
+  if (mips_set_breakpoint (addr, len, btype))
     return -1;
 
   return 0;
@@ -2448,10 +2453,13 @@ mips_insert_watchpoint (struct target_ops *self,
 
 static int
 mips_remove_watchpoint (struct target_ops *self,
-                       CORE_ADDR addr, int len, int type,
+                       CORE_ADDR addr, int len, enum target_hw_bp_type type,
                        struct expression *cond)
 {
-  if (mips_clear_breakpoint (addr, len, type))
+  /* These enum types are compatible by design.  */
+  enum break_type btype = (enum break_type) type;
+
+  if (mips_clear_breakpoint (addr, len, btype))
     return -1;
 
   return 0;
@@ -2806,7 +2814,7 @@ mips_load_srec (const char *args)
   struct cleanup *cleanup;
   static int hashmark = 1;
 
-  buffer = alloca (srec_frame * 2 + 256);
+  buffer = (bfd_byte *) alloca (srec_frame * 2 + 256);
 
   abfd = gdb_bfd_open (args, NULL, -1);
   if (!abfd)
@@ -3314,7 +3322,8 @@ pmon_end_download (int final, int bintotal)
        mips_send_command ("initEther\r", -1);
 
       /* Send the load command.  */
-      cmd = xmalloc (strlen (load_cmd_prefix) + strlen (tftp_name) + 2);
+      cmd = (char *) xmalloc (strlen (load_cmd_prefix)
+                             + strlen (tftp_name) + 2);
       strcpy (cmd, load_cmd_prefix);
       strcat (cmd, tftp_name);
       strcat (cmd, "\r");
This page took 0.025762 seconds and 4 git commands to generate.