From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Cc: Richard Henderson <richard.henderson@linaro.org>,
Paolo Bonzini <pbonzini@redhat.com>,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
Laurent Vivier <laurent@vivier.eu>,
Thomas Huth <thuth@redhat.com>, Warner Losh <imp@bsdimp.com>,
Kyle Evans <kevans@freebsd.org>,
Markus Armbruster <armbru@redhat.com>
Subject: [RFC PATCH 1/5] Rename the singlestep global variable to one_insn_per_tb
Date: Mon, 6 Feb 2023 17:13:55 +0000 [thread overview]
Message-ID: <20230206171359.1327671-2-peter.maydell@linaro.org> (raw)
In-Reply-To: <20230206171359.1327671-1-peter.maydell@linaro.org>
The 'singlestep' global variable is badly misnamed, because it has
nothing to do with single-stepping the emulation either via the gdb
stub or by emulation of architectural debug facilities. Instead what
it does is force TCG to put only one instruction into each TB.
Rename it to one_insn_per_tb, so that it reflects what it does better
and is easier to search for in the codebase.
This misnaming is also present in user-facing interfaces: the command
line option '-singlestep', the HMP 'singlestep' command, and the QMP
StatusInfo object. Those are harder to update because we need to
retain backwards compatibility. Subsequent patches will add
better-named aliases so we can eventually deprecate-and-drop the old,
bad name.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
include/exec/cpu-common.h | 2 +-
accel/tcg/cpu-exec.c | 4 ++--
bsd-user/main.c | 4 ++--
linux-user/main.c | 4 ++--
softmmu/globals.c | 2 +-
softmmu/runstate-hmp-cmds.c | 4 ++--
softmmu/runstate.c | 2 +-
softmmu/vl.c | 2 +-
8 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h
index 6feaa40ca7b..f2592a1967f 100644
--- a/include/exec/cpu-common.h
+++ b/include/exec/cpu-common.h
@@ -163,7 +163,7 @@ int cpu_memory_rw_debug(CPUState *cpu, vaddr addr,
void *ptr, size_t len, bool is_write);
/* vl.c */
-extern int singlestep;
+extern int one_insn_per_tb;
void list_cpus(const char *optarg);
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
index 9c857eeb077..08a65f8d506 100644
--- a/accel/tcg/cpu-exec.c
+++ b/accel/tcg/cpu-exec.c
@@ -157,12 +157,12 @@ uint32_t curr_cflags(CPUState *cpu)
* Record gdb single-step. We should be exiting the TB by raising
* EXCP_DEBUG, but to simplify other tests, disable chaining too.
*
- * For singlestep and -d nochain, suppress goto_tb so that
+ * For one-insn-per-tb and -d nochain, suppress goto_tb so that
* we can log -d cpu,exec after every TB.
*/
if (unlikely(cpu->singlestep_enabled)) {
cflags |= CF_NO_GOTO_TB | CF_NO_GOTO_PTR | CF_SINGLE_STEP | 1;
- } else if (singlestep) {
+ } else if (one_insn_per_tb) {
cflags |= CF_NO_GOTO_TB | 1;
} else if (qemu_loglevel_mask(CPU_LOG_TB_NOCHAIN)) {
cflags |= CF_NO_GOTO_TB;
diff --git a/bsd-user/main.c b/bsd-user/main.c
index 6f09180d654..a8de6906ed5 100644
--- a/bsd-user/main.c
+++ b/bsd-user/main.c
@@ -50,7 +50,7 @@
#include "host-os.h"
#include "target_arch_cpu.h"
-int singlestep;
+int one_insn_per_tb;
uintptr_t guest_base;
bool have_guest_base;
/*
@@ -391,7 +391,7 @@ int main(int argc, char **argv)
} else if (!strcmp(r, "seed")) {
seed_optarg = optarg;
} else if (!strcmp(r, "singlestep")) {
- singlestep = 1;
+ one_insn_per_tb = 1;
} else if (!strcmp(r, "strace")) {
do_strace = 1;
} else if (!strcmp(r, "trace")) {
diff --git a/linux-user/main.c b/linux-user/main.c
index 4290651c3cf..99bcd542b42 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -66,7 +66,7 @@
char *exec_path;
-int singlestep;
+int one_insn_per_tb;
static const char *argv0;
static const char *gdbstub;
static envlist_t *envlist;
@@ -397,7 +397,7 @@ static void handle_arg_reserved_va(const char *arg)
static void handle_arg_singlestep(const char *arg)
{
- singlestep = 1;
+ one_insn_per_tb = 1;
}
static void handle_arg_strace(const char *arg)
diff --git a/softmmu/globals.c b/softmmu/globals.c
index 527edbefdd0..f46df89d2db 100644
--- a/softmmu/globals.c
+++ b/softmmu/globals.c
@@ -43,7 +43,7 @@ int vga_interface_type = VGA_NONE;
bool vga_interface_created;
Chardev *parallel_hds[MAX_PARALLEL_PORTS];
int win2k_install_hack;
-int singlestep;
+int one_insn_per_tb;
int fd_bootchk = 1;
int graphic_rotate;
QEMUOptionRom option_rom[MAX_OPTION_ROMS];
diff --git a/softmmu/runstate-hmp-cmds.c b/softmmu/runstate-hmp-cmds.c
index d55a7d4db89..29c9a038863 100644
--- a/softmmu/runstate-hmp-cmds.c
+++ b/softmmu/runstate-hmp-cmds.c
@@ -44,9 +44,9 @@ void hmp_singlestep(Monitor *mon, const QDict *qdict)
{
const char *option = qdict_get_try_str(qdict, "option");
if (!option || !strcmp(option, "on")) {
- singlestep = 1;
+ one_insn_per_tb = 1;
} else if (!strcmp(option, "off")) {
- singlestep = 0;
+ one_insn_per_tb = 0;
} else {
monitor_printf(mon, "unexpected option %s\n", option);
}
diff --git a/softmmu/runstate.c b/softmmu/runstate.c
index cab9f6fc075..8272aef43b4 100644
--- a/softmmu/runstate.c
+++ b/softmmu/runstate.c
@@ -236,7 +236,7 @@ StatusInfo *qmp_query_status(Error **errp)
StatusInfo *info = g_malloc0(sizeof(*info));
info->running = runstate_is_running();
- info->singlestep = singlestep;
+ info->singlestep = one_insn_per_tb;
info->status = current_run_state;
return info;
diff --git a/softmmu/vl.c b/softmmu/vl.c
index 9177d95d4ec..dbe5124b5e7 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -2957,7 +2957,7 @@ void qemu_init(int argc, char **argv)
qdict_put_str(machine_opts_dict, "firmware", optarg);
break;
case QEMU_OPTION_singlestep:
- singlestep = 1;
+ one_insn_per_tb = 1;
break;
case QEMU_OPTION_S:
autostart = 0;
--
2.34.1
next prev parent reply other threads:[~2023-02-06 17:15 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-06 17:13 [RFC PATCH 0/5] Deprecate/rename singlestep command line option Peter Maydell
2023-02-06 17:13 ` Peter Maydell [this message]
2023-02-06 20:20 ` [RFC PATCH 1/5] Rename the singlestep global variable to one_insn_per_tb Thomas Huth
2023-02-10 16:48 ` Peter Maydell
2023-02-06 17:13 ` [RFC PATCH 2/5] linux-user: Add '-one-insn-per-tb' option equivalent to '-singlestep' Peter Maydell
2023-02-06 17:13 ` [RFC PATCH 3/5] bsd-user: " Peter Maydell
2023-02-06 17:13 ` [RFC PATCH 4/5] softmmu: " Peter Maydell
2023-02-06 17:13 ` [RFC PATCH 5/5] hmp: Add 'one-insn-per-tb' command equivalent to 'singlestep' Peter Maydell
2023-02-06 18:18 ` [RFC PATCH 0/5] Deprecate/rename singlestep command line option Richard Henderson
2023-02-06 20:17 ` Thomas Huth
2023-02-07 11:01 ` Peter Maydell
2023-02-07 11:33 ` Thomas Huth
2023-02-07 15:56 ` Markus Armbruster
2023-02-08 23:04 ` Warner Losh
2023-02-13 15:01 ` Dr. David Alan Gilbert
2023-04-03 12:47 ` Peter Maydell
2023-04-03 14:41 ` Markus Armbruster
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230206171359.1327671-2-peter.maydell@linaro.org \
--to=peter.maydell@linaro.org \
--cc=armbru@redhat.com \
--cc=dgilbert@redhat.com \
--cc=imp@bsdimp.com \
--cc=kevans@freebsd.org \
--cc=laurent@vivier.eu \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).