From patchwork Tue Feb 21 22:52:19 2023 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: 1746008 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=HeftGAQq; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PLvws3S0bz23yr for ; Wed, 22 Feb 2023 10:03:57 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pUbec-0006tQ-Lk; Tue, 21 Feb 2023 18:02:34 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pUbeH-0006TD-Rq for qemu-devel@nongnu.org; Tue, 21 Feb 2023 18:02:14 -0500 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pUbe7-0006GG-2R for qemu-devel@nongnu.org; Tue, 21 Feb 2023 18:02:13 -0500 Received: by mail-wm1-x32e.google.com with SMTP id l7-20020a05600c4f0700b003e79fa98ce1so2220963wmq.2 for ; Tue, 21 Feb 2023 15:02:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=xDMNOIz79tcmby+L8OATHD+W52NLofe0+su2iOTYJEQ=; b=HeftGAQqSghpOttwPvyrMfQYbdGYzTnMCZ1uK/uCkUwCmOgDp5RnlIxUJGdTIc+ury WDzmEmb7RCyHzTQR1aH09qepYDzyPUPsn9aYSvQAD9nU0zp9N5iurjEzSCPmAxBG9Wna xiTERmCOwdvjU8OejZXMdKD3OZegrH1Hm2k0cFS8JMT5CYiYyHp6ietXdr96SlY9tceg DdYkHHdQChFvOSe0esS5dFlqGGIIvXISq3msUde97qLlhcfObLMWQ0M6D1moz+K6oEc1 fapKgti8OMJrYrUMPcXDlI0bdslfBpIKBIIuLJPg7tUaIklxkntIyhk++Hx5MZKgD+2S hZvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xDMNOIz79tcmby+L8OATHD+W52NLofe0+su2iOTYJEQ=; b=nMoxa3A7uNzAyQ6KaLclb6W9FgXNfAfPlRPQAOHmc/YN1B980ZvppRJol4cq9IpYV2 5NL1PA+fdtgODpmyLyLhRsGqb8buWGFD5k1Q1GRb9zcNLXPsyfalwQPAnVVZ6rWQiPQs afZKNlYBFMiLNa1+CmGKTkmBRRhsFAyMpLvZu/kEy+6o9J2Q0/G+FbZUar4EzLAejzzM G9g4l5C2zfaxGy0zGbm+1z2kBRa1ZVi1/+HLZAh2rbpRfd4vfekZRZ+uaaxtlk0XXi+A lJy2s1NUbNzgtWp/qtqY8b3wrmXb1+UMmNNHVrSeMT2J9pM3p7qZyswrVsZRonQQ8LPG aq4Q== X-Gm-Message-State: AO0yUKWt/v9h/BsECDGB1f4G5fZUpAAlL6X7RvWxuWYQzwqEmhdagDDQ Ti+ZWP8cM1vq+MTmTuFJeXpfrQ== X-Google-Smtp-Source: AK7set9m00fBCBhDw5omQ+3dwDpKYoDqBBONDVMEX5XwolsBH+tTG+sMRSt/5m9zgoFwO4cKQYgomg== X-Received: by 2002:a05:600c:164a:b0:3e2:20c7:6556 with SMTP id o10-20020a05600c164a00b003e220c76556mr212862wmn.35.1677020519427; Tue, 21 Feb 2023 15:01:59 -0800 (PST) Received: from zen.linaroharston ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id c22-20020a7bc856000000b003e01493b136sm5857812wml.43.2023.02.21.15.01.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Feb 2023 15:01:58 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 862381FFC5; Tue, 21 Feb 2023 22:52:29 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Thomas Huth , qemu-arm@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, Yoshinori Sato , nicolas.eder@lauterbach.com, Stafford Horne , Daniel Henrique Barboza , Mahmoud Mandour , Taylor Simpson , mads@ynddal.dk, Marek Vasut , Artyom Tarasenko , Alistair Francis , qemu-ppc@nongnu.org, Yanan Wang , Sunil Muthuswamy , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Eduardo Habkost , Bin Meng , Bastian Koppelmann , Palmer Dabbelt , Marcel Apfelbaum , Laurent Vivier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Michael Rolnik , Aleksandar Rikalo , Paolo Bonzini , =?utf-8?q?Alex_Benn=C3=A9e?= , Aurelien Jarno , Xiaojuan Yang , Richard Henderson , Peter Maydell , Alexandre Iooss , Chris Wulff , Jiaxun Yang , David Gibson , "Edgar E. Iglesias" , Greg Kurz , David Hildenbrand , Song Gao , Ilya Leoshkevich , Max Filippov , Mark Cave-Ayland Subject: [PATCH v3 16/24] gdbstub: specialise stub_can_reverse Date: Tue, 21 Feb 2023 22:52:19 +0000 Message-Id: <20230221225227.3735319-17-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230221225227.3735319-1-alex.bennee@linaro.org> References: <20230221225227.3735319-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32e.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=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Currently we only support replay for softmmu mode so it is a constant false for user-mode. Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Signed-off-by: Alex Bennée --- v3 - rename gdb_stub_can_revers -> gdb_can_reverse --- gdbstub/internals.h | 1 + gdbstub/gdbstub.c | 13 ++----------- gdbstub/softmmu.c | 5 +++++ gdbstub/user.c | 5 +++++ 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/gdbstub/internals.h b/gdbstub/internals.h index 90069a9415..5f2e24c4f3 100644 --- a/gdbstub/internals.h +++ b/gdbstub/internals.h @@ -128,6 +128,7 @@ CPUState *gdb_first_attached_cpu(void); void gdb_append_thread_id(CPUState *cpu, GString *buf); int gdb_get_cpu_index(CPUState *cpu); unsigned int gdb_get_max_cpus(void); /* both */ +bool gdb_can_reverse(void); /* softmmu, stub for user */ void gdb_create_default_process(GDBState *s); diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c index f9950200b8..e107aa065c 100644 --- a/gdbstub/gdbstub.c +++ b/gdbstub/gdbstub.c @@ -113,15 +113,6 @@ 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 -} - /* writes 2*len+1 bytes in buf */ void gdb_memtohex(GString *buf, const uint8_t *mem, int len) { @@ -1307,7 +1298,7 @@ static void handle_step(GArray *params, void *user_ctx) static void handle_backward(GArray *params, void *user_ctx) { - if (!stub_can_reverse()) { + if (!gdb_can_reverse()) { gdb_put_packet("E22"); } if (params->len == 1) { @@ -1558,7 +1549,7 @@ static void handle_query_supported(GArray *params, void *user_ctx) g_string_append(gdbserver_state.str_buf, ";qXfer:features:read+"); } - if (stub_can_reverse()) { + if (gdb_can_reverse()) { g_string_append(gdbserver_state.str_buf, ";ReverseStep+;ReverseContinue+"); } diff --git a/gdbstub/softmmu.c b/gdbstub/softmmu.c index 65aa2018a7..5363ff066d 100644 --- a/gdbstub/softmmu.c +++ b/gdbstub/softmmu.c @@ -443,6 +443,11 @@ unsigned int gdb_get_max_cpus(void) return ms->smp.max_cpus; } +bool gdb_can_reverse(void) +{ + return replay_mode == REPLAY_MODE_PLAY; +} + /* * Softmmu specific command helpers */ diff --git a/gdbstub/user.c b/gdbstub/user.c index 15ff3ab08d..a716ad05b2 100644 --- a/gdbstub/user.c +++ b/gdbstub/user.c @@ -404,6 +404,11 @@ unsigned int gdb_get_max_cpus(void) return max_cpus; } +/* replay not supported for user-mode */ +bool gdb_can_reverse(void) +{ + return false; +} /* * Break/Watch point helpers