summaryrefslogtreecommitdiff
path: root/gdbstub.c
diff options
context:
space:
mode:
authorMaxim Levitsky <mlevitsk@redhat.com>2021-11-11 12:06:03 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2021-12-10 09:47:18 +0100
commit12bc5b4cd5e59b3f8689b71d9d038a55e2777cdc (patch)
tree7b8dd82031af7ed7dc003d599bb976f6cb006934 /gdbstub.c
parentecd39d620b0a3938dc3a80721e8aa436075d2916 (diff)
gdbstub, kvm: let KVM report supported singlestep flags
Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com> [Extracted from Maxim's patch into a separate commit. - Paolo] Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20211111110604.207376-5-pbonzini@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'gdbstub.c')
-rw-r--r--gdbstub.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/gdbstub.c b/gdbstub.c
index a955175fd4..3c14c6a038 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -391,6 +391,8 @@ static void init_gdbserver_state(void)
*/
if (replay_mode != REPLAY_MODE_NONE) {
gdbserver_state.supported_sstep_flags = SSTEP_ENABLE;
+ } else if (kvm_enabled()) {
+ gdbserver_state.supported_sstep_flags = kvm_get_supported_sstep_flags();
} else {
gdbserver_state.supported_sstep_flags =
SSTEP_ENABLE | SSTEP_NOIRQ | SSTEP_NOTIMER;
@@ -400,7 +402,8 @@ static void init_gdbserver_state(void)
* By default use no IRQs and no timers while single stepping so as to
* make single stepping like an ICE HW step.
*/
- gdbserver_state.sstep_flags = gdbserver_state.supported_sstep_flags;
+ gdbserver_state.sstep_flags = SSTEP_ENABLE | SSTEP_NOIRQ | SSTEP_NOTIMER;
+ gdbserver_state.sstep_flags &= gdbserver_state.supported_sstep_flags;
}
@@ -3520,6 +3523,11 @@ int gdbserver_start(const char *device)
return -1;
}
+ if (kvm_enabled() && !kvm_supports_guest_debug()) {
+ error_report("gdbstub: KVM doesn't support guest debugging");
+ return -1;
+ }
+
if (!device)
return -1;
if (strcmp(device, "none") != 0) {