2004-07-26 Andrew Cagney <cagney@gnu.org>
[deliverable/binutils-gdb.git] / gdb / remote.c
index 55bc135a9b25e761ff865bcea0f09439fe7e303b..ad85c0721945e3d92a3fe0e2a77f9eab4aed2816 100644 (file)
@@ -107,9 +107,6 @@ static void extended_remote_restart (void);
 
 static void extended_remote_mourn (void);
 
-static void extended_remote_create_inferior (char *, char *, char **);
-static void extended_remote_async_create_inferior (char *, char *, char **);
-
 static void remote_mourn_1 (struct target_ops *);
 
 static void remote_send (char *buf, long sizeof_buf);
@@ -292,7 +289,7 @@ init_remote_state (struct gdbarch *gdbarch)
      little. */
   if (rs->sizeof_g_packet > ((rs->remote_packet_size - 32) / 2))
     rs->remote_packet_size = (rs->sizeof_g_packet * 2 + 32);
-  
+
   /* This one is filled in when a ``g'' packet is received. */
   rs->actual_register_packet_size = 0;
 
@@ -654,12 +651,12 @@ add_packet_config_cmd (struct packet_config *config,
   config->title = title;
   config->detect = AUTO_BOOLEAN_AUTO;
   config->support = PACKET_SUPPORT_UNKNOWN;
-  xasprintf (&set_doc, "Set use of remote protocol `%s' (%s) packet",
-            name, title);
-  xasprintf (&show_doc, "Show current use of remote protocol `%s' (%s) packet",
-            name, title);
+  set_doc = xstrprintf ("Set use of remote protocol `%s' (%s) packet",
+                       name, title);
+  show_doc = xstrprintf ("Show current use of remote protocol `%s' (%s) packet",
+                        name, title);
   /* set/show TITLE-packet {auto,on,off} */
-  xasprintf (&cmd_name, "%s-packet", title);
+  cmd_name = xstrprintf ("%s-packet", title);
   add_setshow_auto_boolean_cmd (cmd_name, class_obscure,
                                &config->detect, set_doc, show_doc,
                                set_func, show_func,
@@ -668,7 +665,7 @@ add_packet_config_cmd (struct packet_config *config,
   if (legacy)
     {
       char *legacy_name;
-      xasprintf (&legacy_name, "%s-packet", name);
+      legacy_name = xstrprintf ("%s-packet", name);
       add_alias_cmd (legacy_name, cmd_name, class_obscure, 0,
                     set_remote_list);
       add_alias_cmd (legacy_name, cmd_name, class_obscure, 0,
@@ -774,42 +771,6 @@ show_remote_protocol_qSymbol_packet_cmd (char *args, int from_tty,
   show_packet_config_cmd (&remote_protocol_qSymbol);
 }
 
-/* Should we try the 'e' (step over range) request? */
-static struct packet_config remote_protocol_e;
-
-static void
-set_remote_protocol_e_packet_cmd (char *args, int from_tty,
-                                 struct cmd_list_element *c)
-{
-  update_packet_config (&remote_protocol_e);
-}
-
-static void
-show_remote_protocol_e_packet_cmd (char *args, int from_tty,
-                                  struct cmd_list_element *c)
-{
-  show_packet_config_cmd (&remote_protocol_e);
-}
-  
-
-/* Should we try the 'E' (step over range / w signal #) request? */
-static struct packet_config remote_protocol_E;
-
-static void
-set_remote_protocol_E_packet_cmd (char *args, int from_tty,
-                                 struct cmd_list_element *c)
-{
-  update_packet_config (&remote_protocol_E);
-}
-
-static void
-show_remote_protocol_E_packet_cmd (char *args, int from_tty,
-                                  struct cmd_list_element *c)
-{
-  show_packet_config_cmd (&remote_protocol_E);
-}
-  
-
 /* Should we try the 'P' (set register) request?  */
 
 static struct packet_config remote_protocol_P;
@@ -960,7 +921,7 @@ static struct packet_config remote_protocol_binary_download;
    This variable (NOT available to the user: auto-detect only!)
    determines whether GDB will use the new, simpler "ThreadInfo"
    query or the older, more complex syntax for thread queries.
-   This is an auto-detect variable (set to true at each connect, 
+   This is an auto-detect variable (set to true at each connect,
    and set to false when the target fails to recognize it).  */
 
 static int use_threadinfo_query;
@@ -981,6 +942,23 @@ show_remote_protocol_binary_download_cmd (char *args, int from_tty,
   show_packet_config_cmd (&remote_protocol_binary_download);
 }
 
+/* Should we try the 'qPart:auxv' (target auxiliary vector read) request? */
+static struct packet_config remote_protocol_qPart_auxv;
+
+static void
+set_remote_protocol_qPart_auxv_packet_cmd (char *args, int from_tty,
+                                          struct cmd_list_element *c)
+{
+  update_packet_config (&remote_protocol_qPart_auxv);
+}
+
+static void
+show_remote_protocol_qPart_auxv_packet_cmd (char *args, int from_tty,
+                                           struct cmd_list_element *c)
+{
+  show_packet_config_cmd (&remote_protocol_qPart_auxv);
+}
+
 
 /* Tokens for use by the asynchronous signal handlers for SIGINT */
 static void *sigint_remote_twice_token;
@@ -989,8 +967,8 @@ static void *sigint_remote_token;
 /* These are pointers to hook functions that may be set in order to
    modify resume/wait behavior for a particular architecture.  */
 
-void (*target_resume_hook) (void);
-void (*target_wait_loop_hook) (void);
+void (*deprecated_target_resume_hook) (void);
+void (*deprecated_target_wait_loop_hook) (void);
 \f
 
 
@@ -1455,7 +1433,7 @@ pack_threadinfo_request (char *pkt, int mode, threadref *id)
                                   fetch registers and its stack */
 #define TAG_DISPLAY 4          /* A short thing maybe to put on a window */
 #define TAG_THREADNAME 8       /* string, maps 1-to-1 with a thread is */
-#define TAG_MOREDISPLAY 16     /* Whatever the kernel wants to say about 
+#define TAG_MOREDISPLAY 16     /* Whatever the kernel wants to say about
                                   the process */
 
 static int
@@ -1743,8 +1721,8 @@ remote_current_thread (ptid_t oldpid)
     return oldpid;
 }
 
-/* Find new threads for info threads command.  
- * Original version, using John Metzler's thread protocol.  
+/* Find new threads for info threads command.
+ * Original version, using John Metzler's thread protocol.
  */
 
 static void
@@ -1780,7 +1758,7 @@ remote_threads_info (void)
       bufp = buf;
       getpkt (bufp, (rs->remote_packet_size), 0);
       if (bufp[0] != '\0')             /* q packet recognized */
-       {       
+       {
          while (*bufp++ == 'm')        /* reply contains one or more TID */
            {
              do
@@ -1804,12 +1782,12 @@ remote_threads_info (void)
   return;
 }
 
-/* 
+/*
  * Collect a descriptive string about the given thread.
  * The target may say anything it wants to about the thread
  * (typically info about its blocked / runnable state, name, etc.).
  * This string will appear in the info threads display.
- * 
+ *
  * Optional: targets are not required to implement this function.
  */
 
@@ -1969,9 +1947,9 @@ get_offsets (void)
   if (symfile_objfile == NULL)
     return;
 
-  offs = ((struct section_offsets *) 
+  offs = ((struct section_offsets *)
          alloca (SIZEOF_N_SECTION_OFFSETS (symfile_objfile->num_sections)));
-  memcpy (offs, symfile_objfile->section_offsets, 
+  memcpy (offs, symfile_objfile->section_offsets,
          SIZEOF_N_SECTION_OFFSETS (symfile_objfile->num_sections));
 
   offs->offsets[SECT_OFF_TEXT (symfile_objfile)] = text_addr;
@@ -2060,8 +2038,6 @@ static void
 init_all_packet_configs (void)
 {
   int i;
-  update_packet_config (&remote_protocol_e);
-  update_packet_config (&remote_protocol_E);
   update_packet_config (&remote_protocol_P);
   update_packet_config (&remote_protocol_qSymbol);
   update_packet_config (&remote_protocol_vcont);
@@ -2070,6 +2046,7 @@ init_all_packet_configs (void)
   /* Force remote_write_bytes to check whether target supports binary
      downloading. */
   update_packet_config (&remote_protocol_binary_download);
+  update_packet_config (&remote_protocol_qPart_auxv);
 }
 
 /* Symbol look-up. */
@@ -2103,7 +2080,7 @@ remote_check_symbols (struct objfile *objfile)
       if (sym == NULL)
        sprintf (msg, "qSymbol::%s", &reply[8]);
       else
-       sprintf (msg, "qSymbol:%s:%s", 
+       sprintf (msg, "qSymbol:%s:%s",
                 paddr_nz (SYMBOL_VALUE_ADDRESS (sym)),
                 &reply[8]);
       putpkt (msg);
@@ -2146,6 +2123,9 @@ remote_open_1 (char *name, int from_tty, struct target_ops *target,
   if (!async_p)
     wait_forever_enabled_p = 1;
 
+  reopen_exec_file ();
+  reread_symbols ();
+
   target_preopen (from_tty);
 
   unpush_target (target);
@@ -2183,7 +2163,7 @@ remote_open_1 (char *name, int from_tty, struct target_ops *target,
   push_target (target);                /* Switch to using remote target now */
 
   init_all_packet_configs ();
-  
+
   general_thread = -2;
   continue_thread = -2;
 
@@ -2259,10 +2239,10 @@ remote_open_1 (char *name, int from_tty, struct target_ops *target,
       getpkt (buf, (rs->remote_packet_size), 0);
     }
 #ifdef SOLIB_CREATE_INFERIOR_HOOK
-  /* FIXME: need a master target_open vector from which all 
-     remote_opens can be called, so that stuff like this can 
+  /* FIXME: need a master target_open vector from which all
+     remote_opens can be called, so that stuff like this can
      go there.  Failing that, the following code must be copied
-     to the open function for any remote target that wants to 
+     to the open function for any remote target that wants to
      support svr4 shared libraries.  */
 
   /* Set up to detect and load shared libraries. */
@@ -2531,8 +2511,8 @@ remote_resume (ptid_t ptid, int step, enum target_signal siggnal)
 
   /* A hook for when we need to do something at the last moment before
      resumption.  */
-  if (target_resume_hook)
-    (*target_resume_hook) ();
+  if (deprecated_target_resume_hook)
+    (*deprecated_target_resume_hook) ();
 
   /* The vCont packet doesn't need to specify threads via Hc.  */
   if (remote_vcont_resume (ptid, step, siggnal))
@@ -2544,60 +2524,6 @@ remote_resume (ptid_t ptid, int step, enum target_signal siggnal)
   else
     set_thread (pid, 0);       /* run this thread */
 
-  /* The s/S/c/C packets do not return status.  So if the target does
-     not support the S or C packets, the debug agent returns an empty
-     string which is detected in remote_wait().  This protocol defect
-     is fixed in the e/E packets. */
-
-  if (step && step_range_end)
-    {
-      /* If the target does not support the 'E' packet, we try the 'S'
-        packet.  Ideally we would fall back to the 'e' packet if that
-        too is not supported.  But that would require another copy of
-        the code to issue the 'e' packet (and fall back to 's' if not
-        supported) in remote_wait().  */
-      
-      if (siggnal != TARGET_SIGNAL_0)
-       {
-         if (remote_protocol_E.support != PACKET_DISABLE)
-           {
-             p = buf;
-             *p++ = 'E';
-             *p++ = tohex (((int) siggnal >> 4) & 0xf);
-             *p++ = tohex (((int) siggnal) & 0xf);
-             *p++ = ',';
-             p += hexnumstr (p, (ULONGEST) step_range_start);
-             *p++ = ',';
-             p += hexnumstr (p, (ULONGEST) step_range_end);
-             *p++ = 0;
-
-             putpkt (buf);
-             getpkt (buf, (rs->remote_packet_size), 0);
-
-             if (packet_ok (buf, &remote_protocol_E) == PACKET_OK)
-               return;
-           }
-       }
-      else
-       {
-         if (remote_protocol_e.support != PACKET_DISABLE)
-           {
-             p = buf;
-             *p++ = 'e';
-             p += hexnumstr (p, (ULONGEST) step_range_start);
-             *p++ = ',';
-             p += hexnumstr (p, (ULONGEST) step_range_end);
-             *p++ = 0;
-
-             putpkt (buf);
-             getpkt (buf, (rs->remote_packet_size), 0);
-
-             if (packet_ok (buf, &remote_protocol_e) == PACKET_OK)
-               return;
-           }
-       }
-    }
-
   if (siggnal != TARGET_SIGNAL_0)
     {
       buf[0] = step ? 'S' : 'C';
@@ -2838,7 +2764,7 @@ remote_console_output (char *msg)
 
 /* Wait until the remote machine stops, then return,
    storing status in STATUS just as `wait' would.
-   Returns "pid", which in the case of a multi-threaded 
+   Returns "pid", which in the case of a multi-threaded
    remote OS, is the thread-id.  */
 
 static ptid_t
@@ -2862,8 +2788,8 @@ remote_wait (ptid_t ptid, struct target_waitstatus *status)
 
       /* This is a hook for when we need to do something (perhaps the
          collection of trace data) every time the target stops.  */
-      if (target_wait_loop_hook)
-       (*target_wait_loop_hook) ();
+      if (deprecated_target_wait_loop_hook)
+       (*deprecated_target_wait_loop_hook) ();
 
       remote_stopped_by_watchpoint_p = 0;
 
@@ -2896,7 +2822,7 @@ remote_wait (ptid_t ptid, struct target_waitstatus *status)
                LONGEST pnum = 0;
 
                /* If the packet contains a register number save it in pnum
-                  and set p1 to point to the character following it. 
+                  and set p1 to point to the character following it.
                   Otherwise p1 points to p.  */
 
                /* If this packet is an awatch packet, don't parse the 'a'
@@ -2908,7 +2834,7 @@ remote_wait (ptid_t ptid, struct target_waitstatus *status)
                    pnum = strtol (p, &p_temp, 16);
                    p1 = (unsigned char *) p_temp;
                  }
-               else 
+               else
                  p1 = p;
 
                if (p1 == p)    /* No register number present here */
@@ -2957,7 +2883,7 @@ Packet: '%s'\n",
                    p += 2 * fieldsize;
                    if (fieldsize < DEPRECATED_REGISTER_RAW_SIZE (reg->regnum))
                      warning ("Remote reply is too short: %s", buf);
-                   supply_register (reg->regnum, regs);
+                   regcache_raw_supply (current_regcache, reg->regnum, regs);
                  }
 
                if (*p++ != ';')
@@ -3053,8 +2979,8 @@ remote_async_wait (ptid_t ptid, struct target_waitstatus *status)
 
       /* This is a hook for when we need to do something (perhaps the
          collection of trace data) every time the target stops.  */
-      if (target_wait_loop_hook)
-       (*target_wait_loop_hook) ();
+      if (deprecated_target_wait_loop_hook)
+       (*deprecated_target_wait_loop_hook) ();
 
       switch (buf[0])
        {
@@ -3085,19 +3011,19 @@ remote_async_wait (ptid_t ptid, struct target_waitstatus *status)
                long pnum = 0;
 
                /* If the packet contains a register number, save it in pnum
-                  and set p1 to point to the character following it. 
+                  and set p1 to point to the character following it.
                   Otherwise p1 points to p.  */
 
                /* If this packet is an awatch packet, don't parse the 'a'
                   as a register number.  */
-               
+
                if (!strncmp (p, "awatch", strlen ("awatch")) != 0)
                  {
                    /* Read the register number.  */
                    pnum = strtol (p, &p_temp, 16);
                    p1 = (unsigned char *) p_temp;
                  }
-               else 
+               else
                  p1 = p;
 
                if (p1 == p)    /* No register number present here */
@@ -3128,7 +3054,7 @@ remote_async_wait (ptid_t ptid, struct target_waitstatus *status)
                          p = p_temp;
                      }
                  }
-               
+
                else
                  {
                    struct packet_reg *reg = packet_reg_from_pnum (rs, pnum);
@@ -3145,7 +3071,7 @@ remote_async_wait (ptid_t ptid, struct target_waitstatus *status)
                    p += 2 * fieldsize;
                    if (fieldsize < DEPRECATED_REGISTER_RAW_SIZE (reg->regnum))
                      warning ("Remote reply is too short: %s", buf);
-                   supply_register (reg->regnum, regs);
+                   regcache_raw_supply (current_regcache, reg->regnum, regs);
                  }
 
                if (*p++ != ';')
@@ -3371,7 +3297,7 @@ store_register_using_P (int regnum)
 
   sprintf (buf, "P%s=", phex_nz (reg->pnum, 0));
   p = buf + strlen (buf);
-  regcache_collect (reg->regnum, regp);
+  regcache_raw_collect (current_regcache, reg->regnum, regp);
   bin2hex (regp, p, DEPRECATED_REGISTER_RAW_SIZE (reg->regnum));
   remote_send (buf, rs->remote_packet_size);
 
@@ -3432,7 +3358,7 @@ remote_store_registers (int regnum)
       {
        struct packet_reg *r = &rs->regs[i];
        if (r->in_g_packet)
-         regcache_collect (r->regnum, regs + r->offset);
+         regcache_raw_collect (current_regcache, r->regnum, regs + r->offset);
       }
   }
 
@@ -3529,7 +3455,7 @@ check_binary_download (CORE_ADDR addr)
       {
        char *buf = alloca (rs->remote_packet_size);
        char *p;
-       
+
        p = buf;
        *p++ = 'X';
        p += hexnumstr (p, (ULONGEST) addr);
@@ -3537,7 +3463,7 @@ check_binary_download (CORE_ADDR addr)
        p += hexnumstr (p, (ULONGEST) 0);
        *p++ = ':';
        *p = '\0';
-       
+
        putpkt_binary (buf, (int) (p - buf));
        getpkt (buf, (rs->remote_packet_size), 0);
 
@@ -3619,14 +3545,14 @@ remote_write_bytes (CORE_ADDR memaddr, char *myaddr, int len)
     default:
       internal_error (__FILE__, __LINE__, "bad switch");
     }
-  
+
   /* Append "<memaddr>".  */
   memaddr = remote_address_masked (memaddr);
   p += hexnumstr (p, (ULONGEST) memaddr);
 
   /* Append ",".  */
   *p++ = ',';
-  
+
   /* Append <len>.  Retain the location/size of <len>.  It may need to
      be adjusted once the packet body has been created.  */
   plen = p;
@@ -3636,7 +3562,7 @@ remote_write_bytes (CORE_ADDR memaddr, char *myaddr, int len)
   /* Append ":".  */
   *p++ = ':';
   *p = '\0';
-  
+
   /* Append the packet body.  */
   payload_start = p;
   switch (remote_protocol_binary_download.support)
@@ -3665,7 +3591,7 @@ remote_write_bytes (CORE_ADDR memaddr, char *myaddr, int len)
        }
       if (nr_bytes < todo)
        {
-         /* Escape chars have filled up the buffer prematurely, 
+         /* Escape chars have filled up the buffer prematurely,
             and we have actually sent fewer bytes than planned.
             Fix-up the length field of the packet.  Use the same
             number of characters as before.  */
@@ -3686,10 +3612,10 @@ remote_write_bytes (CORE_ADDR memaddr, char *myaddr, int len)
     default:
       internal_error (__FILE__, __LINE__, "bad switch");
     }
-  
+
   putpkt_binary (buf, (int) (p - buf));
   getpkt (buf, sizeof_buf, 0);
-  
+
   if (buf[0] == 'E')
     {
       /* There is no correspondance between what the remote protocol
@@ -3699,7 +3625,7 @@ remote_write_bytes (CORE_ADDR memaddr, char *myaddr, int len)
       errno = EIO;
       return 0;
     }
-  
+
   /* Return NR_BYTES, not TODO, in case escape chars caused us to send fewer
      bytes than we'd planned.  */
   return nr_bytes;
@@ -4051,7 +3977,7 @@ read_frame (char *buf,
            check_0 = readchar (remote_timeout);
            if (check_0 >= 0)
              check_1 = readchar (remote_timeout);
-           
+
            if (check_0 == SERIAL_TIMEOUT || check_1 == SERIAL_TIMEOUT)
              {
                if (remote_debug)
@@ -4092,7 +4018,7 @@ read_frame (char *buf,
 
            /* The character before ``*'' is repeated. */
 
-           if (repeat > 0 && repeat <= 255 
+           if (repeat > 0 && repeat <= 255
                && bc > 0
                 && bc + repeat - 1 < sizeof_buf - 1)
              {
@@ -4293,7 +4219,7 @@ extended_remote_mourn (void)
 {
   /* We do _not_ want to mourn the target like this; this will
      remove the extended remote target  from the target stack,
-     and the next time the user says "run" it'll fail. 
+     and the next time the user says "run" it'll fail.
 
      FIXME: What is the right thing to do here?  */
 #if 0
@@ -4311,13 +4237,14 @@ remote_mourn_1 (struct target_ops *target)
 
 /* In the extended protocol we want to be able to do things like
    "run" and have them basically work as expected.  So we need
-   a special create_inferior function. 
+   a special create_inferior function.
 
    FIXME: One day add support for changing the exec file
    we're debugging, arguments and an environment.  */
 
 static void
-extended_remote_create_inferior (char *exec_file, char *args, char **env)
+extended_remote_create_inferior (char *exec_file, char *args, char **env,
+                                int from_tty)
 {
   /* Rip out the breakpoints; we'll reinsert them after restarting
      the remote server.  */
@@ -4339,7 +4266,8 @@ extended_remote_create_inferior (char *exec_file, char *args, char **env)
 
 /* Async version of extended_remote_create_inferior. */
 static void
-extended_remote_async_create_inferior (char *exec_file, char *args, char **env)
+extended_remote_async_create_inferior (char *exec_file, char *args, char **env,
+                                      int from_tty)
 {
   /* Rip out the breakpoints; we'll reinsert them after restarting
      the remote server.  */
@@ -4408,19 +4336,19 @@ remote_insert_breakpoint (CORE_ADDR addr, char *contents_cache)
   struct remote_state *rs = get_remote_state ();
 #ifdef DEPRECATED_REMOTE_BREAKPOINT
   int val;
-#endif  
+#endif
   int bp_size;
 
   /* Try the "Z" s/w breakpoint packet if it is not already disabled.
      If it succeeds, then set the support to PACKET_ENABLE.  If it
      fails, and the user has explicitly requested the Z support then
      report an error, otherwise, mark it disabled and go on. */
-  
+
   if (remote_protocol_Z[Z_PACKET_SOFTWARE_BP].support != PACKET_DISABLE)
     {
       char *buf = alloca (rs->remote_packet_size);
       char *p = buf;
-      
+
       addr = remote_address_masked (addr);
       *(p++) = 'Z';
       *(p++) = '0';
@@ -4428,7 +4356,7 @@ remote_insert_breakpoint (CORE_ADDR addr, char *contents_cache)
       p += hexnumstr (p, (ULONGEST) addr);
       BREAKPOINT_FROM_PC (&addr, &bp_size);
       sprintf (p, ",%d", bp_size);
-      
+
       putpkt (buf);
       getpkt (buf, (rs->remote_packet_size), 0);
 
@@ -4443,7 +4371,7 @@ remote_insert_breakpoint (CORE_ADDR addr, char *contents_cache)
        }
     }
 
-#ifdef DEPRECATED_REMOTE_BREAKPOINT  
+#ifdef DEPRECATED_REMOTE_BREAKPOINT
   val = target_read_memory (addr, contents_cache, sizeof big_break_insn);
 
   if (val == 0)
@@ -4472,7 +4400,7 @@ remote_remove_breakpoint (CORE_ADDR addr, char *contents_cache)
     {
       char *buf = alloca (rs->remote_packet_size);
       char *p = buf;
-      
+
       *(p++) = 'z';
       *(p++) = '0';
       *(p++) = ',';
@@ -4481,7 +4409,7 @@ remote_remove_breakpoint (CORE_ADDR addr, char *contents_cache)
       p += hexnumstr (p, (ULONGEST) addr);
       BREAKPOINT_FROM_PC (&addr, &bp_size);
       sprintf (p, ",%d", bp_size);
-      
+
       putpkt (buf);
       getpkt (buf, (rs->remote_packet_size), 0);
 
@@ -4527,13 +4455,13 @@ remote_insert_watchpoint (CORE_ADDR addr, int len, int type)
     error ("Can't set hardware watchpoints without the '%s' (%s) packet\n",
           remote_protocol_Z[packet].name,
           remote_protocol_Z[packet].title);
-  
+
   sprintf (buf, "Z%x,", packet);
   p = strchr (buf, '\0');
   addr = remote_address_masked (addr);
   p += hexnumstr (p, (ULONGEST) addr);
   sprintf (p, ",%x", len);
-  
+
   putpkt (buf);
   getpkt (buf, (rs->remote_packet_size), 0);
 
@@ -4562,7 +4490,7 @@ remote_remove_watchpoint (CORE_ADDR addr, int len, int type)
     error ("Can't clear hardware watchpoints without the '%s' (%s) packet\n",
           remote_protocol_Z[packet].name,
           remote_protocol_Z[packet].title);
-  
+
   sprintf (buf, "z%x,", packet);
   p = strchr (buf, '\0');
   addr = remote_address_masked (addr);
@@ -4619,10 +4547,13 @@ remote_stopped_by_watchpoint (void)
     return remote_stopped_by_watchpoint_p;
 }
 
+extern int stepped_after_stopped_by_watchpoint;
+
 static CORE_ADDR
 remote_stopped_data_address (void)
 {
-  if (remote_stopped_by_watchpoint ())
+  if (remote_stopped_by_watchpoint ()
+      || stepped_after_stopped_by_watchpoint)
     return remote_watch_data_address;
   return (CORE_ADDR)0;
 }
@@ -4635,21 +4566,21 @@ remote_insert_hw_breakpoint (CORE_ADDR addr, char *shadow)
   struct remote_state *rs = get_remote_state ();
   char *buf = alloca (rs->remote_packet_size);
   char *p = buf;
-      
+
   /* The length field should be set to the size of a breakpoint
      instruction.  */
 
-  BREAKPOINT_FROM_PC (&addr, &len);  
+  BREAKPOINT_FROM_PC (&addr, &len);
 
   if (remote_protocol_Z[Z_PACKET_HARDWARE_BP].support == PACKET_DISABLE)
     error ("Can't set hardware breakpoint without the '%s' (%s) packet\n",
           remote_protocol_Z[Z_PACKET_HARDWARE_BP].name,
           remote_protocol_Z[Z_PACKET_HARDWARE_BP].title);
-  
+
   *(p++) = 'Z';
   *(p++) = '1';
   *(p++) = ',';
-  
+
   addr = remote_address_masked (addr);
   p += hexnumstr (p, (ULONGEST) addr);
   sprintf (p, ",%x", len);
@@ -4670,7 +4601,7 @@ remote_insert_hw_breakpoint (CORE_ADDR addr, char *shadow)
 }
 
 
-static int 
+static int
 remote_remove_hw_breakpoint (CORE_ADDR addr, char *shadow)
 {
   int len;
@@ -4687,18 +4618,18 @@ remote_remove_hw_breakpoint (CORE_ADDR addr, char *shadow)
     error ("Can't clear hardware breakpoint without the '%s' (%s) packet\n",
           remote_protocol_Z[Z_PACKET_HARDWARE_BP].name,
           remote_protocol_Z[Z_PACKET_HARDWARE_BP].title);
-  
+
   *(p++) = 'z';
   *(p++) = '1';
   *(p++) = ',';
-  
+
   addr = remote_address_masked (addr);
   p += hexnumstr (p, (ULONGEST) addr);
   sprintf (p, ",%x", len);
 
   putpkt(buf);
   getpkt (buf, (rs->remote_packet_size), 0);
-  
+
   switch (packet_ok (buf, &remote_protocol_Z[Z_PACKET_HARDWARE_BP]))
     {
     case PACKET_ERROR:
@@ -4798,7 +4729,7 @@ compare_sections_command (char *args, int from_tty)
       if (!(s->flags & SEC_LOAD))
        continue;               /* skip non-loadable section */
 
-      size = bfd_get_section_size_before_reloc (s);
+      size = bfd_get_section_size (s);
       if (size == 0)
        continue;               /* skip zero-length section */
 
@@ -4872,6 +4803,41 @@ remote_xfer_partial (struct target_ops *ops, enum target_object object,
     case TARGET_OBJECT_AVR:
       query_type = 'R';
       break;
+
+    case TARGET_OBJECT_AUXV:
+      if (remote_protocol_qPart_auxv.support != PACKET_DISABLE)
+       {
+         unsigned int total = 0;
+         while (len > 0)
+           {
+             LONGEST n = min ((rs->remote_packet_size - 2) / 2, len);
+             snprintf (buf2, rs->remote_packet_size,
+                       "qPart:auxv:read::%s,%s",
+                       phex_nz (offset, sizeof offset),
+                       phex_nz (n, sizeof n));
+             i = putpkt (buf2);
+             if (i < 0)
+               return total > 0 ? total : i;
+             buf2[0] = '\0';
+             getpkt (buf2, rs->remote_packet_size, 0);
+             if (packet_ok (buf2, &remote_protocol_qPart_auxv) != PACKET_OK)
+               return total > 0 ? total : -1;
+             if (buf2[0] == 'O' && buf2[1] == 'K' && buf2[2] == '\0')
+               break;          /* Got EOF indicator.  */
+             /* Got some data.  */
+             i = hex2bin (buf2, readbuf, len);
+             if (i > 0)
+               {
+                 readbuf = (void *) ((char *) readbuf + i);
+                 offset += i;
+                 len -= i;
+                 total += i;
+               }
+           }
+         return total;
+       }
+      return -1;
+
     default:
       return -1;
     }
@@ -5363,12 +5329,11 @@ show_remote_cmd (char *args, int from_tty)
   /* FIXME: cagney/2002-06-15: This function should iterate over
      remote_show_cmdlist for a list of sub commands to show.  */
   show_remote_protocol_Z_packet_cmd (args, from_tty, NULL);
-  show_remote_protocol_e_packet_cmd (args, from_tty, NULL);
-  show_remote_protocol_E_packet_cmd (args, from_tty, NULL);
   show_remote_protocol_P_packet_cmd (args, from_tty, NULL);
   show_remote_protocol_qSymbol_packet_cmd (args, from_tty, NULL);
   show_remote_protocol_vcont_packet_cmd (args, from_tty, NULL);
   show_remote_protocol_binary_download_cmd (args, from_tty, NULL);
+  show_remote_protocol_qPart_auxv_packet_cmd (args, from_tty, NULL);
 }
 
 static void
@@ -5402,7 +5367,7 @@ _initialize_remote (void)
   struct cmd_list_element *tmpcmd;
 
   /* architecture specific data */
-  remote_gdbarch_data_handle = register_gdbarch_data (init_remote_state);
+  remote_gdbarch_data_handle = gdbarch_data_register_post_init (init_remote_state);
 
   /* Old tacky stuff.  NOTE: This comes after the remote protocol so
      that the remote protocol has been initialized.  */
@@ -5422,8 +5387,8 @@ _initialize_remote (void)
   add_target (&extended_async_remote_ops);
 
   /* Hook into new objfile notification.  */
-  remote_new_objfile_chain = target_new_objfile_hook;
-  target_new_objfile_hook  = remote_new_objfile;
+  remote_new_objfile_chain = deprecated_target_new_objfile_hook;
+  deprecated_target_new_objfile_hook  = remote_new_objfile;
 
 #if 0
   init_remote_threadtests ();
@@ -5510,7 +5475,7 @@ 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
+  deprecated_add_show_from_set
     (add_set_cmd ("remoteaddresssize", class_obscure,
                  var_integer, (char *) &remote_address_size,
                  "Set the maximum size of the address (in bits) \
@@ -5527,7 +5492,7 @@ in a memory packet.\n",
 #if 0
   /* XXXX - should ``set remotebinarydownload'' be retained for
      compatibility. */
-  add_show_from_set
+  deprecated_add_show_from_set
     (add_set_cmd ("remotebinarydownload", no_class,
                  var_boolean, (char *) &remote_binary_download,
                  "Set binary downloads.\n", &setlist),
@@ -5548,28 +5513,6 @@ in a memory packet.\n",
                         &remote_set_cmdlist, &remote_show_cmdlist,
                         0);
 
-  add_packet_config_cmd (&remote_protocol_e,
-                        "e", "step-over-range",
-                        set_remote_protocol_e_packet_cmd,
-                        show_remote_protocol_e_packet_cmd,
-                        &remote_set_cmdlist, &remote_show_cmdlist,
-                        0);
-  /* Disable by default.  The ``e'' packet has nasty interactions with
-     the threading code - it relies on global state.  */
-  remote_protocol_e.detect = AUTO_BOOLEAN_FALSE;
-  update_packet_config (&remote_protocol_e);
-
-  add_packet_config_cmd (&remote_protocol_E,
-                        "E", "step-over-range-w-signal",
-                        set_remote_protocol_E_packet_cmd,
-                        show_remote_protocol_E_packet_cmd,
-                        &remote_set_cmdlist, &remote_show_cmdlist,
-                        0);
-  /* Disable by default.  The ``e'' packet has nasty interactions with
-     the threading code - it relies on global state.  */
-  remote_protocol_E.detect = AUTO_BOOLEAN_FALSE;
-  update_packet_config (&remote_protocol_E);
-
   add_packet_config_cmd (&remote_protocol_P,
                         "P", "set-register",
                         set_remote_protocol_P_packet_cmd,
@@ -5612,6 +5555,13 @@ in a memory packet.\n",
                         &remote_set_cmdlist, &remote_show_cmdlist,
                         0);
 
+  add_packet_config_cmd (&remote_protocol_qPart_auxv,
+                        "qPart_auxv", "read-aux-vector",
+                        set_remote_protocol_qPart_auxv_packet_cmd,
+                        show_remote_protocol_qPart_auxv_packet_cmd,
+                        &remote_set_cmdlist, &remote_show_cmdlist,
+                        0);
+
   /* Keep the old ``set remote Z-packet ...'' working. */
   add_setshow_auto_boolean_cmd ("Z-packet", class_obscure,
                                &remote_Z_packet_detect, "\
This page took 0.038661 seconds and 4 git commands to generate.