[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 06/10] qom/object: Display more helpful message when a parent
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH v2 06/10] qom/object: Display more helpful message when a parent is missing |
Date: |
Tue, 21 Jan 2020 12:03:45 +0100 |
QEMU object model is scarse in documentation. Some calls are
recursive, and it might be hard to figure out even trivial issues.
We can avoid developers to waste time in a debugging session by
displaying a simple error message.
This commit is also similar to e02bdf1cecd2 ("Display more helpful
message when an object type is missing").
Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
---
v2: New patch
---
qom/object.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/qom/object.c b/qom/object.c
index 0d971ca897..bc13a55094 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -173,7 +173,11 @@ static TypeImpl *type_get_parent(TypeImpl *type)
{
if (!type->parent_type && type->parent) {
type->parent_type = type_get_by_name(type->parent);
- g_assert(type->parent_type != NULL);
+ if (!type->parent_type) {
+ fprintf(stderr, "Object '%s' missing its parent '%s'\n",
+ type->name, type->parent);
+ abort();
+ }
}
return type->parent_type;
--
2.21.1
- [PATCH v2 00/10] Cleanups around the 'current_machine' global variable, Philippe Mathieu-Daudé, 2020/01/21
- [PATCH v2 01/10] hw/ppc/spapr_rtas: Use local MachineState variable, Philippe Mathieu-Daudé, 2020/01/21
- [PATCH v2 02/10] hw/ppc/spapr_rtas: Access MachineState via SpaprMachineState argument, Philippe Mathieu-Daudé, 2020/01/21
- [PATCH v2 03/10] hw/ppc/spapr_rtas: Remove local variable, Philippe Mathieu-Daudé, 2020/01/21
- [PATCH v2 04/10] target/arm/kvm: Use CPUState::kvm_state in kvm_arm_pmu_supported(), Philippe Mathieu-Daudé, 2020/01/21
- [PATCH v2 05/10] target/s390x: Remove duplicated ifdef macro, Philippe Mathieu-Daudé, 2020/01/21
- [PATCH v2 06/10] qom/object: Display more helpful message when a parent is missing,
Philippe Mathieu-Daudé <=
- [PATCH v2 07/10] qdev: Abort if the root machine container is missing, Philippe Mathieu-Daudé, 2020/01/21
- [PATCH v2 08/10] accel: Introduce the current_accel() wrapper, Philippe Mathieu-Daudé, 2020/01/21
- [PATCH v2 09/10] accel: Replace current_machine->accelerator by current_accel() wrapper, Philippe Mathieu-Daudé, 2020/01/21
- [PATCH v2 10/10] accel/tcg: Sanitize include path, Philippe Mathieu-Daudé, 2020/01/21