[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v4 45/54] linux-user: support -plugin option
From: |
Alex Bennée |
Subject: |
[Qemu-devel] [PATCH v4 45/54] linux-user: support -plugin option |
Date: |
Wed, 31 Jul 2019 17:07:10 +0100 |
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>
Reviewed-by: Richard Henderson <address@hidden>
Signed-off-by: Alex Bennée <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 8ffc5251955..42daa47dd3c 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -33,6 +33,7 @@
#include "qemu/error-report.h"
#include "qemu/help_option.h"
#include "qemu/module.h"
+#include "qemu/plugin.h"
#include "cpu.h"
#include "exec/exec-all.h"
#include "tcg.h"
@@ -392,6 +393,15 @@ static void handle_arg_trace(const char *arg)
trace_file = trace_opt_parse(arg);
}
+static QemuPluginList 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;
@@ -443,6 +453,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}
@@ -633,6 +647,7 @@ int main(int argc, char **argv, char **envp)
cpu_model = NULL;
qemu_add_opts(&qemu_trace_opts);
+ qemu_plugin_add_opts();
optind = parse_args(argc, argv);
@@ -640,6 +655,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.20.1
- [Qemu-devel] [PATCH v4 10/54] translate-all: use cpu_in_exclusive_work_context() in tb_flush, (continued)
- [Qemu-devel] [PATCH v4 10/54] translate-all: use cpu_in_exclusive_work_context() in tb_flush, Alex Bennée, 2019/07/31
- [Qemu-devel] [PATCH v4 05/54] includes: remove stale [smp|max]_cpus externs, Alex Bennée, 2019/07/31
- [Qemu-devel] [PATCH v4 08/54] tcg/README: fix typo s/afterwise/afterwards/, Alex Bennée, 2019/07/31
- [Qemu-devel] [PATCH v4 12/54] configure: add --enable-plugins (MOVE TO END), Alex Bennée, 2019/07/31
- [Qemu-devel] [PATCH v4 13/54] plugin: add user-facing API, Alex Bennée, 2019/07/31
- [Qemu-devel] [PATCH v4 09/54] cpu: introduce cpu_in_exclusive_context(), Alex Bennée, 2019/07/31
- [Qemu-devel] [PATCH v4 11/54] docs/devel: add plugins.rst design document, Alex Bennée, 2019/07/31
- [Qemu-devel] [PATCH v4 29/54] plugin-gen: add plugin_insn_append, Alex Bennée, 2019/07/31
- [Qemu-devel] [PATCH v4 14/54] plugin: add core code, Alex Bennée, 2019/07/31
- [Qemu-devel] [PATCH v4 07/54] trace: add mmu_index to mem_info, Alex Bennée, 2019/07/31
- [Qemu-devel] [PATCH v4 45/54] linux-user: support -plugin option,
Alex Bennée <=
- [Qemu-devel] [PATCH v4 53/54] include/exec: wrap cpu_ldst.h in CONFIG_TCG, Alex Bennée, 2019/07/31
- [Qemu-devel] [PATCH v4 33/54] target/sh4: fetch code with translator_ld, Alex Bennée, 2019/07/31
- [Qemu-devel] [PATCH v4 42/54] translator: inject instrumentation from plugins, Alex Bennée, 2019/07/31
- [Qemu-devel] [PATCH v4 19/54] tcg: add tcg_gen_st_ptr, Alex Bennée, 2019/07/31
- [Qemu-devel] [PATCH v4 54/54] include/exec/cpu-defs.h: fix typo, Alex Bennée, 2019/07/31
- [Qemu-devel] [PATCH v4 40/54] target/xtensa: fetch code with translator_ld, Alex Bennée, 2019/07/31
- [Qemu-devel] [PATCH v4 31/54] target/arm: fetch code with translator_ld, Alex Bennée, 2019/07/31
- [Qemu-devel] [PATCH v4 30/54] translator: add translator_ld{ub, sw, uw, l, q}, Alex Bennée, 2019/07/31
- [Qemu-devel] [PATCH v4 39/54] target/sparc: fetch code with translator_ld, Alex Bennée, 2019/07/31
- [Qemu-devel] [PATCH v4 18/54] cputlb: introduce get_page_addr_code_hostp, Alex Bennée, 2019/07/31