aboutsummaryrefslogtreecommitdiff
path: root/softmmu/runstate-hmp-cmds.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2023-04-17 17:40:33 +0100
committerPeter Maydell <peter.maydell@linaro.org>2023-05-02 15:47:40 +0100
commit93cbd6c91db6bb4e44580118865862f716338f14 (patch)
treea740138a4d33fa920aa842295290d0fbde3de0b4 /softmmu/runstate-hmp-cmds.c
parent3cfb0456c352288d5104a89cceb25f7dcda5d4c0 (diff)
softmmu: Don't use 'singlestep' global in QMP and HMP commands
The HMP 'singlestep' command, the QMP 'query-status' command and the HMP 'info status' command (which is just wrapping the QMP command implementation) look at the 'singlestep' global variable. Make them access the new TCG accelerator 'one-insn-per-tb' property instead. This leaves the HMP and QMP command/field names and output strings unchanged; we will clean that up later. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-id: 20230417164041.684562-3-peter.maydell@linaro.org
Diffstat (limited to 'softmmu/runstate-hmp-cmds.c')
-rw-r--r--softmmu/runstate-hmp-cmds.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/softmmu/runstate-hmp-cmds.c b/softmmu/runstate-hmp-cmds.c
index d55a7d4db8..127521a483 100644
--- a/softmmu/runstate-hmp-cmds.c
+++ b/softmmu/runstate-hmp-cmds.c
@@ -20,6 +20,7 @@
#include "qapi/error.h"
#include "qapi/qapi-commands-run-state.h"
#include "qapi/qmp/qdict.h"
+#include "qemu/accel.h"
void hmp_info_status(Monitor *mon, const QDict *qdict)
{
@@ -43,13 +44,26 @@ void hmp_info_status(Monitor *mon, const QDict *qdict)
void hmp_singlestep(Monitor *mon, const QDict *qdict)
{
const char *option = qdict_get_try_str(qdict, "option");
+ AccelState *accel = current_accel();
+ bool newval;
+
+ if (!object_property_find(OBJECT(accel), "one-insn-per-tb")) {
+ monitor_printf(mon,
+ "This accelerator does not support setting one-insn-per-tb\n");
+ return;
+ }
+
if (!option || !strcmp(option, "on")) {
- singlestep = 1;
+ newval = true;
} else if (!strcmp(option, "off")) {
- singlestep = 0;
+ newval = false;
} else {
monitor_printf(mon, "unexpected option %s\n", option);
+ return;
}
+ /* If the property exists then setting it can never fail */
+ object_property_set_bool(OBJECT(accel), "one-insn-per-tb",
+ newval, &error_abort);
}
void hmp_watchdog_action(Monitor *mon, const QDict *qdict)