2003-04-13 Michael Snyder <msnyder@redhat.com>
[binutils-gdb.git] / gdb / remote.c
index 1584d6bc7d470866e9dd359332d71c06b972f539..20becee27d6fe01f3fda4568d9aadb928f0b4181 100644 (file)
@@ -2948,7 +2948,7 @@ remote_wait (ptid_t ptid, struct target_waitstatus *status)
        case 'T':               /* Status with PC, SP, FP, ... */
          {
            int i;
-           char* regs = (char*) alloca (MAX_REGISTER_RAW_SIZE);
+           char regs[MAX_REGISTER_SIZE];
 
            /* Expedited reply, containing Signal, {regno, reg} repeat */
            /*  format is:  'Tssn...:r...;n...:r...;n...:r...;#cc', where
@@ -3199,7 +3199,7 @@ remote_async_wait (ptid_t ptid, struct target_waitstatus *status)
        case 'T':               /* Status with PC, SP, FP, ... */
          {
            int i;
-           char* regs = (char*) alloca (MAX_REGISTER_RAW_SIZE);
+           char regs[MAX_REGISTER_SIZE];
 
            /* Expedited reply, containing Signal, {regno, reg} repeat */
            /*  format is:  'Tssn...:r...;n...:r...;n...:r...;#cc', where
@@ -3528,7 +3528,8 @@ remote_prepare_to_store (void)
       /* NOTE: This isn't rs->sizeof_g_packet because here, we are
          forcing the register cache to read its and not the target
          registers.  */
-      read_register_bytes (0, (char *) NULL, REGISTER_BYTES); /* OK use.  */
+      deprecated_read_register_bytes (0, (char *) NULL,
+                                     REGISTER_BYTES); /* OK use.  */
       break;
     case PACKET_ENABLE:
       break;
@@ -3545,7 +3546,7 @@ store_register_using_P (int regnum)
   struct packet_reg *reg = packet_reg_from_regnum (rs, regnum);
   /* Try storing a single register.  */
   char *buf = alloca (rs->remote_packet_size);
-  char *regp = alloca (MAX_REGISTER_RAW_SIZE);
+  char regp[MAX_REGISTER_SIZE];
   char *p;
   int i;
 
@@ -3972,7 +3973,10 @@ remote_xfer_memory (CORE_ADDR mem_addr, char *buffer, int mem_len,
   int targ_len;
   int res;
 
-  REMOTE_TRANSLATE_XFER_ADDRESS (mem_addr, mem_len, &targ_addr, &targ_len);
+  /* Should this be the selected frame?  */
+  gdbarch_remote_translate_xfer_address (current_gdbarch, current_regcache,
+                                        mem_addr, mem_len,
+                                        &targ_addr, &targ_len);
   if (targ_len <= 0)
     return 0;
 
@@ -4838,8 +4842,8 @@ remote_remove_watchpoint (CORE_ADDR addr, int len, int type)
 }
 
 
-int remote_hw_watchpoint_limit = 0;
-int remote_hw_breakpoint_limit = 0;
+int remote_hw_watchpoint_limit = -1;
+int remote_hw_breakpoint_limit = -1;
 
 int
 remote_check_watch_resources (int type, int cnt, int ot)
@@ -4848,6 +4852,8 @@ remote_check_watch_resources (int type, int cnt, int ot)
     {
       if (remote_hw_breakpoint_limit == 0)
        return 0;
+      else if (remote_hw_breakpoint_limit < 0)
+       return 1;
       else if (cnt <= remote_hw_breakpoint_limit)
        return 1;
     }
@@ -4855,6 +4861,8 @@ remote_check_watch_resources (int type, int cnt, int ot)
     {
       if (remote_hw_watchpoint_limit == 0)
        return 0;
+      else if (remote_hw_watchpoint_limit < 0)
+       return 1;
       else if (ot)
        return -1;
       else if (cnt <= remote_hw_watchpoint_limit)
@@ -5740,9 +5748,6 @@ minitelnet (void)
   int status;
   int quit_count = 0;
 
-  extern int escape_count;     /* global shared by readsocket */
-  extern int echo_check;       /* ditto */
-
   escape_count = 0;
   echo_check = -1;
 
@@ -6143,6 +6148,19 @@ terminating `#' character and checksum.",
           "Show the maximum number of bytes per memory-read packet.\n",
           &remote_show_cmdlist);
 
+  add_setshow_cmd ("hardware-watchpoint-limit", no_class,
+                  var_zinteger, &remote_hw_watchpoint_limit, "\
+Set the maximum number of target hardware watchpoints.\n\
+Specify a negative limit for unlimited.", "\
+Show the maximum number of target hardware watchpoints.\n",
+                  NULL, NULL, &remote_set_cmdlist, &remote_show_cmdlist);
+  add_setshow_cmd ("hardware-breakpoint-limit", no_class,
+                  var_zinteger, &remote_hw_breakpoint_limit, "\
+Set the maximum number of target hardware breakpoints.\n\
+Specify a negative limit for unlimited.", "\
+Show the maximum number of target hardware breakpoints.\n",
+                  NULL, NULL, &remote_set_cmdlist, &remote_show_cmdlist);
+
   add_show_from_set
     (add_set_cmd ("remoteaddresssize", class_obscure,
                  var_integer, (char *) &remote_address_size,