[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v6 08/22] instrument: [hmp] Add library loader
From: |
Lluís Vilanova |
Subject: |
[Qemu-devel] [PATCH v6 08/22] instrument: [hmp] Add library loader |
Date: |
Wed, 13 Sep 2017 13:25:58 +0300 |
User-agent: |
StGit/0.18 |
Signed-off-by: Lluís Vilanova <address@hidden>
---
hmp-commands.hx | 32 ++++++++++++++++++++++++++++++++
monitor.c | 39 +++++++++++++++++++++++++++++++++++++++
2 files changed, 71 insertions(+)
diff --git a/hmp-commands.hx b/hmp-commands.hx
index 1941e19932..2e8ebe8422 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -1858,6 +1858,38 @@ ETEXI
.sub_table = info_cmds,
},
+#ifdef CONFIG_INSTRUMENT
+ {
+ .name = "instr-load",
+ .args_type = "path:F,id:s?,arg:s?",
+ .params = "path [id] [arg]",
+ .help = "load an instrumentation library",
+ .cmd = hmp_instr_load,
+ },
+#endif
+
+STEXI
address@hidden instr-load @var{path} address@hidden address@hidden
address@hidden instr-load
+Load an instrumentation library.
+ETEXI
+
+#ifdef CONFIG_INSTRUMENT
+ {
+ .name = "instr-unload",
+ .args_type = "id:s",
+ .params = "id",
+ .help = "unload an instrumentation library",
+ .cmd = hmp_instr_unload,
+ },
+#endif
+
+STEXI
address@hidden instr-unload
address@hidden instr-unload
+Unload an instrumentation library.
+ETEXI
+
STEXI
@end table
ETEXI
diff --git a/monitor.c b/monitor.c
index e031aa2687..7b80d5351f 100644
--- a/monitor.c
+++ b/monitor.c
@@ -2323,6 +2323,45 @@ int monitor_fd_param(Monitor *mon, const char *fdname,
Error **errp)
return fd;
}
+#ifdef CONFIG_INSTRUMENT
+static void hmp_instr_load(Monitor *mon, const QDict *qdict)
+{
+ Error *err = NULL;
+ const char *path = qdict_get_str(qdict, "path");
+ const char *id = qdict_get_try_str(qdict, "id");
+ const char *str = qdict_get_try_str(qdict, "arg");
+ strList args;
+
+ args.value = (char *)str;
+ args.next = NULL;
+
+ InstrLoadResult *res = qmp_instr_load(path,
+ id != NULL, id,
+ args.value != NULL, &args,
+ &err);
+ if (err) {
+ error_report_err(err);
+ } else {
+ monitor_printf(mon, "Handle: %s\n", res->id);
+ monitor_printf(mon, "OK\n");
+ }
+ qapi_free_InstrLoadResult(res);
+}
+
+static void hmp_instr_unload(Monitor *mon, const QDict *qdict)
+{
+ Error *err = NULL;
+ const char *id = qdict_get_str(qdict, "id");
+
+ qmp_instr_unload(id, &err);
+ if (err) {
+ error_report_err(err);
+ } else {
+ monitor_printf(mon, "OK\n");
+ }
+}
+#endif
+
/* Please update hmp-commands.hx when adding or changing commands */
static mon_cmd_t info_cmds[] = {
#include "hmp-commands-info.h"
- [Qemu-devel] [PATCH v6 00/22] instrument: Add basic event instrumentation, Lluís Vilanova, 2017/09/13
- [Qemu-devel] [PATCH v6 01/22] instrument: Add documentation, Lluís Vilanova, 2017/09/13
- [Qemu-devel] [PATCH v6 02/22] instrument: Add configure-time flag, Lluís Vilanova, 2017/09/13
- [Qemu-devel] [PATCH v6 03/22] instrument: Add generic library loader, Lluís Vilanova, 2017/09/13
- [Qemu-devel] [PATCH v6 04/22] instrument: [linux-user] Add command line library loader, Lluís Vilanova, 2017/09/13
- [Qemu-devel] [PATCH v6 05/22] instrument: [bsd-user] Add command line library loader, Lluís Vilanova, 2017/09/13
- [Qemu-devel] [PATCH v6 06/22] instrument: [softmmu] Add command line library loader, Lluís Vilanova, 2017/09/13
- [Qemu-devel] [PATCH v6 07/22] instrument: [qapi] Add library loader, Lluís Vilanova, 2017/09/13
- [Qemu-devel] [PATCH v6 08/22] instrument: [hmp] Add library loader,
Lluís Vilanova <=
- [Qemu-devel] [PATCH v6 09/22] instrument: Add basic control interface, Lluís Vilanova, 2017/09/13
- [Qemu-devel] [PATCH v6 10/22] instrument: Add support for tracing events, Lluís Vilanova, 2017/09/13
- [Qemu-devel] [PATCH v6 11/22] instrument: Track vCPUs, Lluís Vilanova, 2017/09/13
- [Qemu-devel] [PATCH v6 12/22] instrument: Add event 'guest_cpu_enter', Lluís Vilanova, 2017/09/13
- [Qemu-devel] [PATCH v6 13/22] instrument: Support synchronous modification of vCPU state, Lluís Vilanova, 2017/09/13
- [Qemu-devel] [PATCH v6 14/22] exec: Add function to synchronously flush TB on a stopped vCPU, Lluís Vilanova, 2017/09/13
- [Qemu-devel] [PATCH v6 15/22] instrument: Add event 'guest_cpu_exit', Lluís Vilanova, 2017/09/13
- [Qemu-devel] [PATCH v6 16/22] instrument: Add event 'guest_cpu_reset', Lluís Vilanova, 2017/09/13
- [Qemu-devel] [PATCH v6 17/22] trace: Introduce a proper structure to describe memory accesses, Lluís Vilanova, 2017/09/13
- [Qemu-devel] [PATCH v6 18/22] instrument: Add event 'guest_mem_before_trans', Lluís Vilanova, 2017/09/13