From patchwork Thu May 20 17:43:02 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: 443305 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp199765jac; Thu, 20 May 2021 10:47:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxFeoeqXDoy8+dtZ6ca3rhLr1QGO3o9lzuc2b3KRtQytAvQ7QDdqRzL0lJ0GAs2+bLMLI79 X-Received: by 2002:a02:7f57:: with SMTP id r84mr8195769jac.108.1621532874624; Thu, 20 May 2021 10:47:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621532874; cv=none; d=google.com; s=arc-20160816; b=vbDoghPnN4ljns1jctvpo0IpDcEI82KPAZhADE4CL3SlI6k1QwFVhAXvxhvKSUM5/L 6YKroho45e2Ir4rXCK5ASd1aqAUYq5EDqHaHGKzzlRpqRbUV9EsPqfYO0d35V8Z+CODe 7P2I1k5XG+3oDEU+4zgeFyNNiNw3p9JwgJQ1lYm99WFYK93oCFCKMY1M++AI8Dk6XZ0z BP/EFhZMUmLhqnC8ozC4JQ/zu15F5PYXJJg/ClLPuXf6D1B/S9/VwwkCzvXLJUXE9fxO AF39KsodKUiNTDZ0ttjGWnW7QrE7Wc5oyct3kQv9iDZOaQ1g+ZiJ3Hj4ZNKZ5d0v9O5j pHOQ== 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=xKAsfqZlgQlw53LEWwrI3OJPttiUgB7fACa4Oi4oEMo=; b=WN0Mq0GxHvkzpd2Pq65WacOMCqDZSyNlpKSMhSIQ6jHVv4ehV7qZxvwx6xo7TNLrsP zWA4eCMvbatHtuDCiPh2nHWTTJVR69Gn48uFDfq04t45y64sxt1TMVMWZeCzEIqftk0g BOUtYqMbOXp4Pz/EyQ/2iuSu6v8xANgbQSc0N8qqeVeMVFy+zqRFol0/EOMfpqs+uo3X 44idnS82RboRswCXLAROuW+LR1Ns6HKkI4OIoSAlHUVfxxvozgYasPB4LIVxgBVrgCgk Gepa7JU4mPICt8q+yaisUBzve7ZqP8ZOmwyMTg6fM+13XmLjvGuGMaA63KW2/XAegVbo jkbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=bqHD+lij; 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 z13si3350129ilu.28.2021.05.20.10.47.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 20 May 2021 10:47:54 -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=bqHD+lij; 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]:51604 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ljmm2-0000sW-2g for patch@linaro.org; Thu, 20 May 2021 13:47:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53162) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljmhc-0003cm-3d for qemu-devel@nongnu.org; Thu, 20 May 2021 13:43:20 -0400 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]:45019) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ljmhY-0001AH-5F for qemu-devel@nongnu.org; Thu, 20 May 2021 13:43:19 -0400 Received: by mail-wm1-x32f.google.com with SMTP id y184-20020a1ce1c10000b02901769b409001so5741058wmg.3 for ; Thu, 20 May 2021 10:43:15 -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=xKAsfqZlgQlw53LEWwrI3OJPttiUgB7fACa4Oi4oEMo=; b=bqHD+lij5L2oDyyUpb6mch2z5/zFUVEMoGbvGk5czA5kkmS/e6k6lTgKY8wzdNR2oP 8Rxmf432QDipJy551BXPnaT4dDlDZbDPxhD/4FrQez0U7ogpDhvuZEwo80nlWIdl0whd JlfNfJGD8JWIjEhIqw6KeTNxMCnukTEg2ngZGska+Xf8zDwO75d8IKFsy4ngu1Nh3UZB JL/4USirrCjQyQbIVikhsZK3QK3QWJbmEzEYOcGqhlZVSkZCsVS43Gp3RWCDsY8EhqEe dW97XCOHi0pMEWuYdIi3DuseBrX095djRbdomabem2BcT9akK5FUHG9yC4fwvejPe1Tu rAhQ== 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=xKAsfqZlgQlw53LEWwrI3OJPttiUgB7fACa4Oi4oEMo=; b=fNG+hCD3Vwky9VHJaSEi1qlO5BGyihzG3iG3w9kT4sbAuoFwp3UXTHBx/8apgKuhVB t1AvVxR4MvAgYOaMYHVT0EuEv5bfSAQYHaA/nDObJ+GOS/+YItDAiQmnk3CVLMoqDYOK yau/qvbhcC31Q9XGY3tWiYQ3qHeF/Ik5xYzALmRGCY8dZZcjUiz85nCj0pg72jJ9aQ2r IzYI6FVo7h6f9zWaYSWAM1ibACPI+V745lKkp7I0FmFvIZ62reUX3rj1hFiCuy6uwF13 GejYS+FK2i1Z8ydyyalqJ7C68DTcQCGhnefkqBrw6UkcEw6FillfyvYwHJA0tdy701H6 XBWg== X-Gm-Message-State: AOAM532CVK+O014uFacTtxP3sGkv3TN+q4CiBQ5859358pLJhSS2gcR9 XtX79XxE6Tz9hPWgj9XE8z+pPw== X-Received: by 2002:a7b:cb85:: with SMTP id m5mr5262138wmi.118.1621532594868; Thu, 20 May 2021 10:43:14 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id w20sm3540607wmc.44.2021.05.20.10.43.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 May 2021 10:43:07 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 8D5B11FF93; Thu, 20 May 2021 18:43:04 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 7/8] gdbstub: tidy away reverse debugging check into function Date: Thu, 20 May 2021 18:43:02 +0100 Message-Id: <20210520174303.12310-8-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210520174303.12310-1-alex.bennee@linaro.org> References: <20210520174303.12310-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32f.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: fam@euphon.net, berrange@redhat.com, =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?b?w6k=?= , f4bug@amsat.org, stefanha@redhat.com, crosa@redhat.com, pbonzini@redhat.com, =?utf-8?q?Alex_Benn=C3=A9e?= , aurelien@aurel32.net 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 --- gdbstub.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) -- 2.20.1 Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé 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+"); }