On 2/9/22 02:22, Philippe Mathieu-Daudé wrote:
-int kvm_update_guest_debug(CPUState *cpu, unsigned long reinject_trap)
-{
-    return -ENOSYS;
-}
-
  int kvm_insert_breakpoint(CPUState *cpu, target_ulong addr,
                            target_ulong len, int type)
  {
diff --git a/cpu.c b/cpu.c
index 97d42b6b2a..834e2b4cdb 100644
--- a/cpu.c
+++ b/cpu.c
@@ -350,7 +350,7 @@ void cpu_single_step(CPUState *cpu, int enabled)
  {
      if (cpu->singlestep_enabled != enabled) {
          cpu->singlestep_enabled = enabled;
-        if (kvm_enabled()) {
+        if (kvm_enabled() && kvm_supports_guest_debug()) {
              kvm_update_guest_debug(cpu, 0);

Why is this second hunk required?

I would think the stub would be removable on its own, since it is protected by kvm_enabled, which will expand to false exactly like kvm_supports_guest_debug expands to false.

As an aside, I wonder about the non-checking of the update return value...


r~

Reply via email to