diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2013-05-10 14:16:39 +0200 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2013-05-13 09:52:06 -0500 |
commit | fa131d94a5c00c6bbea39358d4bca7bf98f6c1f5 (patch) | |
tree | b1d51ed6b9db06595c4313bca6fe572b68178049 /qom/object.c | |
parent | be17f18b8cd438be7f8f65000c0baecdd5b34634 (diff) |
qom: trace asserting casts
This provides a way to detect the cast that leads to a (reproducible)
crash even when QOM cast debugging is disabled.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 1368188203-3407-6-git-send-email-pbonzini@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'qom/object.c')
-rw-r--r-- | qom/object.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/qom/object.c b/qom/object.c index bca6219a52..1b9c5ce4f8 100644 --- a/qom/object.c +++ b/qom/object.c @@ -16,6 +16,7 @@ #include "qapi/string-input-visitor.h" #include "qapi/string-output-visitor.h" #include "qapi/qmp/qerror.h" +#include "trace.h" /* TODO: replace QObject with a simpler visitor to avoid a dependency * of the QOM core on QObject? */ @@ -436,6 +437,9 @@ Object *object_dynamic_cast_assert(Object *obj, const char *typename, { Object *inst; + trace_object_dynamic_cast_assert(obj ? obj->class->type->name : "(null)", + typename, file, line, func); + inst = object_dynamic_cast(obj, typename); if (!inst && obj) { @@ -500,8 +504,12 @@ ObjectClass *object_class_dynamic_cast_assert(ObjectClass *class, const char *file, int line, const char *func) { - ObjectClass *ret = object_class_dynamic_cast(class, typename); + ObjectClass *ret; + + trace_object_class_dynamic_cast_assert(class ? class->type->name : "(null)", + typename, file, line, func); + ret = object_class_dynamic_cast(class, typename); if (!ret && class) { fprintf(stderr, "%s:%d:%s: Object %p is not an instance of type %s\n", file, line, func, class, typename); |