[PATCH] hmp: display qdev canonical path in 'info qtree'

Jianxian Wen via posted 1 patch 3 months, 1 week ago
system/qdev-monitor.c | 2 ++
1 file changed, 2 insertions(+)
[PATCH] hmp: display qdev canonical path in 'info qtree'
Posted by Jianxian Wen via 3 months, 1 week ago
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 --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)
-- 
2.17.1