From: Aaron Lindsay <aclindsa@gmail.com>
Signed-off-by: Aaron Lindsay <aclindsa@gmail.com>
[AJB: ifdeffery]
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
linux-user/main.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/linux-user/main.c b/linux-user/main.c
index a68674d0de..9fbb827fe0 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -38,6 +38,7 @@
#include "trace/control.h"
#include "target_elf.h"
#include "cpu_loop-common.h"
+#include "qemu/plugins.h"
char *exec_path;
@@ -393,6 +394,13 @@ static void handle_arg_trace(const char *arg)
trace_file = trace_opt_parse(arg);
}
+#ifdef CONFIG_TRACE_PLUGIN
+static void handle_arg_plugin(const char *arg)
+{
+ qemu_plugin_parse_cmd_args(arg);
+}
+#endif
+
struct qemu_argument {
const char *argv;
const char *env;
@@ -444,6 +452,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_TRACE_PLUGIN
+ {"plugin", "QEMU_PLUGIN", true, handle_arg_plugin,
+ "", "file=<plugin_so>[,args=<args>]"},
+#endif
{"version", "QEMU_VERSION", false, handle_arg_version,
"", "display version information and exit"},
{NULL, NULL, false, NULL, NULL, NULL}
@@ -830,6 +842,9 @@ int main(int argc, char **argv, char **envp)
}
gdb_handlesig(cpu, 0);
}
+
+ qemu_plugins_init();
+
cpu_loop(env);
/* never exits */
return 0;
--
2.17.1