[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 25/43] hmp: Add option to info qtree to omit details
From: |
Philippe Mathieu-Daudé |
Subject: |
[PULL 25/43] hmp: Add option to info qtree to omit details |
Date: |
Sat, 9 Mar 2024 20:21:52 +0100 |
From: BALATON Zoltan <balaton@eik.bme.hu>
The output of info qtree monitor command is very long. Add an option
to print a brief overview omitting all the details.
Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Reviewed-by: Dr. David Alan Gilbert <dave@treblig.org>
Message-ID: <20240307183812.0105D4E6004@zero.eik.bme.hu>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
system/qdev-monitor.c | 27 +++++++++++++++------------
hmp-commands-info.hx | 6 +++---
2 files changed, 18 insertions(+), 15 deletions(-)
diff --git a/system/qdev-monitor.c b/system/qdev-monitor.c
index a13db763e5..ad91e74181 100644
--- a/system/qdev-monitor.c
+++ b/system/qdev-monitor.c
@@ -744,7 +744,6 @@ DeviceState *qdev_device_add(QemuOpts *opts, Error **errp)
}
#define qdev_printf(fmt, ...) monitor_printf(mon, "%*s" fmt, indent, "", ##
__VA_ARGS__)
-static void qbus_print(Monitor *mon, BusState *bus, int indent);
static void qdev_print_props(Monitor *mon, DeviceState *dev, Property *props,
int indent)
@@ -784,13 +783,9 @@ static void bus_print_dev(BusState *bus, Monitor *mon,
DeviceState *dev, int ind
static void qdev_print(Monitor *mon, DeviceState *dev, int indent)
{
ObjectClass *class;
- BusState *child;
NamedGPIOList *ngl;
NamedClockList *ncl;
- qdev_printf("dev: %s, id \"%s\"\n", object_get_typename(OBJECT(dev)),
- dev->id ? dev->id : "");
- indent += 2;
QLIST_FOREACH(ngl, &dev->gpios, node) {
if (ngl->num_in) {
qdev_printf("gpio-in \"%s\" %d\n", ngl->name ? ngl->name : "",
@@ -814,12 +809,9 @@ 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);
- QLIST_FOREACH(child, &dev->child_bus, sibling) {
- qbus_print(mon, child, indent);
- }
}
-static void qbus_print(Monitor *mon, BusState *bus, int indent)
+static void qbus_print(Monitor *mon, BusState *bus, int indent, bool details)
{
BusChild *kid;
@@ -827,16 +819,27 @@ static void qbus_print(Monitor *mon, BusState *bus, int
indent)
indent += 2;
qdev_printf("type %s\n", object_get_typename(OBJECT(bus)));
QTAILQ_FOREACH(kid, &bus->children, sibling) {
+ BusState *child_bus;
DeviceState *dev = kid->child;
- qdev_print(mon, dev, indent);
+ qdev_printf("dev: %s, id \"%s\"\n", object_get_typename(OBJECT(dev)),
+ dev->id ? dev->id : "");
+ if (details) {
+ qdev_print(mon, dev, indent + 2);
+ }
+ QLIST_FOREACH(child_bus, &dev->child_bus, sibling) {
+ qbus_print(mon, child_bus, indent + 2, details);
+ }
}
}
#undef qdev_printf
void hmp_info_qtree(Monitor *mon, const QDict *qdict)
{
- if (sysbus_get_default())
- qbus_print(mon, sysbus_get_default(), 0);
+ bool details = !qdict_get_try_bool(qdict, "brief", false);
+
+ if (sysbus_get_default()) {
+ qbus_print(mon, sysbus_get_default(), 0, details);
+ }
}
void hmp_info_qdm(Monitor *mon, const QDict *qdict)
diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx
index da120f82a3..ad1b1306e3 100644
--- a/hmp-commands-info.hx
+++ b/hmp-commands-info.hx
@@ -540,9 +540,9 @@ ERST
{
.name = "qtree",
- .args_type = "",
- .params = "",
- .help = "show device tree",
+ .args_type = "brief:-b",
+ .params = "[-b]",
+ .help = "show device tree (-b: brief, omit properties)",
.cmd = hmp_info_qtree,
},
--
2.41.0
- [PULL 15/43] hw/char/xen_console: Fix missing ERRP_GUARD() for error_prepend(), (continued)
- [PULL 15/43] hw/char/xen_console: Fix missing ERRP_GUARD() for error_prepend(), Philippe Mathieu-Daudé, 2024/03/09
- [PULL 16/43] hw/net/xen_nic: Fix missing ERRP_GUARD() for error_prepend(), Philippe Mathieu-Daudé, 2024/03/09
- [PULL 17/43] hw/remote/remote-obj: hw/misc/ivshmem: Fix missing ERRP_GUARD() for error_prepend(), Philippe Mathieu-Daudé, 2024/03/09
- [PULL 19/43] hw/i386/pc: Remove pc_compat_1_4..1.7[] left over declarations, Philippe Mathieu-Daudé, 2024/03/09
- [PULL 18/43] target/i386/sev: Fix missing ERRP_GUARD() for error_prepend(), Philippe Mathieu-Daudé, 2024/03/09
- [PULL 20/43] hw/i386/pc: Use generated NotifyVmexitOption_str(), Philippe Mathieu-Daudé, 2024/03/09
- [PULL 21/43] hw/i386/pc: Remove 'host_type' argument from pc_init1(), Philippe Mathieu-Daudé, 2024/03/09
- [PULL 22/43] hw/i386/pc: Have pc_init_isa() pass a NULL pci_type argument, Philippe Mathieu-Daudé, 2024/03/09
- [PULL 23/43] hw/intc/apic: fix memory leak, Philippe Mathieu-Daudé, 2024/03/09
- [PULL 24/43] qdev: Add a granule_mode property, Philippe Mathieu-Daudé, 2024/03/09
- [PULL 25/43] hmp: Add option to info qtree to omit details,
Philippe Mathieu-Daudé <=
- [PULL 26/43] mac_newworld: change timebase frequency from 100MHz to 25MHz for mac99 machine, Philippe Mathieu-Daudé, 2024/03/09
- [PULL 27/43] hw/intc/grlib_irqmp: abort realize when ncpus value is out of range, Philippe Mathieu-Daudé, 2024/03/09
- [PULL 29/43] docs/interop/firmware.json: Fix doc for FirmwareFlashMode, Philippe Mathieu-Daudé, 2024/03/09
- [PULL 28/43] docs/interop/firmware.json: Align examples, Philippe Mathieu-Daudé, 2024/03/09
- [PULL 31/43] hw/core/machine-smp: Deprecate unsupported "parameter=1" SMP configurations, Philippe Mathieu-Daudé, 2024/03/09
- [PULL 32/43] hw/core/machine-smp: Calculate total CPUs once in machine_parse_smp_config(), Philippe Mathieu-Daudé, 2024/03/09
- [PULL 34/43] tests/unit/test-smp-parse: Use CPU number macros in invalid topology case, Philippe Mathieu-Daudé, 2024/03/09
- [PULL 30/43] hw/core/machine-smp: Remove deprecated "parameter=0" SMP configurations, Philippe Mathieu-Daudé, 2024/03/09
- [PULL 35/43] tests/unit/test-smp-parse: Bump max_cpus to 4096, Philippe Mathieu-Daudé, 2024/03/09
- [PULL 39/43] tests/unit/test-smp-parse: Test "drawers" and "books" combination case, Philippe Mathieu-Daudé, 2024/03/09