Re: RFA/RFC: vCont for the remote protocol [client]

Andrew Cagney
2003-10-15T00:15:11Z

[I think my GNU e-mail is down] [I'm also having trouble reading this
unified diff, so watch out :-)]

+/* Check for the availability of vCont. This function should also check
+ the response. */

see below ...

> static void
> -remote_resume (ptid_t ptid, int step, enum target_signal siggnal)
> +remote_vcont_probe (struct remote_state *rs, char *buf)
> {
> - struct remote_state *rs = get_remote_state ();
> - char *buf = alloca (rs->remote_packet_size);
> - int pid = PIDGET (ptid);
> - char *p;
> -
> - if (pid == -1)
> - set_thread (0, 0); /* run any thread */
> - else
> - set_thread (pid, 0); /* run this thread */
> -
> - last_sent_signal = siggnal;
> - last_sent_step = step;
> + strcpy (buf, "vCont?");
> + putpkt (buf);
> + getpkt (buf, rs->remote_packet_size, 0);
> + packet_ok (buf, &remote_protocol_vcont);
> +}

packet_ok will go through the path:

/* The packet may or may not be OK. Just assume it is */
return PACKET_OK;

Shouldn't remote_vcont_probe apply additional sanity checks. For
instance that the response is well formed, and that all the letters
[SCsc] appeared? If they are not all present, just mark the packet is
not supported for now. (But also comment this).

+static int
+remote_vcont_resume (ptid_t ptid, int step, enum target_signal siggnal)

What's the return value?

+{
+ struct remote_state *rs = get_remote_state ();
+ int pid = PIDGET (ptid);
+ char *buf = alloca (rs->remote_packet_size);

Rather than ALLOCA here, can you ...

+ /* If we could generate a wider range of packets, we'd have to worry
+ about overflowing BUF. Should there be a generic
+ "multi-part-packet" packet? */
+
+ if (PIDGET (inferior_ptid) == MAGIC_NULL_PID)
+ {
+ /* MAGIC_NULL_PTID means that we don't have any active threads, so we
+ don't have any PID numbers the inferior will understand. Make sure
+ to only send forms that do not specify a PID. */
+ if (step && siggnal != TARGET_SIGNAL_0)
+ sprintf (buf, "vCont;S%02x", siggnal);

... use XASPRINTF here (along with some sort of cleanup).

Otherwize ok.

Andrew