aboutsummaryrefslogtreecommitdiff
path: root/qom
diff options
context:
space:
mode:
Diffstat (limited to 'qom')
-rw-r--r--qom/cpu.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/qom/cpu.c b/qom/cpu.c
index f02e9c0fae..f9111a02ba 100644
--- a/qom/cpu.c
+++ b/qom/cpu.c
@@ -382,6 +382,7 @@ static void cpu_common_unrealizefn(DeviceState *dev, Error **errp)
static void cpu_common_initfn(Object *obj)
{
+ uint32_t count;
CPUState *cpu = CPU(obj);
CPUClass *cc = CPU_GET_CLASS(obj);
@@ -396,7 +397,10 @@ static void cpu_common_initfn(Object *obj)
QTAILQ_INIT(&cpu->breakpoints);
QTAILQ_INIT(&cpu->watchpoints);
- cpu->trace_dstate = bitmap_new(trace_get_vcpu_event_count());
+ count = trace_get_vcpu_event_count();
+ if (count) {
+ cpu->trace_dstate = bitmap_new(count);
+ }
cpu_exec_initfn(cpu);
}