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: 658143 Delivered-To: patch@linaro.org Received: by 2002:adf:a3c6:0:0:0:0:0 with SMTP id m6csp67312wrb; Thu, 2 Mar 2023 11:16:02 -0800 (PST) X-Google-Smtp-Source: AK7set87YpiM/Id8YJ2So8XtmYYRZnDmMT228zS+hWcji2w7B8nV3i6Es2V7MWIidLs+XqWJUnJw X-Received: by 2002:ad4:596f:0:b0:56a:b749:3ca0 with SMTP id eq15-20020ad4596f000000b0056ab7493ca0mr17977806qvb.35.1677784562304; Thu, 02 Mar 2023 11:16:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677784562; cv=none; d=google.com; s=arc-20160816; b=KsXWYnsavuwf+QTjvZaGJmR4wkgOhB1cEygFYYKyRGwVVsx9CM4eXwFooRFWsFwmhR eVoynDI4fc8DWsosUgX0myNMjIbteDEexDZMzFfYtmHNGhuDlRcq23YvFQKHGmBRsYkw FAi2Jk0lE31fwC9eUFw65rt8lQ/PETL+UrGTpUgUOFbH4k0ctFmEFMjd8YzrpXBIKZ+V 40jghthVPlJk4k1U+pqtemEl0HCMk53ujXjB3lSQk7+PeMZVh/lI/EDEln+QArQpitt7 RRrPemMV0t/B7B+DKLFL3NE2/fqaf5gz4mE3BUsiMXPlGDwRWR11aFwvPPhbsXbJxm/a crWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=kvMUUc5wEUJYWdA676z788wbTTrYmGmHmSy4eXEEE4E=; b=Y7lhJo6iOiVqHwyMeB7ieGt+HNCBtQ6h9vWG5eQECOVfgnjkJ0pquEo/s5AUQst0Qg 42fL93xta+CGZIxp4TebJl8DrSs0nkoAqfL8RPhbddDSCC/M5nhx+sSzH68HykBUPe93 r8Wx55QU9RbPXug+Pwc6lTawtkAEzEPXM9QvWf2FRY/YRF71Y2kHd4XLHL4SteRFZeGQ NY43XNr3Dqzos34LrrpMXw5nWuP0HhPsLI7senxkm9Kux/doXEn5R0065/g4QA3rEK6l i4tcJvUcEiLv3OaSEdzvk8MEbVTrsTzP7JFOSpcybidCLZShXryfy7pcQc9cXb07F6u5 65BQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=No0tJw9N; 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=pass (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 z17-20020a0cf251000000b0056e9ecb0e6fsi13781959qvl.108.2023.03.02.11.16.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Mar 2023 11:16:02 -0800 (PST) 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=pass header.i=@linaro.org header.s=google header.b=No0tJw9N; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pXoNx-0006va-A0; Thu, 02 Mar 2023 14:14:37 -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 1pXoNt-0006jF-RT for qemu-devel@nongnu.org; Thu, 02 Mar 2023 14:14:33 -0500 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pXoNj-0000l2-TB for qemu-devel@nongnu.org; Thu, 02 Mar 2023 14:14:33 -0500 Received: by mail-wm1-x32a.google.com with SMTP id m25-20020a7bcb99000000b003e7842b75f2so9754wmi.3 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=LA+cyV1xF5R2UOPePupflApV8BrZy2XJpw+MEB/K1YJ5ZYGGJgS9IeDOqyGkh/ZhjG pqUB1hNi82nHpGtamPkFl7atK1Jr34KIxzcGKYzDuwG5kaE2zGO214/neL7GsuEYIYSp aHlLkJ6DhS06ksQDU9mPych/NanApmjScxsHC9DcSrAvi0H/MsEcRypYRe8gfVdQ0VRK x0DUD59T0fW2zxQT6xQeL9AKq20MhGHC/AHhmGQHQagBw6mY1fIIwcaocrFKoO/QozEY Jcv6kHlmVZrkOswbwdooRW/tcmpgPBAjbch0p9xRRrfXcx7kL2wcFZdONf1rooHtor6A Mn0g== X-Gm-Message-State: AO0yUKXok58p/k7MvO0+jt/ZQKw9ez3uuG1QvI4w+eLIMoi9TMzHgCEf UjAc9RwfUkIO5PIy+HvGc6J3cA== 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 Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32a.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.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 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