static struct remote_state remote_state;
static struct remote_state *
-get_remote_state (void)
+get_remote_state_raw (void)
{
return &remote_state;
}
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);
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
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;
{
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;
}
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);