+2010-04-13 Pedro Alves <pedro@codesourcery.com>
+
+ * remote.c (remote_get_noisy_reply): Don't error out on empty
+ replies.
+ (remote_start_remote): Update and merge tracepoints and trace
+ state variables as long as the target supports tracepoints.
+ (remote_trace_init): Fix prototype.
+ (remote_download_trace_state_variable): Validate reply.
+ (remote_trace_set_readonly_regions): Fix prototype.
+ (remote_trace_start): Fix prototype. Check for empty reply.
+ (remote_get_trace_status): Small cleanup.
+ (remote_trace_stop): Fix prototype. Check for empty reply.
+ (remote_trace_find): Check for empty reply.
+ (remote_save_trace_data): Validate reply.
+ (remote_set_disconnected_tracing): Check for empty reply, and
+ validate reply.
+ (remote_set_circular_trace_buffer): Ditto.
+
2010-04-13 Pierre Muller <muller@ics.u-strasbg.fr>
Suppress unused value warning during compilation.
QUIT; /* allow user to bail out with ^C */
getpkt (buf_p, sizeof_buf, 0);
buf = *buf_p;
- if (buf[0] == 0)
- error (_("Target does not support this command."));
- else if (buf[0] == 'E')
+ if (buf[0] == 'E')
trace_error (buf);
- else if (buf[0] == 'O' &&
- buf[1] != 'K')
+ else if (buf[0] == 'O' && buf[1] != 'K')
remote_console_output (buf + 1); /* 'O' message from stub */
else
return buf; /* here's the actual reply */
/* Possibly the target has been engaged in a trace run started
previously; find out where things are at. */
- if (rs->disconnected_tracing)
+ if (remote_get_trace_status (current_trace_status ()) != -1)
{
struct uploaded_tp *uploaded_tps = NULL;
struct uploaded_tsv *uploaded_tsvs = NULL;
- remote_get_trace_status (current_trace_status ());
if (current_trace_status ()->running)
printf_filtered (_("Trace is already running on the target.\n"));
}
static void
-remote_trace_init ()
+remote_trace_init (void)
{
putpkt ("QTinit");
remote_get_noisy_reply (&target_buf, &target_buf_size);
- if (strcmp (target_buf, "OK"))
+ if (strcmp (target_buf, "OK") != 0)
error (_("Target does not support this command."));
}
*p++ = '\0';
putpkt (rs->buf);
remote_get_noisy_reply (&target_buf, &target_buf_size);
+ if (*target_buf == '\0')
+ error (_("Target does not support this command."));
+ if (strcmp (target_buf, "OK") != 0)
+ error (_("Error on target while downloading trace state variable."));
}
static void
-remote_trace_set_readonly_regions ()
+remote_trace_set_readonly_regions (void)
{
asection *s;
bfd_size_type size;
}
static void
-remote_trace_start ()
+remote_trace_start (void)
{
putpkt ("QTStart");
remote_get_noisy_reply (&target_buf, &target_buf_size);
- if (strcmp (target_buf, "OK"))
+ if (*target_buf == '\0')
+ error (_("Target does not support this command."));
+ if (strcmp (target_buf, "OK") != 0)
error (_("Bogus reply from target: %s"), target_buf);
}
trace_regblock_size = get_remote_arch_state ()->sizeof_g_packet;
putpkt ("qTStatus");
- getpkt (&target_buf, &target_buf_size, 0);
- /* FIXME should handle more variety of replies */
-
- p = target_buf;
+ p = remote_get_noisy_reply (&target_buf, &target_buf_size);
/* If the remote target doesn't do tracing, flag it. */
if (*p == '\0')
}
static void
-remote_trace_stop ()
+remote_trace_stop (void)
{
putpkt ("QTStop");
remote_get_noisy_reply (&target_buf, &target_buf_size);
- if (strcmp (target_buf, "OK"))
+ if (*target_buf == '\0')
+ error (_("Target does not support this command."));
+ if (strcmp (target_buf, "OK") != 0)
error (_("Bogus reply from target: %s"), target_buf);
}
putpkt (rs->buf);
reply = remote_get_noisy_reply (&(rs->buf), &sizeof_pkt);
+ if (*reply == '\0')
+ error (_("Target does not support this command."));
while (reply && *reply)
switch (*reply)
p += 2 * bin2hex ((gdb_byte *) filename, p, 0);
*p++ = '\0';
putpkt (rs->buf);
- remote_get_noisy_reply (&target_buf, &target_buf_size);
+ reply = remote_get_noisy_reply (&target_buf, &target_buf_size);
+ if (*reply != '\0')
+ error (_("Target does not support this command."));
+ if (strcmp (reply, "OK") != 0)
+ error (_("Bogus reply from target: %s"), reply);
return 0;
}
if (rs->disconnected_tracing)
{
+ char *reply;
+
sprintf (rs->buf, "QTDisconnected:%x", val);
putpkt (rs->buf);
- remote_get_noisy_reply (&target_buf, &target_buf_size);
- if (strcmp (target_buf, "OK"))
+ reply = remote_get_noisy_reply (&target_buf, &target_buf_size);
+ if (*reply == '\0')
error (_("Target does not support this command."));
+ if (strcmp (reply, "OK") != 0)
+ error (_("Bogus reply from target: %s"), reply);
}
else if (val)
warning (_("Target does not support disconnected tracing."));
remote_set_circular_trace_buffer (int val)
{
struct remote_state *rs = get_remote_state ();
+ char *reply;
sprintf (rs->buf, "QTBuffer:circular:%x", val);
putpkt (rs->buf);
- remote_get_noisy_reply (&target_buf, &target_buf_size);
- if (strcmp (target_buf, "OK"))
+ reply = remote_get_noisy_reply (&target_buf, &target_buf_size);
+ if (*reply == '\0')
error (_("Target does not support this command."));
+ if (strcmp (reply, "OK") != 0)
+ error (_("Bogus reply from target: %s"), reply);
}
static void