diff options
author | Daniel P. Berrangé <berrange@redhat.com> | 2020-09-14 14:56:17 +0100 |
---|---|---|
committer | Eduardo Habkost <ehabkost@redhat.com> | 2020-09-22 16:45:16 -0400 |
commit | efba15959cdb1ca7beeed8d6188ab0905b468f90 (patch) | |
tree | 5af4ba146184a2bcdc3100bd37388a04b11d3e43 /target | |
parent | 834b9273d5cdab68180dc8c84d641aaa4344b057 (diff) |
qom: simplify object_find_property / object_class_find_property
When debugging QEMU it is often useful to put a breakpoint on the
error_setg_internal method impl.
Unfortunately the object_property_add / object_class_property_add
methods call object_property_find / object_class_property_find methods
to check if a property exists already before adding the new property.
As a result there are a huge number of calls to error_setg_internal
on startup of most QEMU commands, making it very painful to set a
breakpoint on this method.
Most callers of object_find_property and object_class_find_property,
however, pass in a NULL for the Error parameter. This simplifies the
methods to remove the Error parameter entirely, and then adds some
new wrapper methods that are able to raise an Error when needed.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20200914135617.1493072-1-berrange@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Diffstat (limited to 'target')
-rw-r--r-- | target/arm/monitor.c | 2 | ||||
-rw-r--r-- | target/i386/cpu.c | 2 | ||||
-rw-r--r-- | target/ppc/translate_init.c.inc | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/target/arm/monitor.c b/target/arm/monitor.c index ba6e01abd0..375f34bfaa 100644 --- a/target/arm/monitor.c +++ b/target/arm/monitor.c @@ -214,7 +214,7 @@ CpuModelExpansionInfo *qmp_query_cpu_model_expansion(CpuModelExpansionType type, i = 0; while ((name = cpu_model_advertised_features[i++]) != NULL) { - ObjectProperty *prop = object_property_find(obj, name, NULL); + ObjectProperty *prop = object_property_find(obj, name); if (prop) { QObject *value; diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 1c58f764dc..3ffd877dd5 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -6828,7 +6828,7 @@ static void x86_cpu_register_bit_prop(X86CPU *cpu, ObjectProperty *op; uint64_t mask = (1ULL << bitnr); - op = object_property_find(OBJECT(cpu), prop_name, NULL); + op = object_property_find(OBJECT(cpu), prop_name); if (op) { fp = op->opaque; assert(fp->w == w); diff --git a/target/ppc/translate_init.c.inc b/target/ppc/translate_init.c.inc index accb4f2fae..bb66526280 100644 --- a/target/ppc/translate_init.c.inc +++ b/target/ppc/translate_init.c.inc @@ -10478,7 +10478,7 @@ static void ppc_cpu_parse_featurestr(const char *type, char *features, return; } - if (object_property_find(machine, "max-cpu-compat", NULL)) { + if (object_property_find(machine, "max-cpu-compat")) { int i; char **inpieces; char *s = features; |