On 3/5/18 3:40 pm, Alexey Kardashevskiy wrote: > On 30/4/18 7:53 pm, Paolo Bonzini wrote: >> On 30/04/2018 08:25, Alexey Kardashevskiy wrote: >>> + DeviceState *dev = (DeviceState *) object_dynamic_cast(obj, >>> TYPE_DEVICE); >>> + const char *id = object_property_print(obj, "id", true, NULL); >> >> The only objects that have an "id" property are memdevs. If you want to >> special case their printing too, it's probably a good idea (that is, >> print one of "dev id=ID"/"memdev id=ID"/"obj path=PATH"). >> >> Otherwise, I can also queue this patch as is, but I'd remove the "id" >> property handling because I'm going to submit a small series to remove >> the "id" property altogether. >> >> Let me know what you prefer! > > > I choose to wait and repost, thanks :)
I waited, checked https://git.qemu.org/?p=qemu.git;a=commitdiff;h=29de4e that "id" is no more and then grepped: hw/intc/apic_common.c|489| object_property_add(obj, "id", "uint32", hw/ppc/spapr_drc.c|557| object_property_add_uint32_ptr(obj, "id", &drc->id, NULL); This does not look like "remove the "id" property altogether" :) Does this mean we still rather want to print QOM's "id"? spapr_drc does not own MRs and APIC seems not to either. > > >> >> Thanks, >> >> Paolo >> >>> + mon_printf(f, " %s:{%s", label, dev ? "dev" : "obj"); >>> + if (dev ? dev->id : id) { >>> + mon_printf(f, " id=%s", dev ? dev->id : id); >>> + } else { >>> + gchar *canonical_path = object_get_canonical_path(obj); >>> + mon_printf(f, " path=%s", canonical_path); >>> + g_free(canonical_path); >>> + } >>> + mon_printf(f, "}"); >> > > -- Alexey