Message ID | 146658987563.20512.3974729430019474096.stgit@fimbulvetr.bsc.es |
---|---|
State | New |
Headers | show |
On Wed, Jun 22, 2016 at 12:04:35PM +0200, Lluís Vilanova wrote: > @@ -4047,6 +4064,12 @@ static const struct qemu_argument arg_table[] = { > "", "log system calls"}, > {"seed", "QEMU_RAND_SEED", true, handle_arg_randseed, > "", "Seed for pseudo-random number generator"}, > + {"trace-enable", "QEMU_TRACE_ENABLE",true, handle_arg_trace_enable, > + "name", "enable tracing of specified event names (pass 'help' to show a list of events)"}, > + {"trace-events", "QEMU_TRACE_EVENTS",true, handle_arg_trace_events, > + "eventsfile", "enable tracing of specified event names (one name/pattern per line)"}, > + {"trace-file", "QEMU_TRACE_FILE", true, handle_arg_trace_file, > + "tracefile", "output trace file"}, Riku: These command-line options differ from the qemu-system -trace option. Should there be consistency or does *-user do its own thing?
Stefan Hajnoczi writes: > On Wed, Jun 22, 2016 at 12:04:35PM +0200, Lluís Vilanova wrote: >> @@ -4047,6 +4064,12 @@ static const struct qemu_argument arg_table[] = { >> "", "log system calls"}, >> {"seed", "QEMU_RAND_SEED", true, handle_arg_randseed, >> "", "Seed for pseudo-random number generator"}, >> + {"trace-enable", "QEMU_TRACE_ENABLE",true, handle_arg_trace_enable, >> + "name", "enable tracing of specified event names (pass 'help' to show a list of events)"}, >> + {"trace-events", "QEMU_TRACE_EVENTS",true, handle_arg_trace_events, >> + "eventsfile", "enable tracing of specified event names (one name/pattern per line)"}, >> + {"trace-file", "QEMU_TRACE_FILE", true, handle_arg_trace_file, >> + "tracefile", "output trace file"}, > Riku: These command-line options differ from the qemu-system -trace > option. Should there be consistency or does *-user do its own thing? Do you mean it differs on semantics or on syntax? For the latter, *-user option parsers do not use the more flexible parser used in vl.c (each has their own much simpler implementation). Cheers, Lluis
On Wed, Jun 29, 2016 at 12:45:23PM +0200, Lluís Vilanova wrote: > Stefan Hajnoczi writes: > > > On Wed, Jun 22, 2016 at 12:04:35PM +0200, Lluís Vilanova wrote: > >> @@ -4047,6 +4064,12 @@ static const struct qemu_argument arg_table[] = { > >> "", "log system calls"}, > >> {"seed", "QEMU_RAND_SEED", true, handle_arg_randseed, > >> "", "Seed for pseudo-random number generator"}, > >> + {"trace-enable", "QEMU_TRACE_ENABLE",true, handle_arg_trace_enable, > >> + "name", "enable tracing of specified event names (pass 'help' to show a list of events)"}, > >> + {"trace-events", "QEMU_TRACE_EVENTS",true, handle_arg_trace_events, > >> + "eventsfile", "enable tracing of specified event names (one name/pattern per line)"}, > >> + {"trace-file", "QEMU_TRACE_FILE", true, handle_arg_trace_file, > >> + "tracefile", "output trace file"}, > > > Riku: These command-line options differ from the qemu-system -trace > > option. Should there be consistency or does *-user do its own thing? > > Do you mean it differs on semantics or on syntax? For the latter, *-user option > parsers do not use the more flexible parser used in vl.c (each has their own > much simpler implementation). Yes, they use different implementations. This point where an option is being carried over from softmmu to -user it's worth discussing again whether it's good for the command-lines to be ad-hoc and different. Stefan
diff --git a/linux-user/main.c b/linux-user/main.c index f8a8764..6d70821 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -33,6 +33,7 @@ #include "qemu/envlist.h" #include "elf.h" #include "exec/log.h" +#include "trace/control.h" char *exec_path; @@ -4000,6 +4001,22 @@ static void handle_arg_version(const char *arg) exit(EXIT_SUCCESS); } +static void handle_arg_trace_enable(const char *arg) +{ + trace_enable_events(arg); +} + +static void handle_arg_trace_events(const char *arg) +{ + trace_init_events(arg); +} + +static const char *trace_file = NULL; +static void handle_arg_trace_file(const char *arg) +{ + trace_file = arg; +} + struct qemu_argument { const char *argv; const char *env; @@ -4047,6 +4064,12 @@ static const struct qemu_argument arg_table[] = { "", "log system calls"}, {"seed", "QEMU_RAND_SEED", true, handle_arg_randseed, "", "Seed for pseudo-random number generator"}, + {"trace-enable", "QEMU_TRACE_ENABLE",true, handle_arg_trace_enable, + "name", "enable tracing of specified event names (pass 'help' to show a list of events)"}, + {"trace-events", "QEMU_TRACE_EVENTS",true, handle_arg_trace_events, + "eventsfile", "enable tracing of specified event names (one name/pattern per line)"}, + {"trace-file", "QEMU_TRACE_FILE", true, handle_arg_trace_file, + "tracefile", "output trace file"}, {"version", "QEMU_VERSION", false, handle_arg_version, "", "display version information and exit"}, {NULL, NULL, false, NULL, NULL, NULL} @@ -4238,6 +4261,11 @@ int main(int argc, char **argv, char **envp) optind = parse_args(argc, argv); + if (!trace_init_backends()) { + exit(1); + } + trace_init_file(trace_file); + /* Zero out regs */ memset(regs, 0, sizeof(struct target_pt_regs));
Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu> --- linux-user/main.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)