* remote.c (remote_pid_to_str): Capitalize "Thread".
[deliverable/binutils-gdb.git] / gdb / remote.c
index d05be841638cccb5710159df613fe3be10669dd6..cf872b1a173fe130d4469cfee86b77ecae374400 100644 (file)
@@ -244,7 +244,7 @@ struct remote_state
 static struct remote_state remote_state;
 
 static struct remote_state *
-get_remote_state (void)
+get_remote_state_raw (void)
 {
   return &remote_state;
 }
@@ -294,11 +294,26 @@ get_remote_arch_state (void)
   return gdbarch_data (current_gdbarch, remote_gdbarch_data_handle);
 }
 
+/* Fetch the global remote target state.  */
+
+static struct remote_state *
+get_remote_state (void)
+{
+  /* Make sure that the remote architecture state has been
+     initialized, because doing so might reallocate rs->buf.  Any
+     function which calls getpkt also needs to be mindful of changes
+     to rs->buf, but this call limits the number of places which run
+     into trouble.  */
+  get_remote_arch_state ();
+
+  return get_remote_state_raw ();
+}
+
 static void *
 init_remote_state (struct gdbarch *gdbarch)
 {
   int regnum;
-  struct remote_state *rs = get_remote_state ();
+  struct remote_state *rs = get_remote_state_raw ();
   struct remote_arch_state *rsa;
 
   rsa = GDBARCH_OBSTACK_ZALLOC (gdbarch, struct remote_arch_state);
@@ -3889,8 +3904,6 @@ check_binary_download (CORE_ADDR addr)
    are omitted.
 
    Returns the number of bytes transferred, or 0 (setting errno) for
-
-   Returns number of bytes transferred, or 0 (setting errno) for
    error.  Only transfer a single packet.  */
 
 static int
@@ -4000,8 +4013,9 @@ remote_write_bytes_aux (const char *header, CORE_ADDR memaddr,
                                             payload_size);
 
       /* If not all TODO bytes fit, then we'll need another packet.  Make
-        a second try to keep the end of the packet aligned.  */
-      if (nr_bytes < todo)
+        a second try to keep the end of the packet aligned.  Don't do
+        this if the packet is tiny.  */
+      if (nr_bytes < todo && nr_bytes > 2 * REMOTE_ALIGN_WRITES)
        {
          int new_nr_bytes;
 
@@ -5820,7 +5834,7 @@ remote_pid_to_str (ptid_t ptid)
 {
   static char buf[32];
 
-  xsnprintf (buf, sizeof buf, "thread %d", ptid_get_pid (ptid));
+  xsnprintf (buf, sizeof buf, "Thread %d", ptid_get_pid (ptid));
   return buf;
 }
 
@@ -6143,7 +6157,7 @@ _initialize_remote (void)
      of these, not one per target.  Only one target is active at a
      time.  The default buffer size is unimportant; it will be expanded
      whenever a larger buffer is needed.  */
-  rs = get_remote_state ();
+  rs = get_remote_state_raw ();
   rs->buf_size = 400;
   rs->buf = xmalloc (rs->buf_size);
 
This page took 0.025244 seconds and 4 git commands to generate.