Re: [RFC 2/9] move some rsp bits into rsp-low.h

Yao Qi
2014-01-21T03:24:35Z

On 01/21/2014 03:18 AM, Tom Tromey wrote:
> Note that the two variants of remote_escape_output disagreed on the
> treatment of "*". On the theory that quoting cannot hurt but the
> absence possibly can, I chose the gdbserver variant to be the
> canonical one.

Right, we must escape "*", because "Responses sent by the stub must also
escape 0x2a (ascii ‘*’), so that it is not interpreted as the start of
a run-length encoded sequence (described next).", said in

https://sourceware.org/gdb/current/onlinedocs/gdb/Overview.html

> +
> +/* Convert BUFFER, escaped data LEN bytes long, into binary data
> + in OUT_BUF. Return the number of bytes written to OUT_BUF.
> + Raise an error if the total number of bytes exceeds OUT_MAXLEN.
> +
> + This function reverses remote_escape_output. It allows more
> + escaped characters than that function does, in particular because

I know these comments are moved mechanically, but it is out of date.
We can remove this line...

> + '*' must be escaped to avoid the run-length encoding processing
> + in reading packets. */

... and move this line to remote_escape_output to explain why '*' is
escaped.

> +
> +extern int remote_unescape_input (const gdb_byte *buffer, int len,
> + gdb_byte *out_buf, int out_maxlen);
> +

--
Yao (é½å°§)