From patchwork Mon Sep 2 10:21:12 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: 172727 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp4130370ily; Mon, 2 Sep 2019 03:22:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqytQEqUMgHijQh9XGrHCW2xRXhygGBDXUQ8PVxtvaeRBh9X71axsERl7IA+JZu/zmXtBv3t X-Received: by 2002:a17:906:30d8:: with SMTP id b24mr22536999ejb.33.1567419770391; Mon, 02 Sep 2019 03:22:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567419770; cv=none; d=google.com; s=arc-20160816; b=DX8AD/C8HwvUvWi7UQudu2dB9XKWt7LH5DZTp4N9gWMOtbmooadJLn6V3A8V8BGV8l nWwn7ApnmB1Au7byK9kQQorPCObenxsKufxvZvEFT3UWaHzt6FX3lFSzPOaSjoFsMQvr 1InFIx47W3tE8t7Lq5wzSJATPAHFdqCaACkD3R5J+Lms9G8NiS8R4uEl2IaXBlLej0Oj ClegBOg/UK4jKaFMB9JJwY9WZFqveoIUxndviQ0zGT34B0y5NlEWxVx5ogansZniorg3 vr4Q+Z3hC1rc57bU529kpBiKBbHEVF6k3OAUFJeT7kwkv0RMX1CrJYyt6JstH3uLyrKS UmWg== 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:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=MTI8Bx3uRmLWHyobHqk9B5nXds/7H3re7AzqawWMgtk=; b=e0rVYS6IAjLserEH+LSR4U0K3Ym0G1t/qGk72rqjtWDWHR92oLKVibN8TeJ0jThR/y S28TELk008qe/WqUwf53PRNITAreZabZsbAOHwqRzhPOzOsj5ycPZZ1jC1Oyktzg8D/K UguOLnwJR82nVZuKJ8pjpiEWScwl+CJwhrVSU3jfsSYbOjNtRfyE7j1hCL2Inv4lh1uX KZj+2YpGtSgZLctqMfWVm0VeDdDorZA9V/Tm6ohn1cislNJbul8ArUGTThC/yPQ9UFl+ aRrYfv7cRUuTiDzcb/L79rCloXqCXlMi4nm8uecos0vCzuZ1F61nQY8VYCm7Q9NjmFoI FCtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Fz2DcAiF; 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 t57si8117889edd.26.2019.09.02.03.22.50 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 02 Sep 2019 03:22:50 -0700 (PDT) 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=Fz2DcAiF; 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]:34680 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i4jU1-0004fw-6P for patch@linaro.org; Mon, 02 Sep 2019 06:22:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54806) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i4jSi-0004dU-8X for qemu-devel@nongnu.org; Mon, 02 Sep 2019 06:21:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i4jSh-0004Fr-51 for qemu-devel@nongnu.org; Mon, 02 Sep 2019 06:21:28 -0400 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]:34950) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i4jSf-0004F3-UY for qemu-devel@nongnu.org; Mon, 02 Sep 2019 06:21:27 -0400 Received: by mail-wm1-x336.google.com with SMTP id n10so3316146wmj.0 for ; Mon, 02 Sep 2019 03:21:25 -0700 (PDT) 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=MTI8Bx3uRmLWHyobHqk9B5nXds/7H3re7AzqawWMgtk=; b=Fz2DcAiFgvIltoAjBL2x+X8ivimKCUKHAneMcLXoHGkE6MmY+VUgOV33swNVS+2yZP +/0+FA0J2hjMFRds46BYo8sk9C396bUsm0xV55utesyH+DOXLoq+rgX5lgGYBd7ehYsP o+NNiN1gR5JkeDGqfplAPlw6nrp5j/NIIthMS9Yd5FvhzH4+lx/w4arx680SatPK0JWe UddQjlCsww7KqBOV9rYNxrrfXKE7Jo5ayYBvP3V/hPW8y3FopR9wDK5jg5cg0oviHmlE eDRfcNuLEkR6NLIzOPc5opFBIsXkSTcZZrOyeP0f9PhMUzrTzql9VadPN+t3pLqgeTUe PJQg== 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=MTI8Bx3uRmLWHyobHqk9B5nXds/7H3re7AzqawWMgtk=; b=phbhnsLhRtoCz8T1C3BKXElZFrYD6Yjya4RhlleJAyAfRrvhEk8tDxxbOTgCxzOz53 7AzM6wfNRXRrhPejrzai+6u6Z1deS4yJ1DTSjFTOVrzpZbQEeCjfJk3UUkpeBJ5/+qFk XWzDdRVXChkCIDTqUqSTVakwrw7XvVNxss0TaNMHerm7R6Rs3HwVjJViXldYrVAPBDoi LTucapMhBF/5pFqBpThcLM6llUKB0vz5gHPNwAYOlA6kmJrWjXm4d3HXvUo0wthPMnlJ VEb3yivUHpCy8mOsX7xoSV+6lb1tAqgVBHYkLyacsNyb3xCyegQ0sqQkJ2MRdYHLFJDg tlBQ== X-Gm-Message-State: APjAAAWF9j8i107fpaR+waI/GvSlh1u615RFd84BYKgytiH/aTu7ICGd /y8en+gmvg6yv6cK8W7TViMKSw== X-Received: by 2002:a1c:c706:: with SMTP id x6mr35668865wmf.104.1567419684782; Mon, 02 Sep 2019 03:21:24 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id f143sm2050011wme.40.2019.09.02.03.21.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Sep 2019 03:21:22 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 6532D1FF8F; Mon, 2 Sep 2019 11:21:22 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Mon, 2 Sep 2019 11:21:12 +0100 Message-Id: <20190902102122.1128-3-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190902102122.1128-1-alex.bennee@linaro.org> References: <20190902102122.1128-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::336 Subject: [Qemu-devel] [PULL 02/12] 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?Alex_Benn=C3=A9e?= , Sandra Loosemore , Richard Henderson , qemu-devel@nongnu.org, =?utf-8?q?Phil?= =?utf-8?q?ippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Sandra Loosemore 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 Message-Id: <20190827223317.8614-1-sandra@codesourcery.com> Signed-off-by: Alex Bennée -- 2.20.1 diff --git a/gdbstub.c b/gdbstub.c index 5c067594bae..4cf8af365e2 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -1820,11 +1820,15 @@ static void handle_read_all_regs(GdbCmdContext *gdb_ctx, void *user_ctx) static void handle_file_io(GdbCmdContext *gdb_ctx, void *user_ctx) { - if (gdb_ctx->num_params >= 2 && gdb_ctx->s->current_syscall_cb) { + if (gdb_ctx->num_params >= 1 && gdb_ctx->s->current_syscall_cb) { target_ulong ret, err; ret = (target_ulong)gdb_ctx->params[0].val_ull; - err = (target_ulong)gdb_ctx->params[1].val_ull; + if (gdb_ctx->num_params >= 2) { + err = (target_ulong)gdb_ctx->params[1].val_ull; + } else { + err = 0; + } gdb_ctx->s->current_syscall_cb(gdb_ctx->s->c_cpu, ret, err); gdb_ctx->s->current_syscall_cb = NULL; }