On 11/30/19 9:45 AM, Alex Bennée wrote:
> Rather than having a static buffer replace str_buf with a GString
> which we know can grow on demand. Convert the internal functions to
> take a GString instead of a char * and length.
> 
> Signed-off-by: Alex Bennée <alex.ben...@linaro.org>
> Reviewed-by: Richard Henderson <richard.hender...@linaro.org>
> 
> ---
> v2
>   - fix conflict from status gdbserver_state
>   - add put_strbuf helper
> ---
>  gdbstub.c | 195 +++++++++++++++++++++++++-----------------------------
>  1 file changed, 90 insertions(+), 105 deletions(-)
> 
> @@ -667,25 +667,28 @@ static int put_packet(const char *buf)

Hi,

I did some tests with my target having lot of registers and was
wondering if we should add an assert there (or even better in
put_packet_binary()). Something like:
       /* FIXME: until bigger packets are supported */
       g_assert(strlen(buf) <= MAX_PACKET_LENGTH);

There is a memcpy() in put_packet_binary() that overflows
in that case. With this patch, read_all_registers() can for example
generate binary packet up to 2*MAX_PACKET_LENGTH.

>      return put_packet_binary(buf, strlen(buf), false);
>  }

Apart from this case which don't happen with in-tree targets, it works
fine. So,
Tested-by: Damien Hedde <damien.he...@greensocs.com>

I'll work on the missing bits for bigger packet support I soon as I have
some spare time.

Regards,
--
Damien

Reply via email to