qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2] Show values and description when using "qom-list"
@ 2018-06-01 15:39 Ricardo Perez Blanco
  2018-06-01 16:01 ` Eric Blake
  2018-06-02  7:20 ` Andreas Färber
  0 siblings, 2 replies; 14+ messages in thread
From: Ricardo Perez Blanco @ 2018-06-01 15:39 UTC (permalink / raw)
  Cc: Ricardo Perez Blanco, Dr. David Alan Gilbert, Eric Blake,
	Markus Armbruster, Andreas Färber,
	open list:All patches CC here

For debugging purposes it is very useful to:
 - See the description of the field. This information is already filled
   in but not shown in "qom-list" command.
 - Display value of the field.

Signed-off-by: Ricardo Perez Blanco <ricardo.perez_blanco@nokia.com>
---
 hmp.c          | 13 +++++++++++--
 qapi/misc.json |  6 ++++--
 qmp.c          |  7 +++++++
 qom/object.c   |  8 +++-----
 4 files changed, 25 insertions(+), 9 deletions(-)

diff --git a/hmp.c b/hmp.c
index a25c7bd9a8..ff3a024cd0 100644
--- a/hmp.c
+++ b/hmp.c
@@ -2490,8 +2490,17 @@ void hmp_qom_list(Monitor *mon, const QDict *qdict)
         while (list != NULL) {
             ObjectPropertyInfo *value = list->value;
 
-            monitor_printf(mon, "%s (%s)\n",
-                           value->name, value->type);
+            monitor_printf(mon, "%s", value->name);
+            if (value->has_value) {
+                monitor_printf(mon, "=%s", value->value);
+            }
+            monitor_printf(mon, " (%s)", value->type);
+            if (value->has_description) {
+                monitor_printf(mon, "\r\t\t\t\t\t\t\t\t\t[Description: %s]",
+                               value->description);
+            }
+            monitor_printf(mon, "\n");
+
             list = list->next;
         }
         qapi_free_ObjectPropertyInfoList(start);
diff --git a/qapi/misc.json b/qapi/misc.json
index 5636f4a149..b4bc472a37 100644
--- a/qapi/misc.json
+++ b/qapi/misc.json
@@ -1328,10 +1328,12 @@
 #
 # @description: if specified, the description of the property.
 #
-# Since: 1.2
+# @value: if specified, the value of the property.
+#
+# Since: 2.13
 ##
 { 'struct': 'ObjectPropertyInfo',
-  'data': { 'name': 'str', 'type': 'str', '*description': 'str' } }
+  'data': { 'name': 'str', 'type': 'str', '*description': 'str', '*value': 'str' } }
 
 ##
 # @qom-list:
diff --git a/qmp.c b/qmp.c
index f72261667f..39cf656f97 100644
--- a/qmp.c
+++ b/qmp.c
@@ -237,6 +237,13 @@ ObjectPropertyInfoList *qmp_qom_list(const char *path, Error **errp)
 
         entry->value->name = g_strdup(prop->name);
         entry->value->type = g_strdup(prop->type);
+        if (prop->description) {
+            entry->value->has_description = true;
+            entry->value->description = g_strdup(prop->description);
+        }
+        entry->value->has_value = true;
+        entry->value->value = g_strdup(object_property_print(obj,
+                                 entry->value->name, true, errp));
     }
 
     return props;
diff --git a/qom/object.c b/qom/object.c
index 467795189c..4d1606e5f9 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -1359,13 +1359,11 @@ char *object_property_print(Object *obj, const char *name, bool human,
     v = string_output_visitor_new(human, &string);
     object_property_get(obj, v, name, &local_err);
     if (local_err) {
-        error_propagate(errp, local_err);
-        goto out;
+        string = g_strdup("<Error reading value>");
+    } else {
+        visit_complete(v, &string);
     }
 
-    visit_complete(v, &string);
-
-out:
     visit_free(v);
     return string;
 }
-- 
2.16.3

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2018-07-02  6:37 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-01 15:39 [Qemu-devel] [PATCH v2] Show values and description when using "qom-list" Ricardo Perez Blanco
2018-06-01 16:01 ` Eric Blake
2018-06-11  7:18   ` Perez Blanco, Ricardo (Nokia - BE/Antwerp)
2018-06-02  7:20 ` Andreas Färber
2018-06-08  9:41   ` Dr. David Alan Gilbert
2018-06-08 16:19     ` Andreas Färber
2018-06-11  7:17       ` Perez Blanco, Ricardo (Nokia - BE/Antwerp)
2018-06-12  6:02       ` Markus Armbruster
2018-06-25 11:32         ` Markus Armbruster
2018-06-25 15:00           ` Dr. David Alan Gilbert
2018-06-25 18:42             ` Markus Armbruster
2018-06-29 12:17               ` Dr. David Alan Gilbert
2018-06-29 12:39                 ` Perez Blanco, Ricardo (Nokia - BE/Antwerp)
2018-07-02  6:36                 ` Markus Armbruster

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).