[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC v2 37/38] linux-user: support -plugin option
From: |
Emilio G. Cota |
Subject: |
[Qemu-devel] [RFC v2 37/38] linux-user: support -plugin option |
Date: |
Sun, 9 Dec 2018 14:37:48 -0500 |
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 923cbb753a..482766f0f4 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -28,6 +28,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"
@@ -385,6 +386,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_PLUGIN
+static void handle_arg_plugin(const char *arg)
+{
+ qemu_plugin_opt_parse(arg, &plugins);
+}
+#endif
+
struct qemu_argument {
const char *argv;
const char *env;
@@ -436,6 +446,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_PLUGIN
+ {"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}
@@ -627,6 +641,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);
@@ -634,6 +649,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.17.1
- [Qemu-devel] [RFC v2 14/38] atomic_template: add inline trace/plugin helpers, (continued)
- [Qemu-devel] [RFC v2 14/38] atomic_template: add inline trace/plugin helpers, Emilio G. Cota, 2018/12/09
- [Qemu-devel] [RFC v2 17/38] *-user: notify plugin of exit, Emilio G. Cota, 2018/12/09
- [Qemu-devel] [RFC v2 13/38] atomic_template: fix indentation in GEN_ATOMIC_HELPER, Emilio G. Cota, 2018/12/09
- [Qemu-devel] [RFC v2 18/38] *-user: plugin syscalls, Emilio G. Cota, 2018/12/09
- [Qemu-devel] [RFC v2 15/38] tcg: let plugins instrument memory accesses, Emilio G. Cota, 2018/12/09
- [Qemu-devel] [RFC v2 24/38] target/sh4: fetch code with translator_ld (WIP), Emilio G. Cota, 2018/12/09
- [Qemu-devel] [RFC v2 21/38] translator: add translator_ld{ub, sw, uw, l, q}, Emilio G. Cota, 2018/12/09
- [Qemu-devel] [RFC v2 10/38] plugin-gen: add module for TCG-related code, Emilio G. Cota, 2018/12/09
- [Qemu-devel] [RFC v2 25/38] target/i386: fetch code with translator_ld, Emilio G. Cota, 2018/12/09
- [Qemu-devel] [RFC v2 38/38] tests/plugin: add sample plugins, Emilio G. Cota, 2018/12/09
- [Qemu-devel] [RFC v2 37/38] linux-user: support -plugin option,
Emilio G. Cota <=
- [Qemu-devel] [RFC v2 27/38] target/m68k: fetch code with translator_ld, Emilio G. Cota, 2018/12/09
- [Qemu-devel] [RFC v2 29/38] target/riscv: fetch code with translator_ld, Emilio G. Cota, 2018/12/09
- [Qemu-devel] [RFC v2 22/38] target/arm: call qemu_plugin_insn_append, Emilio G. Cota, 2018/12/09
- [Qemu-devel] [RFC v2 08/38] tcg: drop nargs from tcg_op_insert_{before, after}, Emilio G. Cota, 2018/12/09
- [Qemu-devel] [RFC v2 19/38] cpu: hook plugin vcpu events, Emilio G. Cota, 2018/12/09
- [Qemu-devel] [RFC v2 20/38] plugin-gen: add plugin_insn_append, Emilio G. Cota, 2018/12/09
- [Qemu-devel] [RFC v2 35/38] configure: add --enable-plugins, Emilio G. Cota, 2018/12/09
- [Qemu-devel] [RFC v2 28/38] target/alpha: fetch code with translator_ld, Emilio G. Cota, 2018/12/09
- [Qemu-devel] [RFC v2 26/38] target/hppa: fetch code with translator_ld, Emilio G. Cota, 2018/12/09