gdbstub: move update guest debug to accel ops
Continuing the refactor of a48e7d9e52
(gdbstub: move guest debug support
check to ops) by removing hardcoded kvm_enabled() from generic cpu.c
code, and replace it with a property of AccelOpsClass.
Signed-off-by: Mads Ynddal <m.ynddal@samsung.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230207131721.49233-1-mads@ynddal.dk>
[AJB: add ifdef around update_guest_debug_ops, fix brace]
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20230302190846.2593720-27-alex.bennee@linaro.org>
Message-Id: <20230303025805.625589-30-richard.henderson@linaro.org>
This commit is contained in:
parent
2d3d2517cc
commit
412ae12647
@ -86,6 +86,13 @@ static bool kvm_cpus_are_resettable(void)
|
|||||||
return !kvm_enabled() || kvm_cpu_check_are_resettable();
|
return !kvm_enabled() || kvm_cpu_check_are_resettable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef KVM_CAP_SET_GUEST_DEBUG
|
||||||
|
static int kvm_update_guest_debug_ops(CPUState *cpu)
|
||||||
|
{
|
||||||
|
return kvm_update_guest_debug(cpu, 0);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void kvm_accel_ops_class_init(ObjectClass *oc, void *data)
|
static void kvm_accel_ops_class_init(ObjectClass *oc, void *data)
|
||||||
{
|
{
|
||||||
AccelOpsClass *ops = ACCEL_OPS_CLASS(oc);
|
AccelOpsClass *ops = ACCEL_OPS_CLASS(oc);
|
||||||
@ -99,6 +106,7 @@ static void kvm_accel_ops_class_init(ObjectClass *oc, void *data)
|
|||||||
ops->synchronize_pre_loadvm = kvm_cpu_synchronize_pre_loadvm;
|
ops->synchronize_pre_loadvm = kvm_cpu_synchronize_pre_loadvm;
|
||||||
|
|
||||||
#ifdef KVM_CAP_SET_GUEST_DEBUG
|
#ifdef KVM_CAP_SET_GUEST_DEBUG
|
||||||
|
ops->update_guest_debug = kvm_update_guest_debug_ops;
|
||||||
ops->supports_guest_debug = kvm_supports_guest_debug;
|
ops->supports_guest_debug = kvm_supports_guest_debug;
|
||||||
ops->insert_breakpoint = kvm_insert_breakpoint;
|
ops->insert_breakpoint = kvm_insert_breakpoint;
|
||||||
ops->remove_breakpoint = kvm_remove_breakpoint;
|
ops->remove_breakpoint = kvm_remove_breakpoint;
|
||||||
|
11
cpu.c
11
cpu.c
@ -31,8 +31,8 @@
|
|||||||
#include "hw/core/sysemu-cpu-ops.h"
|
#include "hw/core/sysemu-cpu-ops.h"
|
||||||
#include "exec/address-spaces.h"
|
#include "exec/address-spaces.h"
|
||||||
#endif
|
#endif
|
||||||
|
#include "sysemu/cpus.h"
|
||||||
#include "sysemu/tcg.h"
|
#include "sysemu/tcg.h"
|
||||||
#include "sysemu/kvm.h"
|
|
||||||
#include "exec/replay-core.h"
|
#include "exec/replay-core.h"
|
||||||
#include "exec/cpu-common.h"
|
#include "exec/cpu-common.h"
|
||||||
#include "exec/exec-all.h"
|
#include "exec/exec-all.h"
|
||||||
@ -326,9 +326,14 @@ void cpu_single_step(CPUState *cpu, int enabled)
|
|||||||
{
|
{
|
||||||
if (cpu->singlestep_enabled != enabled) {
|
if (cpu->singlestep_enabled != enabled) {
|
||||||
cpu->singlestep_enabled = enabled;
|
cpu->singlestep_enabled = enabled;
|
||||||
if (kvm_enabled()) {
|
|
||||||
kvm_update_guest_debug(cpu, 0);
|
#if !defined(CONFIG_USER_ONLY)
|
||||||
|
const AccelOpsClass *ops = cpus_get_accel();
|
||||||
|
if (ops->update_guest_debug) {
|
||||||
|
ops->update_guest_debug(cpu);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
trace_breakpoint_singlestep(cpu->cpu_index, enabled);
|
trace_breakpoint_singlestep(cpu->cpu_index, enabled);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,6 +48,7 @@ struct AccelOpsClass {
|
|||||||
|
|
||||||
/* gdbstub hooks */
|
/* gdbstub hooks */
|
||||||
bool (*supports_guest_debug)(void);
|
bool (*supports_guest_debug)(void);
|
||||||
|
int (*update_guest_debug)(CPUState *cpu);
|
||||||
int (*insert_breakpoint)(CPUState *cpu, int type, vaddr addr, vaddr len);
|
int (*insert_breakpoint)(CPUState *cpu, int type, vaddr addr, vaddr len);
|
||||||
int (*remove_breakpoint)(CPUState *cpu, int type, vaddr addr, vaddr len);
|
int (*remove_breakpoint)(CPUState *cpu, int type, vaddr addr, vaddr len);
|
||||||
void (*remove_all_breakpoints)(CPUState *cpu);
|
void (*remove_all_breakpoints)(CPUState *cpu);
|
||||||
|
Loading…
Reference in New Issue
Block a user