qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
To: qemu-devel@nongnu.org
Cc: armbru@redhat.com, vsementsov@virtuozzo.com
Subject: [PATCH] monitor: trace qmp_send_response
Date: Fri,  5 Feb 2021 01:24:44 +0300	[thread overview]
Message-ID: <20210204222444.22217-1-vsementsov@virtuozzo.com> (raw)

Add a useful counterpart for trace_handle_qmp_command for debugging
libvirt guests.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---
 monitor/qmp.c        | 6 ++++++
 monitor/trace-events | 1 +
 2 files changed, 7 insertions(+)

diff --git a/monitor/qmp.c b/monitor/qmp.c
index 8f91af32be..772b9e7b30 100644
--- a/monitor/qmp.c
+++ b/monitor/qmp.c
@@ -111,6 +111,12 @@ void qmp_send_response(MonitorQMP *mon, const QDict *rsp)
     const QObject *data = QOBJECT(rsp);
     GString *json;
 
+    if (trace_event_get_state_backends(TRACE_QMP_SEND_RESPONSE)) {
+        json = qobject_to_json(data);
+        trace_qmp_send_response(mon, json->str);
+        g_string_free(json, true);
+    }
+
     json = qobject_to_json_pretty(data, mon->pretty);
     assert(json != NULL);
 
diff --git a/monitor/trace-events b/monitor/trace-events
index 0365ac4d99..12f0576c7b 100644
--- a/monitor/trace-events
+++ b/monitor/trace-events
@@ -13,3 +13,4 @@ monitor_suspend(void *ptr, int cnt) "mon %p: %d"
 monitor_qmp_cmd_in_band(const char *id) "%s"
 monitor_qmp_cmd_out_of_band(const char *id) "%s"
 handle_qmp_command(void *mon, const char *req) "mon %p req: %s"
+qmp_send_response(void *mon, const char *req) "mon %p req: %s"
-- 
2.29.2



             reply	other threads:[~2021-02-04 22:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-04 22:24 Vladimir Sementsov-Ogievskiy [this message]
2021-02-05  7:56 ` [PATCH] monitor: trace qmp_send_response Markus Armbruster
2021-02-05  8:17   ` Vladimir Sementsov-Ogievskiy
2021-02-05 13:46     ` Markus Armbruster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210204222444.22217-1-vsementsov@virtuozzo.com \
    --to=vsementsov@virtuozzo.com \
    --cc=armbru@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).