qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Vacha Bhavsar <vacha.bhavsar@oss.qualcomm.com>
Cc: qemu-devel@nongnu.org, qemu-arm@nongnu.org,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Thomas Huth" <thuth@redhat.com>
Subject: Re: [PATCH v5 2/4] target/arm: Change GDBState's line_buf to a GString
Date: Tue, 12 Aug 2025 12:32:47 +0100	[thread overview]
Message-ID: <CAFEAcA9PXtsj5nAZ47Fv3h5gDdir_QT5pavUF6-Yc1tZZP26ag@mail.gmail.com> (raw)
In-Reply-To: <20250811193654.4012878-3-vacha.bhavsar@oss.qualcomm.com>

On Mon, 11 Aug 2025 at 20:37, Vacha Bhavsar
<vacha.bhavsar@oss.qualcomm.com> wrote:
>
> This patch changes GDBState's line_buf from a character
> array to a GString. This allows line_buf to be dynamically
> re-sizeable.
>
> Signed-off-by: Vacha Bhavsar <vacha.bhavsar@oss.qualcomm.com>
> ---
> Changes since v4:
> - this patch was not present in v4, it has been added as
> suggested during review of v4
> ---

Note that since the GDBState is a file-local variable,
not allocated on the stack, it's not an issue that
line_buf[MAX_PACKET_LENGTH] is large. So whether we
make this change I think should be based on whether
it makes the code easier to read and less likely to
contain string buffer manipulation bugs.


> -                if (gdbserver_state.line_buf_index + repeat >= > sizeof(gdbserver_state.line_buf) - 1) {
> +                if (gdbserver_state.line_buf->len + repeat >= MAX_PACKET_LENGTH) {
>                      /* that many repeats would overrun the command buffer */

This comment no longer makes sense if we don't have a
fixed command buffer. In general, if we're moving away
from a fixed-sized buffer we should consider what we
want to do in all the various places that are currently
doing checks against MAX_PACKET_LENGTH.

thanks
-- PMM


  reply	other threads:[~2025-08-12 11:34 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-11 19:36 [PATCH v5 0/4] target/arm: Added support for SME register exposure to GDB Vacha Bhavsar
2025-08-11 19:36 ` [PATCH v5 1/4] target/arm: Increase MAX_PACKET_LENGTH for SME ZA Vacha Bhavsar
2025-08-19  9:14   ` Peter Maydell
2025-08-11 19:36 ` [PATCH v5 2/4] target/arm: Change GDBState's line_buf to a GString Vacha Bhavsar
2025-08-12 11:32   ` Peter Maydell [this message]
2025-08-12 19:31     ` Vacha Bhavsar
2025-08-11 19:36 ` [PATCH v5 3/4] target/arm: Added support for SME register exposure to Vacha Bhavsar
2025-08-19  9:04   ` Peter Maydell
2025-08-21 21:37     ` Vacha Bhavsar
2025-08-22 12:27       ` Peter Maydell
2025-08-26 18:52         ` Vacha Bhavsar
2025-08-11 19:36 ` [PATCH v5 4/4] target/arm: Added test case for SME register exposure Vacha Bhavsar
2025-08-19  9:13   ` Peter Maydell
2025-08-22 17:32     ` Vacha Bhavsar
2025-08-23 18:13       ` Peter Maydell
2025-08-26 18:51         ` Vacha Bhavsar

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=CAFEAcA9PXtsj5nAZ47Fv3h5gDdir_QT5pavUF6-Yc1tZZP26ag@mail.gmail.com \
    --to=peter.maydell@linaro.org \
    --cc=alex.bennee@linaro.org \
    --cc=pbonzini@redhat.com \
    --cc=philmd@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.com \
    --cc=vacha.bhavsar@oss.qualcomm.com \
    /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).