[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC 6/6] linux-user: support -plugin option
From: |
Emilio G. Cota |
Subject: |
[Qemu-devel] [RFC 6/6] linux-user: support -plugin option |
Date: |
Wed, 6 Sep 2017 16:28:48 -0400 |
From: Lluís Vilanova <address@hidden>
Signed-off-by: Lluís Vilanova <address@hidden>
[ cota: s/instrument/plugin ]
Signed-off-by: Emilio G. Cota <address@hidden>
---
linux-user/main.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/linux-user/main.c b/linux-user/main.c
index 31c8f1a..211ee02 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -27,6 +27,7 @@
#include "qemu/config-file.h"
#include "qemu/cutils.h"
#include "qemu/help_option.h"
+#include "qemu/plugin.h"
#include "cpu.h"
#include "exec/exec-all.h"
#include "tcg.h"
@@ -4014,6 +4015,15 @@ static void handle_arg_trace(const char *arg)
trace_file = trace_opt_parse(arg);
}
+static struct qemu_plugin_list plugins = QTAILQ_HEAD_INITIALIZER(plugins);
+
+#ifdef CONFIG_PLUGINS
+static void handle_arg_plugin(const char *arg)
+{
+ qemu_plugin_opt_parse(arg, &plugins);
+}
+#endif
+
struct qemu_argument {
const char *argv;
const char *env;
@@ -4063,6 +4073,10 @@ static const struct qemu_argument arg_table[] = {
"", "Seed for pseudo-random number generator"},
{"trace", "QEMU_TRACE", true, handle_arg_trace,
"", "[[enable=]<pattern>][,events=<file>][,file=<file>]"},
+#ifdef CONFIG_PLUGINS
+ {"plugin", "QEMU_PLUGIN", true, handle_arg_plugin,
+ "", "[file=]<file>[,arg=<string>]"},
+#endif
{"version", "QEMU_VERSION", false, handle_arg_version,
"", "display version information and exit"},
{NULL, NULL, false, NULL, NULL, NULL}
@@ -4252,6 +4266,7 @@ int main(int argc, char **argv, char **envp)
srand(time(NULL));
qemu_add_opts(&qemu_trace_opts);
+ qemu_plugin_add_opts();
optind = parse_args(argc, argv);
@@ -4259,6 +4274,9 @@ int main(int argc, char **argv, char **envp)
exit(1);
}
trace_init_file(trace_file);
+ if (qemu_plugin_load_list(&plugins)) {
+ exit(1);
+ }
/* Zero out regs */
memset(regs, 0, sizeof(struct target_pt_regs));
--
2.7.4
- [Qemu-devel] [RFC 0/6] initial plugin support, Emilio G. Cota, 2017/09/06
- [Qemu-devel] [RFC 6/6] linux-user: support -plugin option,
Emilio G. Cota <=
- [Qemu-devel] [RFC 3/6] configure: add --enable-plugins, Emilio G. Cota, 2017/09/06
- [Qemu-devel] [RFC 4/6] Makefile: install qemu-api.h as include/qemu-plugin.h, Emilio G. Cota, 2017/09/06
- [Qemu-devel] [RFC 5/6] vl: support -plugin option, Emilio G. Cota, 2017/09/06
- [Qemu-devel] [RFC 1/6] tcg: keep a pointer to the current TB in TCGContext, Emilio G. Cota, 2017/09/06
- [Qemu-devel] [RFC 2/6] plugin: add initial plugin support, Emilio G. Cota, 2017/09/06
- Re: [Qemu-devel] [RFC 0/6] initial plugin support, Peter Maydell, 2017/09/14
- Re: [Qemu-devel] [RFC 0/6] initial plugin support, Stefan Hajnoczi, 2017/09/18