From patchwork Thu Mar 2 19:08:37 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: 13157788 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4ACBBC678D4 for ; Thu, 2 Mar 2023 19:14:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229901AbjCBTOd (ORCPT ); Thu, 2 Mar 2023 14:14:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229861AbjCBTOZ (ORCPT ); Thu, 2 Mar 2023 14:14:25 -0500 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E518518156 for ; Thu, 2 Mar 2023 11:14:23 -0800 (PST) Received: by mail-wm1-x32a.google.com with SMTP id j19-20020a05600c191300b003eb3e1eb0caso2535639wmq.1 for ; Thu, 02 Mar 2023 11:14:23 -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=kvMUUc5wEUJYWdA676z788wbTTrYmGmHmSy4eXEEE4E=; b=No0tJw9N+bb/4p6Vsb6qYzWqwgEsGf2ywyP5YYcxA4ht4YgrV8RALbz4Q2rLJItRC1 ZnnIWD7acjmco+PLes60MWbG8kPlpWW6QpkK0DndOv4Ejb21sgl2ouenPEtc8IG0vZo7 9JjbofdnGZZMPLcMmIlizC3ARNI9clEPQ2Xv5MYGKXJ+Ne4SOc1M0miivaS7NQ7o53p8 bUMe46WJyHyUu3RtC0wRZPM5IDoX/3Ozb7TFM/RMxfQGTUQ8ea+jbHm1SaqX+A4X4WiM EmKUrVk2ZrEhOuafiu5bT6yvrzV1ogkGkapqioJTYdikH/LRZiUA9/n9LCUn3LY7ApnY Oh0A== 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=kvMUUc5wEUJYWdA676z788wbTTrYmGmHmSy4eXEEE4E=; b=Kzw15KyzQ9h4uAKSCdA5ETsMW8VbTgNvHPH/VviD9DGDwhAP8tFuHaaJxFosAiDLT3 PdWZVfIIuUCs822nn3KQSVdq3ofvDHNip7wdtWSwK6DuMDcZ1uDViS+RN5HiuzhZHejr MNrYtnRy4kYPFYGmiSbQtSvlHrTCyzch1Oy+hr27RTRkokrBKBgbiyc0PjzBx0F18U0P /e/+3kjqFBxW6MrrEx7gNOHS99M8Pw/2DIVxt1l7gO+KOfgzGMWQ9rB1cUTKwaqqbTVB 45rKRPxRxTRRxgSgI4559/qLfVqP/Go2vO2PtJZPQJAznMfgn9YkT9kuHNAZXMQcvm+G J7Fg== X-Gm-Message-State: AO0yUKVjH1Gyy7ePi5iNJ7+oA7tBmAv8QLLiQDj7LJaqJjlxPZtE0Y8S kZk5akR3voDYcjjSz6OSGdOc9w== X-Google-Smtp-Source: AK7set99x5f15zwPdc3lgmkc1Lm3RjN/nUIbueV8TnBeIymj/y6MSAhspthJMp+dsHxYBVPf4c6YJw== X-Received: by 2002:a05:600c:181c:b0:3eb:2e1e:beae with SMTP id n28-20020a05600c181c00b003eb2e1ebeaemr8262271wmp.25.1677784462476; Thu, 02 Mar 2023 11:14:22 -0800 (PST) Received: from zen.linaroharston ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id ip21-20020a05600ca69500b003eb596cbc54sm450210wmb.0.2023.03.02.11.14.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Mar 2023 11:14:21 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id E698E1FFC6; Thu, 2 Mar 2023 19:08:48 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Weiwei Li , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Palmer Dabbelt , Laurent Vivier , nicolas.eder@lauterbach.com, Ilya Leoshkevich , kvm@vger.kernel.org, "Edgar E. Iglesias" , David Gibson , Max Filippov , Sunil Muthuswamy , qemu-s390x@nongnu.org, Stafford Horne , Bin Meng , Marek Vasut , Greg Kurz , Song Gao , Aleksandar Rikalo , Liu Zhiwei , Alistair Francis , Chris Wulff , qemu-riscv@nongnu.org, Michael Rolnik , qemu-arm@nongnu.org, Cleber Rosa , Artyom Tarasenko , Marcel Apfelbaum , Eduardo Habkost , Yoshinori Sato , Alexandre Iooss , Daniel Henrique Barboza , Jiaxun Yang , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , mads@ynddal.dk, Mark Cave-Ayland , qemu-ppc@nongnu.org, Richard Henderson , John Snow , Xiaojuan Yang , Thomas Huth , Paolo Bonzini , Mahmoud Mandour , Aurelien Jarno , Bastian Koppelmann , Yanan Wang , David Hildenbrand , Taylor Simpson , Peter Maydell , =?utf-8?q?Alex_Benn=C3=A9e?= Subject: [PATCH v4 17/26] gdbstub: specialise stub_can_reverse Date: Thu, 2 Mar 2023 19:08:37 +0000 Message-Id: <20230302190846.2593720-18-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230302190846.2593720-1-alex.bennee@linaro.org> References: <20230302190846.2593720-1-alex.bennee@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.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 26a6468a69..be0eef4850 100644 --- a/gdbstub/internals.h +++ b/gdbstub/internals.h @@ -130,6 +130,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 1b783100c2..7301466ff5 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) { @@ -1308,7 +1299,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) { @@ -1559,7 +1550,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 3a5587d387..d2863d0663 100644 --- a/gdbstub/softmmu.c +++ b/gdbstub/softmmu.c @@ -450,6 +450,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 e10988a62b..3f6183e66a 100644 --- a/gdbstub/user.c +++ b/gdbstub/user.c @@ -409,6 +409,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