From patchwork Tue Mar 7 21:21:26 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: 659863 Delivered-To: patch@linaro.org Received: by 2002:adf:a3c6:0:0:0:0:0 with SMTP id m6csp2608250wrb; Tue, 7 Mar 2023 13:30:31 -0800 (PST) X-Google-Smtp-Source: AK7set/gzvgdH2YH8A6x7hNhkrGjiKumQ8e5q86YafpeRR7WwLrvItLeJD8jG3QDSJvRu+brGzjZ X-Received: by 2002:a05:622a:174b:b0:3ba:1bcb:af01 with SMTP id l11-20020a05622a174b00b003ba1bcbaf01mr20712477qtk.59.1678224631789; Tue, 07 Mar 2023 13:30:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678224631; cv=none; d=google.com; s=arc-20160816; b=unHT+DzB3FTy21q2P19GnfKh5DN7NodL2P+8DVqMn4cWD4oAdI9Ea6riVrm2xPdhgH bo/L7X8a9NWwYoGCaXZG+Ix07ZWCeyT7s9bKbbglrT5ifSSja/Q8qFBM+R1tXxf0Y26g OOaJTa30zkMlAys6+tFPbS3rUxo5UlxrUNve2+iQKN0/ESBUe3t8o4ywwmJiMV4WBUyZ z9FoOnCY2HwE+LzR0+zFDTaUycAI+e69S/Ch25/dhtdW0Ipk230T0HR2tnm/ZSNqJJt3 3F+Pfb0C4VTIVYNxOiRkNq6YGBguTXkJf1QZxHoXPmhjUrPvsRVI4cnCiibLkfVpbF3f P6gw== 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=AQeXWxPmgbicvB+LTf6+sZsRCCKyI5yI4jnTigEp1tk=; b=TJ1GWWbpKkq2uUk5RBZW1Xc+zQZnHyOTSpdwAmhLy1ajwBpVadLswkb/h782STGV4P QL4QHTpndzInvV71OHNKuhI3O/ZC2XFfCyQ2u0Et8B5PIXk46KkKgz2uYAS6bWQEKkK8 Fy4Xng0/8/fbU8Jjuk9clNpDhWhzLDFMN2IEWm0+WKu5XC1oCZEl9ftWkJP8PyuN6vba /SQ1JDMYWAbL2Xd/wE5zC+LGSOWrdaZlqKlil/TM3qxjwHnanaciykRL+CrE3tEy7bQV /APl93wO1p8+bR1W3GdhAF3CO+WEV4p8UgI6zGWZu+4Ly5mtKsNk5lf2yxZS8CVP5b4K A3Eg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zwAZUlVk; 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 t145-20020a37aa97000000b0072cc75b9b28si9484595qke.430.2023.03.07.13.30.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 07 Mar 2023 13:30:31 -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=zwAZUlVk; 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 1pZesA-0004hb-Ma; Tue, 07 Mar 2023 16:29:26 -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 1pZes8-0004fh-DX for qemu-devel@nongnu.org; Tue, 07 Mar 2023 16:29:24 -0500 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pZes6-0000v8-LR for qemu-devel@nongnu.org; Tue, 07 Mar 2023 16:29:24 -0500 Received: by mail-wm1-x32b.google.com with SMTP id t25-20020a1c7719000000b003eb052cc5ccso5353wmi.4 for ; Tue, 07 Mar 2023 13:29:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678224561; 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=AQeXWxPmgbicvB+LTf6+sZsRCCKyI5yI4jnTigEp1tk=; b=zwAZUlVkKcIjMinucHGjYgQL4LITn8KDj/0EwN2G0hNBLEI7MR491Ks40sL+lycsKH DX9pCRR3DKvyE0+xrmW+AD75tAm1DP8aqR4pI4NgexFbbhkrohmQAvXKlGtSW44ZK2nl nlL7wGEHMhMmeE6TAc95HiGOyPj84OpBuqWP3kcwrIfTPaywCMVber+uCjOq/7jUQPfX yfha7P4Q4HpnHCf5LXdRZCa+juaRxst5+CeIJFykQ+YZBkU8X8vo5LUpO9LlC3tvDNTX ZbB09ucowz8HK8cINUx/63zJRWud7PTChRkXR07am/bSSdItVOqImsVEILfPrK9jxAm4 rOQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678224561; 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=AQeXWxPmgbicvB+LTf6+sZsRCCKyI5yI4jnTigEp1tk=; b=H8undOB1a3ubY5nM3uurvBaEfeeYj2wnKQcaTE/ee1z8zb0L6um/zlJc0AW1OqateX jvVyOx53mkZk4SGJFenAFYgf7kTjo+9ObyWO75zj1awI+++PFLc4KG5zZwP5PgJKG2id h8RKDIZ1vOcXY+6/y3ghTUa2uvM2EuHHWOqATSo/qv0ptQxbaak4NubqYQ0dr+EW66L4 AV4FlHKtNozadO2qmDYKER4WVAmYjUkNROLnnouVTejXVrv73dWCIxsadqfx7nKXfNh+ 3LSDFa6FKbxxEkNfYflm+gJF9XliPL6pLDHQXvX+vlB/O4f0WPbWuAyeLzw5oa9bc3d/ 7P+g== X-Gm-Message-State: AO0yUKXN81l2dcmq4X4YnTcGT4jGnlUfefNVS2MmPXosVzM0YWGUFx9A eNrZIuQNSwYpRKsaDUpfeGGASA== X-Received: by 2002:a05:600c:19d4:b0:3eb:2b88:7838 with SMTP id u20-20020a05600c19d400b003eb2b887838mr14485698wmq.14.1678224560886; Tue, 07 Mar 2023 13:29:20 -0800 (PST) Received: from zen.linaroharston ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id q7-20020a05600c2e4700b003e70a7c1b73sm13519179wmf.16.2023.03.07.13.29.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 13:29:20 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 602071FFC6; Tue, 7 Mar 2023 21:21:41 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , Richard Henderson Subject: [PULL 17/30] gdbstub: specialise stub_can_reverse Date: Tue, 7 Mar 2023 21:21:26 +0000 Message-Id: <20230307212139.883112-18-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230307212139.883112-1-alex.bennee@linaro.org> References: <20230307212139.883112-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32b.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.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 Message-Id: <20230302190846.2593720-18-alex.bennee@linaro.org> Message-Id: <20230303025805.625589-18-richard.henderson@linaro.org> 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