From nobody Tue Oct 14 06:12:40 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=1566945290; cv=none; d=zoho.com; s=zohoarc; b=PL0wdE6+umjSEMQihgLhXb8abT/uX+7ZNWboXRCfKJ27wGVC+zh9y+ckY3MD8yOkGsZ24emt5Z74YSS5iaVc1t45MzQuroh9ew8rXWkrlV4VcWku61U/JH01LZO2b7+7SwHk41rAbq/tidXAyu2Tr/W8OSiGkzEUPjvn16+PQ0I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1566945290; 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=fLm8Tk3zp92zsK2Pw3uiaGZy1ZEPsptpkkUuISg3cpU=; b=d2wlEksr8+KnUe35ebS7Mt9D86JLPfweAyLHgQ/NGvn8zqw3jyraUvsmL/6bk+slgVaHvCRKcnd7JilbWpkyuGNi5OabY1ra/f1eKwtNod8h3qJIV68/JAXrb8nz3vK4t/ujYTtVYOcS7dSShUD+F+pAQFRDayWqUn8SYIDKKak= 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 1566945290093869.1937337252995; Tue, 27 Aug 2019 15:34:50 -0700 (PDT) Received: from localhost ([::1]:59432 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i2k35-0003TZ-19 for importer@patchew.org; Tue, 27 Aug 2019 18:34:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43930) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i2k20-0002y1-6U for qemu-devel@nongnu.org; Tue, 27 Aug 2019 18:33:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i2k1w-0000Kr-0G for qemu-devel@nongnu.org; Tue, 27 Aug 2019 18:33:37 -0400 Received: from esa2.mentor.iphmx.com ([68.232.141.98]:13164) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i2k1v-0000JK-JJ for qemu-devel@nongnu.org; Tue, 27 Aug 2019 18:33:35 -0400 Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa2.mentor.iphmx.com with ESMTP; 27 Aug 2019 14:33:32 -0800 IronPort-SDR: OAvEhB+bHLQvUpCLa00m0F6AHP1UfkdlbHMeEnTMFoB1CA4PGzv+pBslD+PXl13wfLHZLj3bBR kjbgzvb2j70Oz0s+XYUBdRyQo4iEC0AQemK/2JJxy5qdaR3O6dJdjfgQc1hRQvZakJJKAhdAHC FZxpslZDQgTnlAx6bjR4ebnmqSm2VHssFWG/Xx4M8KSQUiJGG7qnZAJVHJwHyzCs1HpAgr3Ao4 g2j/jjDHIZzXUVTolksQZNk/0/32zvWEAE/A5HSMTGgGa5I3IPq3SYR8KbpjroyGICr9wFFSSh 8/Q= X-IronPort-AV: E=Sophos;i="5.64,438,1559548800"; d="scan'208";a="40785472" IronPort-SDR: BrONIf1MvffMu65/y7Ld1qwnzVAkZ3rzPu4PRYiU/c8Zduf0dUYVVEJbo1qr3Moxja8+1j8zNv 2vo4KIxOvPc1irHfMgabcN5fBvKwt7EApxX4f64yGrlUkGie+04kRJokTfScH6uK2DDOnmDPeW VjCzICcOrxoug024Gt38ahzo2IQhmLhboL5dde8/Wpo3MWbOAa9bxnHz9+BkwP0vyX0DC9/LSs 6NwNZ6RTi8Umn3Pghmz+cxbxJ2qq6lNsQWGwLTFJkgceKQFo4AJTiZAafU0pRN5X/WKBX+oTIM xBY= From: Sandra Loosemore To: Date: Tue, 27 Aug 2019 16:33:17 -0600 Message-ID: <20190827223317.8614-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.141.98 Subject: [Qemu-devel] [PATCH V3] 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 Reviewed-by: Richard Henderson --- gdbstub.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gdbstub.c b/gdbstub.c index b92ba59..3e8bcd0 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