The command line option '-singlestep' and its HMP equivalent
the 'singlestep' command are very confusingly named, because
they have nothing to do with single-stepping the guest (either
via the gdb stub or by emulation of guest CPU architectural
debug facilities). What they actually do is put TCG into a
mode where it puts only one guest instruction into each
translation block. This is useful for some circumstances
such as when you want the -d debug logging to be easier to
interpret, or if you have a finicky guest binary that wants
to see interrupts delivered at something other than the end
of a basic block.
The confusing name is made worse by the fact that our
documentation for these is so minimal as to be useless
for telling users what they really do.
This series:
* changes the command line interface: for user-mode
emulators, the new option is '-one-insn-per-tb',
and for system mode emulators it is a TCG accel
property '-accel tcg,one-insn-per-tb=on'
* updates all the places which currently directly touch
the 'singlestep' global variable to instead get the
current accelerator and query/set the QOM property
* documents that the old -singlestep option is deprecated
* adds a new HMP command 'one-insn-per-tb', and deprecates
the old 'singlestep' command. (Strictly we don't need to
deprecate HMP commands, but I'd already written the code
for v1 of this series and it's a minor user convenience.)
* makes the HMP 'info status' output report "one insn per TB"
instead of "single step mode"
* adds a new 'one-insn-per-tb' member to the QMP StatusInfo
type, and deprecates the old 'singlestep' field
Notes:
* I hope I have got the QMP changes and deprecation right,
but that's probably the bit in most need of review from
an expert
* There's an argument for just dropping the reporting of
one-insn-per-tb in QMP StatusInfo at all, except that
(a) it's hard to know if anybody's really using it
(b) then the info isn't reported to HMP 'info status',
which wouldn't line up with HMP having a mechanism
to get/set the value
* I have written patch 3 on the assumption that curr_cflags()
is not such a hot codepath that we can't afford to have
a QOM cast macro in it; the alternative would be to
keep it using a global variable but make the global be
restricted to accel/tcg/internals.h. RTH: opinions welcome...
* Still haven't tested on bsd-user, but the patch is identical
to the linux-user change
thanks
-- PMM
Peter Maydell (10):
make one-insn-per-tb an accel option
softmmu: Don't use 'singlestep' global in QMP and HMP commands
tcg: Use one-insn-per-tb accelerator property in curr_cflags()
linux-user: Add '-one-insn-per-tb' option equivalent to '-singlestep'
bsd-user: Add '-one-insn-per-tb' option equivalent to '-singlestep'
Document that -singlestep command line option is deprecated
hmp: Add 'one-insn-per-tb' command equivalent to 'singlestep'
hmp: Report 'one-insn-per-tb', not 'single step mode', in 'info
status' output
qapi/run-state.json: Fix missing newline at end of file
hmp: Deprecate 'singlestep' member of StatusInfo
docs/about/deprecated.rst | 35 +++++++++++++++++++++++++++++++++++
docs/interop/qmp-intro.txt | 1 +
docs/user/main.rst | 14 ++++++++++++--
qapi/run-state.json | 19 +++++++++++++++----
accel/tcg/internal.h | 16 ++++++++++++++++
include/exec/cpu-common.h | 3 ---
include/monitor/hmp.h | 2 +-
accel/tcg/cpu-exec.c | 5 +++--
accel/tcg/tcg-all.c | 32 ++++++++++++++++++--------------
bsd-user/main.c | 14 +++++++++-----
linux-user/main.c | 18 ++++++++++++------
softmmu/globals.c | 1 -
softmmu/runstate-hmp-cmds.c | 22 ++++++++++++++++++----
softmmu/runstate.c | 12 +++++++++++-
softmmu/vl.c | 17 +++++++++++++++--
tests/qtest/test-hmp.c | 1 +
hmp-commands.hx | 25 +++++++++++++++++++++----
qemu-options.hx | 12 ++++++++++--
tcg/tci/README | 2 +-
19 files changed, 199 insertions(+), 52 deletions(-)
--
2.34.1