diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2015-03-17 15:23:23 +0000 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2015-03-17 15:23:23 +0000 |
commit | 1a87e52770ca64f5a09e9c46d29ea3b5a5db5ffd (patch) | |
tree | 905e1bf4bbf8f48e435097807e8c49d67f7262da /qdev-monitor.c | |
parent | 5a4992834daec85c3913654903fb9f4f954e585a (diff) | |
parent | 88950eeff59834b3b4bea98b954a3fe854468ae3 (diff) | |
download | qemu-1a87e52770ca64f5a09e9c46d29ea3b5a5db5ffd.zip qemu-1a87e52770ca64f5a09e9c46d29ea3b5a5db5ffd.tar.gz qemu-1a87e52770ca64f5a09e9c46d29ea3b5a5db5ffd.tar.bz2 |
Merge remote-tracking branch 'remotes/afaerber/tags/qom-devices-for-peter' into staging
QOM infrastructure fixes and device conversions
* Conversion of cadence_uart to QOM realize
* qom-tree QMP script
* qom-list and qom-set HMP commands to match their QMP counterparts
* Basic qom-tree HMP command
* Cleanups for /machine QOM composition tree
# gpg: Signature made Tue Mar 17 15:02:57 2015 GMT using RSA key ID 3E7E013F
# gpg: Good signature from "Andreas Färber <afaerber@suse.de>"
# gpg: aka "Andreas Färber <afaerber@suse.com>"
* remotes/afaerber/tags/qom-devices-for-peter:
qdev: Move owner-less IRQs to /machine/unattached
memory: Move owner-less MemoryRegions to /machine/unattached
qom: Implement info qom-tree HMP command
qom: Implement qom-set HMP command
qom: Implement qom-list HMP command
scripts: Add qom-tree script
cadence_uart: Convert to QOM realize()
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'qdev-monitor.c')
-rw-r--r-- | qdev-monitor.c | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/qdev-monitor.c b/qdev-monitor.c index 5d30ac5..1d87f57 100644 --- a/qdev-monitor.c +++ b/qdev-monitor.c @@ -678,6 +678,63 @@ void hmp_info_qdm(Monitor *mon, const QDict *qdict) qdev_print_devinfos(true); } +typedef struct QOMCompositionState { + Monitor *mon; + int indent; +} QOMCompositionState; + +static void print_qom_composition(Monitor *mon, Object *obj, int indent); + +static int print_qom_composition_child(Object *obj, void *opaque) +{ + QOMCompositionState *s = opaque; + + print_qom_composition(s->mon, obj, s->indent); + + return 0; +} + +static void print_qom_composition(Monitor *mon, Object *obj, int indent) +{ + QOMCompositionState s = { + .mon = mon, + .indent = indent + 2, + }; + char *name; + + if (obj == object_get_root()) { + name = g_strdup(""); + } else { + name = object_get_canonical_path_component(obj); + } + monitor_printf(mon, "%*s/%s (%s)\n", indent, "", name, + object_get_typename(obj)); + g_free(name); + object_child_foreach(obj, print_qom_composition_child, &s); +} + +void hmp_info_qom_tree(Monitor *mon, const QDict *dict) +{ + const char *path = qdict_get_try_str(dict, "path"); + Object *obj; + bool ambiguous = false; + + if (path) { + obj = object_resolve_path(path, &ambiguous); + if (!obj) { + monitor_printf(mon, "Path '%s' could not be resolved.\n", path); + return; + } + if (ambiguous) { + monitor_printf(mon, "Warning: Path '%s' is ambiguous.\n", path); + return; + } + } else { + obj = qdev_get_machine(); + } + print_qom_composition(mon, obj, 0); +} + int do_device_add(Monitor *mon, const QDict *qdict, QObject **ret_data) { Error *local_err = NULL; |