From patchwork Fri Dec 20 12:04:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 1214067 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=fail (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="uKxqL+Hz"; 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 47fSds2wg4z9sQp for ; Fri, 20 Dec 2019 23:26:09 +1100 (AEDT) Received: from localhost ([::1]:54450 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiHM6-0007eq-V3 for incoming@patchwork.ozlabs.org; Fri, 20 Dec 2019 07:26:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:36784) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiHAv-0000ku-A2 for qemu-devel@nongnu.org; Fri, 20 Dec 2019 07:14:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iiHAu-0001U2-2w for qemu-devel@nongnu.org; Fri, 20 Dec 2019 07:14:33 -0500 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:39508) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iiHAt-0001Q3-Od for qemu-devel@nongnu.org; Fri, 20 Dec 2019 07:14:31 -0500 Received: by mail-wr1-x443.google.com with SMTP id y11so9213129wrt.6 for ; Fri, 20 Dec 2019 04:14:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ZYdZReL1NF4ccjo0j5hGGmu8VTV/596/vKb83rC+xjU=; b=uKxqL+Hzw4iaAyf2GQL3ih302+LPHD0BDKm0lOAWQE8yHtx4s7INbPSymA8JDx6sRY ET2+uPQ6b5llAglhMnBxJaLv7hWLR2jU4SpfIDU14BPPiP5jYv4UQIxPCR8hd2Cq0wLG cpPufAmiWJQdGs3zH2oF1wf6WRA7vxrqaVxWBYuw5nkSOt9D5Z4GGU+usgVNd2J1mJsu KnGg5matGM04D9YEJgjz7Hyovm1U+y/F8HEW+GVFK/7RMCEheIEx9zTMfhN8eyV5pQC2 yamKp9+uPDrrpklg1VMtp1QFxTYlZJwOMWzKqlX5NgUH1SoX/Pix4cixn/IzZ+bmy/y0 7c1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ZYdZReL1NF4ccjo0j5hGGmu8VTV/596/vKb83rC+xjU=; b=pk6HkyTAdFnd+f5ddhMv+XFdqzGkQYXG/BUWfXHg99n+NW4qYll78CYDqnC3Rq3+Cf w0EsWMQp6btcGMaTJeQ3L7N/0XmHi/r9Lp2bfJF9hqtU6i235ssnuLaecS5u0VLGV5GO YxuvspyTmN2V4pVhoR776o9/nAXjS2q0hpIc0+M9YpaFBdFhGUO2KvloZGB1nS6ce4mB +U52WhENvLLG8AOOwVesaJ8n8aT011I2Zm3iPyZDE+SyI+oh/LsZwYJadc3D/BXl5Rcw 7lrmjHsfAAUwHMyxxsX5+O9Xwhm3mQrxwy3fHYXre66MWwXfpWTNDyTp7jUbO7JFQN/s +Npw== X-Gm-Message-State: APjAAAVb73Ze5jpYnxfw0QA6ywIjVAkQrBx0ljhEdyzYxsQMUxpgyIKk xaukQ6pyY06KUMX0LDviwgs40w== X-Google-Smtp-Source: APXvYqyv3bGy7i/LMFHBtU8VHkAV+bq4MRobYOWWRDHBRb17vm0dQtpObxpm5TwrCv/+7rCGh7PsmQ== X-Received: by 2002:adf:f2c1:: with SMTP id d1mr14599626wrp.111.1576844070397; Fri, 20 Dec 2019 04:14:30 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id q3sm9131236wmc.47.2019.12.20.04.14.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Dec 2019 04:14:25 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 155C61FFAB; Fri, 20 Dec 2019 12:04:41 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v4 21/21] gdbstub: do not split gdb_monitor_write payload Date: Fri, 20 Dec 2019 12:04:38 +0000 Message-Id: <20191220120438.16114-22-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191220120438.16114-1-alex.bennee@linaro.org> References: <20191220120438.16114-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::443 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@greensocs.com, luis.machado@linaro.org, =?utf-8?q?Philipp?= =?utf-8?q?e_Mathieu-Daud=C3=A9?= , alan.hayward@arm.com, =?utf-8?q?Alex_Benn=C3=A9e?= , Luc Michel Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Damien Hedde 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 Signed-off-by: Alex Bennée Message-Id: <20191211160514.58373-3-damien.hedde@greensocs.com> --- gdbstub.c | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/gdbstub.c b/gdbstub.c index 49e760283db..5d0cdb81e4f 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(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; }