From nobody Tue Oct 14 03:46:36 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1566940759; cv=none; d=zoho.com; s=zohoarc; b=FvSOf6y4jz2wXU3RplBowyF4dKO4Fn6ZhqEKQu+9JHoF5HetiIL2jvIyLW9jtHVcmuYR5n5BfHru1Lqd+zDDQzLvaUP/MVtLoCGXvrt2HdRRN81M/BK14zBIhpa8QZ9q3bZCssxeoqgKURFTW8TWrxcNd/FUyBwFikXr1FNAbhM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1566940759; h=Content-Type:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=LqX9R8+OKpXDpmQC8zloAgbHsn+AwcgN6PYcpYpSUqc=; b=bWNXd4XxfhE4eiQoCUzFpMFfPjF1mUqoKDcrUQ45y2OUfNqBxQTjpuz6floUIstfdFNqUAhO29brR6FR/S3J4s1nVHzVzAt8P/CkLNdtU6tm3DKe6HlV0xD7EL0oGSe+qHBYQ/RkqoRwsBwCVl8fMKmj1IYW+O4uxOnG3fce6r0= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1566940759720247.07387597934633; Tue, 27 Aug 2019 14:19:19 -0700 (PDT) Received: from localhost ([::1]:58686 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i2is2-0000ny-O4 for importer@patchew.org; Tue, 27 Aug 2019 17:19:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60334) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i2iqy-0000L0-O2 for qemu-devel@nongnu.org; Tue, 27 Aug 2019 17:18:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i2iqw-0002WI-Uj for qemu-devel@nongnu.org; Tue, 27 Aug 2019 17:18:12 -0400 Received: from esa3.mentor.iphmx.com ([68.232.137.180]:51188) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i2iqw-0002Us-Mr for qemu-devel@nongnu.org; Tue, 27 Aug 2019 17:18:10 -0400 Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa3.mentor.iphmx.com with ESMTP; 27 Aug 2019 13:18:06 -0800 IronPort-SDR: /KAR/97gBM+V7pIQXFWwkQshOCCrP+4v3Xi01OqMmlbU/BVM0alww1zZj7whcKD8ioMsz/FUPb 260h0P0vKAZ9psXfcK4bG0/Cn1K/C//3mnuCzP8c5bCS/qwvmFST1gX3ZqCSek3VG0mXJQyXMh hjDI9w4+edI/RJy5gjg1bzPv8x/o3mg8KZndvQS7c7Ed6nxR16Fdn3d9E6jO6cpZEJM0k7PJO6 4hNLu8aQDQMvdLpADktdUL/h2bRaCzfsRBcyDIE6v6FtZPJoQ+hL90skC8ZS0RVzOVeuV2SGVB 7xI= X-IronPort-AV: E=Sophos;i="5.64,438,1559548800"; d="scan'208";a="40813225" IronPort-SDR: ylsD/4ysrzCtpOIdlT2vR7y2/0UI3oBa7/2cih323vxlxJG6ozkW5xsZoV6GK8qOt0YawOqtcw iN1oDIYY5jj4Npuiwfnxk8+mrZI+0OQ+KeDV7BdZ8xmAEBD0omZRoeel35mXao7Zq+G/EbXB1q sz6eY1FppBh7fwK9HHHqYnW0VCTpAaa+/oThUaBCqsk4TQbnvpzlcUENiSt30A4CpxpH1I+O1w +jyvTEHNXIK36RpcuSwbGIQJvPn5JDTSQ+xKV/8fjjShex2tTDynYtDrTtJNJqOHoO6WhCE2pK C2E= From: Sandra Loosemore To: Date: Tue, 27 Aug 2019 15:17:53 -0600 Message-ID: <20190827211753.7936-1-sandra@codesourcery.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-ClientProxiedBy: svr-orw-mbx-03.mgc.mentorg.com (147.34.90.203) To svr-orw-mbx-03.mgc.mentorg.com (147.34.90.203) X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x X-Received-From: 68.232.137.180 Subject: [Qemu-devel] [PATCH V2] gdbstub: Fix handler for 'F' packet 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: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Jon Doron Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Handling of the 'F' packet has been broken since commit 4b20fab101b9e2d0fb47454209637a17fc7a13d5, which converted it to use the new packet parsing infrastructure. Per the GDB RSP specification https://sourceware.org/gdb/current/onlinedocs/gdb/The-F-Reply-Packet.html the second parameter may be omitted, but the rewritten implementation was failing to recognize this case. The result was that QEMU was repeatedly resending the fileio request and ignoring GDB's replies of successful completion. This patch restores the behavior of the previous code in allowing the errno parameter to be omitted and passing 0 to the callback in that case. Signed-off-by: Sandra Loosemore --- gdbstub.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gdbstub.c b/gdbstub.c index b92ba59..141568a 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -1820,11 +1820,15 @@ static void handle_read_all_regs(GdbCmdContext *gdb= _ctx, void *user_ctx) =20 static void handle_file_io(GdbCmdContext *gdb_ctx, void *user_ctx) { - if (gdb_ctx->num_params >=3D 2 && gdb_ctx->s->current_syscall_cb) { + if (gdb_ctx->num_params >=3D 1 && gdb_ctx->s->current_syscall_cb) { target_ulong ret, err; =20 ret =3D (target_ulong)gdb_ctx->params[0].val_ull; - err =3D (target_ulong)gdb_ctx->params[1].val_ull; + if (gdb_ctx->num_params >=3D 2 ) { + err =3D (target_ulong)gdb_ctx->params[1].val_ull; + } else { + err =3D 0; + } gdb_ctx->s->current_syscall_cb(gdb_ctx->s->c_cpu, ret, err); gdb_ctx->s->current_syscall_cb =3D NULL; } --=20 2.8.1