From patchwork Wed Dec 11 16:05:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Damien Hedde X-Patchwork-Id: 1207746 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=greensocs.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; secure) header.d=greensocs.com header.i=@greensocs.com header.b="tO6TuIoq"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47Y2002ThNzB3xn for ; Thu, 12 Dec 2019 03:08:00 +1100 (AEDT) Received: from localhost ([::1]:45112 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1if4Ws-0004Xe-3N for incoming@patchwork.ozlabs.org; Wed, 11 Dec 2019 11:07:58 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:42491) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1if4UQ-0002wV-He for qemu-devel@nongnu.org; Wed, 11 Dec 2019 11:05:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1if4UP-0003wX-8u for qemu-devel@nongnu.org; Wed, 11 Dec 2019 11:05:26 -0500 Received: from beetle.greensocs.com ([5.135.226.135]:49364) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1if4UO-0003uk-Nq for qemu-devel@nongnu.org; Wed, 11 Dec 2019 11:05:25 -0500 Received: from crumble.bar.greensocs.com (crumble.bar.greensocs.com [172.16.11.102]) by beetle.greensocs.com (Postfix) with ESMTPS id 8239096F50; Wed, 11 Dec 2019 16:05:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=greensocs.com; s=mail; t=1576080323; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7sPz7oVBNzeMeWcyKT2i75rgmDRiD8IxeGkrlkSUefk=; b=tO6TuIoqsuJcG0Qc4C8CRMlBenX1SW8Auq7TFTlGz2DfpQSVKkq6oPpEkaWssh5nlUfbf2 PgTUCAb/FHa7O8+s5meRXLEFVoV0E2RZnSNHB8TixrW5MPb0V/GaQyerOmEqN30RC2p8rz MgMXetSJWilzMxoxUXXkgh1BKIKgavU= From: Damien Hedde To: qemu-devel@nongnu.org Subject: [PATCH v2 2/2] gdbstub: do not split gdb_monitor_write payload Date: Wed, 11 Dec 2019 17:05:14 +0100 Message-Id: <20191211160514.58373-3-damien.hedde@greensocs.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191211160514.58373-1-damien.hedde@greensocs.com> References: <20191211160514.58373-1-damien.hedde@greensocs.com> MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=greensocs.com; s=mail; t=1576080323; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7sPz7oVBNzeMeWcyKT2i75rgmDRiD8IxeGkrlkSUefk=; b=nmZ3hG3qqt7z5vFCxYkXsa/goAF3gscl1bdHWnrvElG1mKrOaxiXe9dcPCp5RTIl0x254V RhP9u/QXtag5fiVYRZTLYfO1sLZM4E5udmUr5x0CCw1uMfJmUZB17AjWwLRos8HXp/pXMk yYI5H+HCMfcwA7cy1AeZY9AtCj6JJ88= ARC-Seal: i=1; s=mail; d=greensocs.com; t=1576080323; a=rsa-sha256; cv=none; b=oUiOrjgLa0JI0Gol9epSdIW9Fb/jdE3T/Ruy6vGj5Get1tPvdkDBCCyb83RIAEx9LhLFdp VCZQkOp/IlKy3HgCmZ3cF4hbl2v3JcOiRnHsXtXaf3UdrIWJvp57tFJJ7lgW0iGVt4VMRr tLdXmcrIWk+Ur+MuIjfVXPoSgBwnI2Y= ARC-Authentication-Results: i=1; beetle.greensocs.com; none X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 5.135.226.135 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Damien Hedde , philmd@redhat.com, alex.bennee@linaro.org, luc.michel@greensocs.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 Signed-off-by: Damien Hedde Reviewed-by: Alex Bennée --- 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; }