All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Damien Hedde <damien.hedde@greensocs.com>, qemu-devel@nongnu.org
Cc: alex.bennee@linaro.org, luc.michel@greensocs.com
Subject: Re: [PATCH v2 2/2] gdbstub: do not split gdb_monitor_write payload
Date: Wed, 11 Dec 2019 19:58:39 +0100	[thread overview]
Message-ID: <e1b2e3a7-a40a-3e0f-ce83-bfacd28aedeb@redhat.com> (raw)
In-Reply-To: <20191211160514.58373-3-damien.hedde@greensocs.com>

On 12/11/19 5:05 PM, Damien Hedde wrote:
> Since we can now send packets of arbitrary length:
> simplify gdb_monitor_write() and send the whole payload
> in one packet.

While we can send arbitrary length on the wire, we advertise 
PacketSize=MAX_PACKET_LENGTH in handle_query_supported().

We can raise this limit however.

> 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;
>   }
>   
> 



  reply	other threads:[~2019-12-11 19:01 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é [this message]
2019-12-12  9:39     ` Damien Hedde
2019-12-11 18:59   ` Alex Bennée
2019-12-12 10:14     ` Damien Hedde
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=e1b2e3a7-a40a-3e0f-ce83-bfacd28aedeb@redhat.com \
    --to=philmd@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=damien.hedde@greensocs.com \
    --cc=luc.michel@greensocs.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.