aboutsummaryrefslogtreecommitdiff
path: root/gdbstub.c
diff options
context:
space:
mode:
authorDamien Hedde <damien.hedde@greensocs.com>2020-03-16 17:21:54 +0000
committerAlex Bennée <alex.bennee@linaro.org>2020-03-17 17:38:51 +0000
commitd86b4672f2ee4775ce5711c5626e6311efd788c8 (patch)
tree4be63c9bc0b5cddbaf7f2ca7204a5cac00906cac /gdbstub.c
parentd116e813a5aa6eaadf46fea39ea0395c060b3721 (diff)
gdbstub: do not split gdb_monitor_write payload
Since we can now send packets of arbitrary length: simplify gdb_monitor_write() and send the whole payload in one packet. Suggested-by: Luc Michel <luc.michel@greensocs.com> Signed-off-by: Damien Hedde <damien.hedde@greensocs.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20191211160514.58373-3-damien.hedde@greensocs.com> Message-Id: <20200316172155.971-28-alex.bennee@linaro.org>
Diffstat (limited to 'gdbstub.c')
-rw-r--r--gdbstub.c23
1 files changed, 3 insertions, 20 deletions
diff --git a/gdbstub.c b/gdbstub.c
index a60ef5125e..9ae148cd1f 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -3200,28 +3200,11 @@ static void gdb_chr_event(void *opaque, QEMUChrEvent event)
}
}
-static void gdb_monitor_output(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(p, len);
- break;
- }
- gdb_monitor_output(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;
}