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: 182261 Delivered-To: patch@linaro.org Received: by 2002:a92:1f98:0:0:0:0:0 with SMTP id f24csp459926ilf; Fri, 20 Dec 2019 04:27:00 -0800 (PST) X-Google-Smtp-Source: APXvYqyAajR94Ia3fF8CSKyKFVquehTcrk2KXB6UfLnplPkFlgn0ZjmDHfoIdFMJTuV8MvUIvyme X-Received: by 2002:a37:a68f:: with SMTP id p137mr13148108qke.328.1576844820774; Fri, 20 Dec 2019 04:27:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576844820; cv=none; d=google.com; s=arc-20160816; b=lI9v6YDEH9mxoiuIPO4rYszA6EFxwHPSWT3OCMHv1prhP1Z5Ibdv4PNuKKildF49qn eLSzJBLse1ynZ0WQ6N+BrlkPffchTeEtgA9B4v+Ui/nufbbWrav02FkIp4R6vJOnqz6b uCtmRrO2GdvZfkRy7v+JzQVR44T9rTdE7qgWboqP3t0FLdQrKY4s0umAaNyG1wKbwDGS XsClB5DLaN4JN50gz3fMKvpRw3fTTKhIjwLouEibgXKQ/NXpT7ThO07l8CVG0WY7h/Cl EmJTuuh4yCpkPG8azWOfcm7lSQJBnsmszv6/0IGoOhfMJOeFIhJHY31OQ8C4ufeSYPB3 ZBeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=ZYdZReL1NF4ccjo0j5hGGmu8VTV/596/vKb83rC+xjU=; b=p4EoOoFm66IFdxb9WhPODofp7NTeDL7arqJ1alLqhLf5huc05wGvK/K/JdkEEjaXhG afzfSs5UKG+5RRxAUji1P3ty0YhtnezrhiwaZKWLxIbGDjQoJLeB360Ps+kX0z+q9GPm BNHHDTmGUJtmC86sTHg6Qs+WwpYCN1jqVQDy0ufDRh4bZ4R8xZTeN080I61lppniU94j yYWCemqOV5+O+Vb5pKej2FfskpivPz5okpJDkDm+hVtyvwmwjMaAXNnc04m/Mlz9mVLL nvyhqGwkdthFL10MUXo8dIZ310x4Pw2eWSUO6VPL0jVmlWMUdkA0+rnP7IQArYaua/Ne SM8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=uKxqL+Hz; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id u22si5293891qkm.81.2019.12.20.04.27.00 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Dec 2019 04:27:00 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=uKxqL+Hz; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:54476 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiHMy-0000yP-AF for patch@linaro.org; Fri, 20 Dec 2019 07:27:00 -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-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+patch=linaro.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(-) -- 2.20.1 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; }