From patchwork Tue May 25 11:24:30 2021 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: 447174 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp4177027jac; Tue, 25 May 2021 04:27:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJytx16jnAc2EYKPt2+MaHFC5pChsfIfwxNQpYjgpdByn4Me2GgA5qXHWQb7EM9SLeXYVLV3 X-Received: by 2002:a5d:960b:: with SMTP id w11mr13011279iol.138.1621942056209; Tue, 25 May 2021 04:27:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621942056; cv=none; d=google.com; s=arc-20160816; b=GIqV0gX1OsJ+iw5F7NMNmro6c1jcL6I3zImABDXMlORp1HRYzcgr6+6rr0WG8tmlGM woLeQY0VkQf+csYJIg79KWn/GuXAAWJvFNQcrK4JjgL985+QUIT8eEDpj1ns4gVS1CaA iOd3CSvJwBM+QDocK0Y0aPi/ZbtZyeGEbzBYi3veduef0LQD6kyfP2mF1w0As0mFsT4+ X7hdIOTXN9bHAOXKXFu82R2i15gX9fHf2cFJtE9umB+aJJLUCTCJYsKpF6DV1/M0Wz0i IQUjBlU3jkFPdgiGf7Joa0ivZfXG0ZsPperifJax85Z/4jgUDlc95FQ8LgGZQO6+1cs6 pxNw== 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=4q5N6WoamWwCZ9NCTtf7vTo0CQZJFAXL5GXjETh6BsU=; b=nkW9FkmMHlcJTM8EGAQY3FwNGcAHVx1eDu9sTfdZ4CUVoXgARVBh9zO7UUdu/bKz7Y LJm5bbw1I8BEh2bbMmxwCsLJYP3CMXj0XcHCvyFQFzT1OYdTDC73XFGnHlyhA3/fQcCe RoXbV9npUj9jEXPxzuBXyfPcdYXIM5MVF5AGbF7pNnwMXUP5bB9EgBG74Jb5RnaBDY/b BYoclCFqQ82cfYguKNr5DPpDiLQIaWkqL9hIXLvz7hzHwB3TBzROHvfI35v7bzawdOrx UYG5SWZ3fBAgUhnR4PK92JYZ4q5GlVNHsjn+uUQqZujc/r5b75JY5EUi7VJ/1Whvrw5w l9dQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=nmQfk1Hs; 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 h10si21066445ili.90.2021.05.25.04.27.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 25 May 2021 04:27:36 -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=nmQfk1Hs; 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]:53236 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1llVDj-000097-Kp for patch@linaro.org; Tue, 25 May 2021 07:27:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59704) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1llVB0-0002V8-QP for qemu-devel@nongnu.org; Tue, 25 May 2021 07:24:46 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]:51936) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1llVAx-00030E-G0 for qemu-devel@nongnu.org; Tue, 25 May 2021 07:24:46 -0400 Received: by mail-wm1-x335.google.com with SMTP id u133so16523420wmg.1 for ; Tue, 25 May 2021 04:24:43 -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=4q5N6WoamWwCZ9NCTtf7vTo0CQZJFAXL5GXjETh6BsU=; b=nmQfk1HsyGK4u9cOWfOtYKcT27GxUorCyvFmQyV7CHvhdCzZNOGtyHqX0RyF3M8ymx 0WnK2j0mDFQ1k3+6ZOATkeu1TvJ8bNGE7nj2yRi2/ijpT5tRKWwALrhGGj4lopCXCSRD PryVfVZp4LAnR2ZEkAvQimZGYbctfoofUupBkN3EKd8BXpV+Kgc3B6Sp7t7VJjJFKqpi jayAhc2V5nC7c8lMQaWxLBSN6Y0ALQbIF0JxFdKLQ0IT/FHS8N6SnGGZrBV+uXc1oVq1 7wn9yhgkrJpHL6fuusBl/oVtkxHobSJz4w86ZtC/2ds0LV297RiOswW4vXs3FU84fAnN +9+A== 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=4q5N6WoamWwCZ9NCTtf7vTo0CQZJFAXL5GXjETh6BsU=; b=jfKkqQyRnTb0/Xe+fU6XSRzdOfr4bT8lV30h4bEbEhF43enK99NT3YR6i6vjvnB9b8 Pk6YZaZZvJ5DP4WRJoxk5Os7vNuHNlrpTlZ9IOfQ5k6+lchM0rPZiza9yYMCtmAjQUBY KFfp+TCa/PNtjY0321t2UCIQ0Is578DfAwQdSxIvU511mBWRIItrKp5dk+CG0fRCuNc+ UPuIW0kkVQGqxnGMCo1Fx/hVNQfe98VuLFWHDHLGTRXxgdmZwBnsxr8PfOdErIVDJUaM Q+O3VAiwwJZWyLVxYrUVcRaLKXslQakIREdgO234zUo9629+52N58eIzOnegDePdlclk 89VQ== X-Gm-Message-State: AOAM530wAYyOR9ue3x8HPPdDsIWZw7D94nP4ZhJYEndx3E2B5R/x9n3O +r4/ELoAkigOHPCgvN9MnIlbSQ== X-Received: by 2002:a05:600c:4ec9:: with SMTP id g9mr22571908wmq.173.1621941881994; Tue, 25 May 2021 04:24:41 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id i12sm15176387wrn.94.2021.05.25.04.24.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 May 2021 04:24:37 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 4F8AA1FF92; Tue, 25 May 2021 12:24:32 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL 6/7] gdbstub: tidy away reverse debugging check into function Date: Tue, 25 May 2021 12:24:30 +0100 Message-Id: <20210525112431.22005-7-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210525112431.22005-1-alex.bennee@linaro.org> References: <20210525112431.22005-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x335.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: Richard Henderson , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" In theory we don't need an actual record/replay to enact reverse debugging on a purely deterministic system (i.e one with no external inputs running under icount). Tidy away the logic into a little function. Signed-off-by: Alex Bennée Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20210520174303.12310-8-alex.bennee@linaro.org> -- 2.20.1 diff --git a/gdbstub.c b/gdbstub.c index 84ce770a04..52bde5bdc9 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -465,6 +465,15 @@ int use_gdb_syscalls(void) return gdb_syscall_mode == GDB_SYS_ENABLED; } +static bool stub_can_reverse(void) +{ +#ifdef CONFIG_USER_ONLY + return false; +#else + return replay_mode == REPLAY_MODE_PLAY; +#endif +} + /* Resume execution. */ static inline void gdb_continue(void) { @@ -1880,7 +1889,7 @@ static void handle_step(GArray *params, void *user_ctx) static void handle_backward(GArray *params, void *user_ctx) { - if (replay_mode != REPLAY_MODE_PLAY) { + if (!stub_can_reverse()) { put_packet("E22"); } if (params->len == 1) { @@ -2153,7 +2162,7 @@ static void handle_query_supported(GArray *params, void *user_ctx) g_string_append(gdbserver_state.str_buf, ";qXfer:features:read+"); } - if (replay_mode == REPLAY_MODE_PLAY) { + if (stub_can_reverse()) { g_string_append(gdbserver_state.str_buf, ";ReverseStep+;ReverseContinue+"); }