From: Damien Hedde <damien.hedde@greensocs.com>
To: "Alex Bennée" <alex.bennee@linaro.org>
Cc: philmd@redhat.com, qemu-devel@nongnu.org, luc.michel@greensocs.com
Subject: Re: [PATCH v2 2/2] gdbstub: do not split gdb_monitor_write payload
Date: Thu, 12 Dec 2019 11:14:37 +0100 [thread overview]
Message-ID: <c0457ff2-0141-34b5-980f-4f7ae8a65b09@greensocs.com> (raw)
In-Reply-To: <871rta3czj.fsf@linaro.org>
On 12/11/19 7:59 PM, Alex Bennée wrote:
>
> Damien Hedde <damien.hedde@greensocs.com> writes:
>
>> Since we can now send packets of arbitrary length:
>> simplify gdb_monitor_write() and send the whole payload
>> in one packet.
>
> Do we know gdb won't barf on us. Does the negotiated max packet size
> only apply to data sent to the gdbserver?
Yes the negociated packet size is only about packet we can receive.
Qutoting the gdb doc:
| ‘PacketSize=bytes’
|
| The remote stub can accept packets up to at least bytes in length.
| GDB will send packets up to this size for bulk transfers, and will
| never send larger packets.
The qSupported doc also says that "Any GDB which sends a ‘qSupported’
packet supports receiving packets of unlimited length".
I did some digging and qSupported appeared in gdb 6.6 (december 2006).
And gdb supported arbitrary sized packet even before that (6.4.9 2006 too).
>
>>
>> Suggested-by: Luc Michel <luc.michel@greensocs.com>
>> Signed-off-by: Damien Hedde <damien.hedde@greensocs.com>
>> ---
>> gdbstub.c | 23 +++--------------------
>> 1 file changed, 3 insertions(+), 20 deletions(-)
>>
>> diff --git a/gdbstub.c b/gdbstub.c
>> index 93b26f1b86..ef999abee2 100644
>> --- a/gdbstub.c
>> +++ b/gdbstub.c
>> @@ -3200,28 +3200,11 @@ static void gdb_chr_event(void *opaque, int event)
>> }
>> }
>>
>> -static void gdb_monitor_output(GDBState *s, const char *msg, int len)
>> -{
>> - g_autoptr(GString) buf = g_string_new("O");
>> - memtohex(buf, (uint8_t *)msg, len);
>> - put_packet(buf->str);
>> -}
>> -
>> static int gdb_monitor_write(Chardev *chr, const uint8_t *buf, int len)
>> {
>> - const char *p = (const char *)buf;
>> - int max_sz;
>> -
>> - max_sz = (MAX_PACKET_LENGTH / 2) + 1;
>> - for (;;) {
>> - if (len <= max_sz) {
>> - gdb_monitor_output(&gdbserver_state, p, len);
>> - break;
>> - }
>> - gdb_monitor_output(&gdbserver_state, p, max_sz);
>> - p += max_sz;
>> - len -= max_sz;
>> - }
>> + g_autoptr(GString) hex_buf = g_string_new("O");
>> + memtohex(hex_buf, buf, len);
>> + put_packet(hex_buf->str);
>> return len;
>> }
>
>
next prev parent reply other threads:[~2019-12-12 10:17 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-11 16:05 [PATCH v2 0/2] gdbstub: allow sending packet of arbitrary length Damien Hedde
2019-12-11 16:05 ` [PATCH v2 1/2] gdbstub: change GDBState.last_packet to GByteArray Damien Hedde
2019-12-11 18:50 ` Alex Bennée
2019-12-12 14:15 ` Luc Michel
2019-12-11 16:05 ` [PATCH v2 2/2] gdbstub: do not split gdb_monitor_write payload Damien Hedde
2019-12-11 18:58 ` Philippe Mathieu-Daudé
2019-12-12 9:39 ` Damien Hedde
2019-12-11 18:59 ` Alex Bennée
2019-12-12 10:14 ` Damien Hedde [this message]
2019-12-12 10:52 ` Alex Bennée
2019-12-13 12:13 ` Damien Hedde
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c0457ff2-0141-34b5-980f-4f7ae8a65b09@greensocs.com \
--to=damien.hedde@greensocs.com \
--cc=alex.bennee@linaro.org \
--cc=luc.michel@greensocs.com \
--cc=philmd@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).