[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 03/14] gdbstub: move str_buf to GDBState and use GString
From: |
Damien Hedde |
Subject: |
Re: [PATCH v2 03/14] gdbstub: move str_buf to GDBState and use GString |
Date: |
Tue, 3 Dec 2019 13:49:15 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.0 |
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 <address@hidden>
> Reviewed-by: Richard Henderson <address@hidden>
>
> ---
> 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 <address@hidden>
I'll work on the missing bits for bigger packet support I soon as I have
some spare time.
Regards,
--
Damien