From: Pavel Butsykin <[email protected]>
Signed-off-by: Pavel Butsykin <[email protected]>
Signed-off-by: Denis V. Lunev <[email protected]>
CC: Stefan Hajnoczi <[email protected]>
CC: Paolo Bonzini <[email protected]>
CC: Luiz Capitulino <[email protected]>
CC: Markus Armbruster <[email protected]>
CC: Eric Blake <[email protected]>
---
include/qemu/log.h | 1 +
monitor.c | 4 ++++
util/log.c | 2 ++
3 files changed, 7 insertions(+)
diff --git a/include/qemu/log.h b/include/qemu/log.h
index 55bceae..9264bbf 100644
--- a/include/qemu/log.h
+++ b/include/qemu/log.h
@@ -43,6 +43,7 @@ static inline bool qemu_log_separate(void)
#define CPU_LOG_PAGE (1 << 14)
#define LOG_TRACE (1 << 15)
#define LOG_QMP (1 << 16)
+#define LOG_HMP (1 << 17)
/* Returns true if a bit is set in the current loglevel mask
*/
diff --git a/monitor.c b/monitor.c
index eec4e58..4bf4f31 100644
--- a/monitor.c
+++ b/monitor.c
@@ -2893,6 +2893,8 @@ static void handle_hmp_command(Monitor *mon, const char
*cmdline)
QDict *qdict;
const mon_cmd_t *cmd;
+ qemu_log_mask(LOG_HMP, "HMP command: %s\n", cmdline);
+
cmd = monitor_parse_command(mon, &cmdline, mon->cmd_table);
if (!cmd) {
return;
@@ -4053,11 +4055,13 @@ static void monitor_event(void *opaque, int event)
}
mon->reset_seen = 1;
mon_refcount++;
+ qemu_log_mask(LOG_HMP, "HMP: new connection established\n");
break;
case CHR_EVENT_CLOSED:
mon_refcount--;
monitor_fdsets_cleanup();
+ qemu_log_mask(LOG_HMP, "HMP: connection closed\n");
break;
}
}
diff --git a/util/log.c b/util/log.c
index 5fc517b..795aaea 100644
--- a/util/log.c
+++ b/util/log.c
@@ -133,6 +133,8 @@ const QEMULogItem qemu_log_items[] = {
"complete traces" },
{ LOG_QMP, "qmp",
"log the QMP commands and events" },
+ { LOG_HMP, "hmp",
+ "log the HMP commands and events" },
{ 0, NULL, NULL },
};
--
2.5.0