> From: Aaron Lindsay [mailto:aclin...@gmail.com] > On Sep 10 14:41, Pavel Dovgalyuk wrote: > > From: Alex Bennée [mailto:alex.ben...@linaro.org] > > > Currently this is only available to system mode emulation. Can it be > > > extended to include linux-user as well? > > > > Why not? I'm not familiar with linux-user, so I'll need some time to try. > > Yes. In fact, your existing setup made it quite simple:
Thank you. Pavel Dovgalyuk > > > Subject: [PATCH] plugin: Add linux-user support > > Signed-off-by: Aaron Lindsay <aclin...@gmail.com> > --- > linux-user/main.c | 13 +++++++++++++ > 1 file changed, 13 insertions(+) > > diff --git a/linux-user/main.c b/linux-user/main.c > index 923cbb753a..4c70f9f8c5 100644 > --- a/linux-user/main.c > +++ b/linux-user/main.c > @@ -37,6 +37,7 @@ > #include "trace/control.h" > #include "target_elf.h" > #include "cpu_loop-common.h" > +#include "qemu/plugins.h" > > char *exec_path; > > @@ -385,6 +386,11 @@ static void handle_arg_trace(const char *arg) > trace_file = trace_opt_parse(arg); > } > > +static void handle_arg_plugin(const char *arg) > +{ > + qemu_plugin_parse_cmd_args(arg); > +} > + > struct qemu_argument { > const char *argv; > const char *env; > @@ -436,6 +442,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=<plugin_so>[,args=<args>]"}, > +#endif > {"version", "QEMU_VERSION", false, handle_arg_version, > "", "display version information and exit"}, > {NULL, NULL, false, NULL, NULL, NULL} > @@ -816,6 +826,9 @@ int main(int argc, char **argv, char **envp) > } > gdb_handlesig(cpu, 0); > } > + > + qemu_plugins_init(); > + > cpu_loop(env); > /* never exits */ > return 0; > -- > 2.19.0