diff options
author | Thomas Huth <thuth@redhat.com> | 2018-07-16 14:59:21 +0200 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2018-07-17 13:12:49 +0100 |
commit | 955cbc6b178fec1f656e702774390c2023798fb7 (patch) | |
tree | d366c2fb0b775563b881f80cf7cca70fefe4bdb0 /hw/arm/armv7m.c | |
parent | 14c520e335304ba79f6a68b1ea1d90895790b065 (diff) |
hw/arm/armv7: Fix crash when introspecting the "iotkit" device
QEMU currently crashes when introspecting the "iotkit" device and
runnint "info qtree" afterwards, e.g. when running QEMU like this:
echo "{'execute':'qmp_capabilities'} {'execute':'device-list-properties'," \
"'arguments':{'typename':'iotkit'}}" "{'execute': 'human-monitor-command', " \
"'arguments': {'command-line': 'info qtree'}}" | \
aarch64-softmmu/qemu-system-aarch64 -M none,accel=qtest -qmp stdio
Use the new functions object_initialize_child() and sysbus_init_child_obj()
to make sure that all objects get cleaned up correctly when the instances
are destroyed.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-id: 1531745974-17187-5-git-send-email-thuth@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/arm/armv7m.c')
-rw-r--r-- | hw/arm/armv7m.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/hw/arm/armv7m.c b/hw/arm/armv7m.c index 9e00d4037c..6b07666057 100644 --- a/hw/arm/armv7m.c +++ b/hw/arm/armv7m.c @@ -134,14 +134,13 @@ static void armv7m_instance_init(Object *obj) memory_region_init(&s->container, obj, "armv7m-container", UINT64_MAX); - object_initialize(&s->nvic, sizeof(s->nvic), TYPE_NVIC); - qdev_set_parent_bus(DEVICE(&s->nvic), sysbus_get_default()); + sysbus_init_child_obj(obj, "nvnic", &s->nvic, sizeof(s->nvic), TYPE_NVIC); object_property_add_alias(obj, "num-irq", OBJECT(&s->nvic), "num-irq", &error_abort); for (i = 0; i < ARRAY_SIZE(s->bitband); i++) { - object_initialize(&s->bitband[i], sizeof(s->bitband[i]), TYPE_BITBAND); - qdev_set_parent_bus(DEVICE(&s->bitband[i]), sysbus_get_default()); + sysbus_init_child_obj(obj, "bitband[*]", &s->bitband[i], + sizeof(s->bitband[i]), TYPE_BITBAND); } } |