From: Eli Zaretskii <eliz@gnu.org>
To: Ciaran Woodward <ciaranwoodward@xmos.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] gdb/doc: Fix incorrect information in RSP doc
Date: Mon, 22 Apr 2024 18:40:16 +0300 [thread overview]
Message-ID: <86cyqh5rtr.fsf@gnu.org> (raw)
In-Reply-To: <20240422153502.7250-1-ciaranwoodward@xmos.com> (message from Ciaran Woodward on Mon, 22 Apr 2024 16:35:02 +0100)
> From: Ciaran Woodward <ciaranwoodward@xmos.com>
> Cc: Ciaran Woodward <ciaranwoodward@xmos.com>
> Date: Mon, 22 Apr 2024 16:35:02 +0100
>
> The 'PacketSize' attribute of the qSupported packet was
> documented to be the maximum size of the packet including
> the frame and checksum bytes, however this is not how it
> was treated in the code. In reality, PacketSize is the
> maximum size of the data in the RSP packets, not including
> the framing or checksum bytes.
>
> For instance, GDB's remote.c treats it as the maximum
> number of data bytes. See remote_read_bytes_1, where the
> size of the request is capped at PacketSize/2 (for
> hex-encoding).
>
> Also see gdbserver's server.cc, where the internal buffer
> is sized as PBUFSIZ and PBUFSIZ-1 is used as PacketSize.
> In gdbserver's case, the buffer is not used for any of the
> framing or checksum characters. (I am not certain where the -1
> comes from. I think it comes from back when there were no
> binary packets, so packets were treated as strings with
> null terminators).
>
> It also seems like gdbservers in the wild treat it in
> this way:
>
> Embocosm doc:
> https://www.embecosm.com/appnotes/ean4/embecosm-howto-rsp-server-ean4-issue-2.html#id3078000
>
> A quick glance over openocd's gdb_server.c gdb_put_packet_inner()
> function shows that the internal buffer also excludes the framing
> and checksum.
>
> Likewise, qEmu's gdbstub.c allocates PacketSize bytes for
> the internal packet contents, and PacketSize+4 for the
> full frame.
> ---
> gdb/doc/gdb.texinfo | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Thanks. The patch is, of course, okay Texinfo-wise, but I'd like
someone who knows about the subject matter to confirm your
conclusions.
Reviewed-By: Eli Zaretskii <eliz@gnu.org>
next prev parent reply other threads:[~2024-04-22 18:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-22 15:35 Ciaran Woodward
2024-04-22 15:40 ` Eli Zaretskii [this message]
2024-04-23 16:04 ` Luis Machado
2024-04-23 18:58 ` Pedro Alves
2024-04-24 16:28 ` Ciaran Woodward
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=86cyqh5rtr.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=ciaranwoodward@xmos.com \
--cc=gdb-patches@sourceware.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 read-only IMAP folder(s) and NNTP newsgroup(s).