diff mbox series

hmp: display qdev canonical path in 'info qtree'

Message ID 4C23C17B8E87E74E906A25A3254A03F401F8166AE7@SHASXM03.verisilicon.com (mailing list archive)
State New, archived
Headers show
Series hmp: display qdev canonical path in 'info qtree' | expand

Commit Message

Jianxian Wen Aug. 16, 2024, 8:06 a.m. UTC
It is difficult to identify a specific instance when there are multiple
instances of the same type in the output of 'info qom-tree'.
However, in 'info qtree', we can find the specific instance using
the DeviceState->id or mmio info. To facilitate locating instances
in the output of the 'info qom-tree', the canonical path is added to
the output of the 'info qtree'.

Signed-off-by: Jianxian Wen <jianxian.wen@verisilicon.com>
Signed-off-by: Lu Gao <lu.gao@verisilicon.com>
---
 system/qdev-monitor.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/system/qdev-monitor.c b/system/qdev-monitor.c
index 6af6ef7d66..22a2e2fae8 100644
--- a/system/qdev-monitor.c
+++ b/system/qdev-monitor.c
@@ -785,6 +785,7 @@  static void qdev_print(Monitor *mon, DeviceState *dev, int indent)
     ObjectClass *class;
     NamedGPIOList *ngl;
     NamedClockList *ncl;
+    g_autofree char *qom_path = object_get_canonical_path(OBJECT(dev));
 
     QLIST_FOREACH(ngl, &dev->gpios, node) {
         if (ngl->num_in) {
@@ -809,6 +810,7 @@  static void qdev_print(Monitor *mon, DeviceState *dev, int indent)
         class = object_class_get_parent(class);
     } while (class != object_class_by_name(TYPE_DEVICE));
     bus_print_dev(dev->parent_bus, mon, dev, indent);
+    qdev_printf("qom-path %s\n", qom_path);
 }
 
 static void qbus_print(Monitor *mon, BusState *bus, int indent, bool details)