* [Qemu-devel] [PATCH v2 0/2] trace: [*-user] Add commandline arguments to control tracing
@ 2016-06-22 10:04 Lluís Vilanova
2016-06-22 10:04 ` [Qemu-devel] [PATCH v2 1/2] trace: [linux-user] Commandline " Lluís Vilanova
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Lluís Vilanova @ 2016-06-22 10:04 UTC (permalink / raw)
To: qemu-devel; +Cc: Eric Blake, Stefan Hajnoczi
Adds three commandline arguments to the main *-user programs, following what's
already available in softmmu:
* -trace-enable
* -trace-events
* -trace-file
Changes in v2
=============
* Tell user to use 'help' instead of '?' [Eric Blake].
* Remove newlines on argument docs for bsd-user [Eric Blake].
Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
---
Lluís Vilanova (2):
trace: [linux-user] Commandline arguments to control tracing
trace: [bsd-user] Commandline arguments to control tracing
bsd-user/main.c | 19 +++++++++++++++++++
linux-user/main.c | 28 ++++++++++++++++++++++++++++
2 files changed, 47 insertions(+)
To: qemu-devel@nongnu.org
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Cc: Eric Blake <eblake@redhat.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Qemu-devel] [PATCH v2 1/2] trace: [linux-user] Commandline arguments to control tracing
2016-06-22 10:04 [Qemu-devel] [PATCH v2 0/2] trace: [*-user] Add commandline arguments to control tracing Lluís Vilanova
@ 2016-06-22 10:04 ` Lluís Vilanova
2016-06-28 14:38 ` Stefan Hajnoczi
2016-06-22 10:04 ` [Qemu-devel] [PATCH v2 2/2] trace: [bsd-user] " Lluís Vilanova
2016-07-15 14:18 ` [Qemu-devel] [PATCH v2 0/2] trace: [*-user] Add commandline " Stefan Hajnoczi
2 siblings, 1 reply; 8+ messages in thread
From: Lluís Vilanova @ 2016-06-22 10:04 UTC (permalink / raw)
To: qemu-devel; +Cc: Eric Blake, Stefan Hajnoczi, Riku Voipio
Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
---
linux-user/main.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
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));
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Qemu-devel] [PATCH v2 2/2] trace: [bsd-user] Commandline arguments to control tracing
2016-06-22 10:04 [Qemu-devel] [PATCH v2 0/2] trace: [*-user] Add commandline arguments to control tracing Lluís Vilanova
2016-06-22 10:04 ` [Qemu-devel] [PATCH v2 1/2] trace: [linux-user] Commandline " Lluís Vilanova
@ 2016-06-22 10:04 ` Lluís Vilanova
2016-07-15 14:18 ` [Qemu-devel] [PATCH v2 0/2] trace: [*-user] Add commandline " Stefan Hajnoczi
2 siblings, 0 replies; 8+ messages in thread
From: Lluís Vilanova @ 2016-06-22 10:04 UTC (permalink / raw)
To: qemu-devel; +Cc: Eric Blake, Stefan Hajnoczi, Blue Swirl
Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
---
bsd-user/main.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/bsd-user/main.c b/bsd-user/main.c
index 9f592be..542e50e 100644
--- a/bsd-user/main.c
+++ b/bsd-user/main.c
@@ -30,6 +30,7 @@
#include "qemu/timer.h"
#include "qemu/envlist.h"
#include "exec/log.h"
+#include "trace/control.h"
int singlestep;
unsigned long mmap_min_addr;
@@ -687,6 +688,12 @@ static void usage(void)
"-p pagesize set the host page size to 'pagesize'\n"
"-singlestep always run in singlestep mode\n"
"-strace log system calls\n"
+ "-trace-enable name\n"
+ " enable tracing of specified event names (pass 'help' to show a list of events)\n"
+ "-trace-events eventsfile\n"
+ " enable tracing of specified event names (one name/pattern per line)\n"
+ "-trace-file tracefile\n"
+ " output trace file\n"
"\n"
"Environment variables:\n"
"QEMU_STRACE Print system calls and arguments similar to the\n"
@@ -735,6 +742,7 @@ int main(int argc, char **argv)
int gdbstub_port = 0;
char **target_environ, **wrk;
envlist_t *envlist = NULL;
+ const char *trace_file = NULL;
bsd_type = target_openbsd;
if (argc <= 1)
@@ -840,6 +848,12 @@ int main(int argc, char **argv)
singlestep = 1;
} else if (!strcmp(r, "strace")) {
do_strace = 1;
+ } else if (!strcmp(r, "trace-enable")) {
+ trace_enable_events(argv[optind++]);
+ } else if (!strcmp(r, "trace-events")) {
+ trace_init_events(argv[optind++]);
+ } else if (!strcmp(r, "trace-file")) {
+ trace_file = argv[optind++];
} else
{
usage();
@@ -865,6 +879,11 @@ int main(int argc, char **argv)
}
filename = argv[optind];
+ if (!trace_init_backends()) {
+ exit(1);
+ }
+ trace_init_file(trace_file);
+
/* Zero out regs */
memset(regs, 0, sizeof(struct target_pt_regs));
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH v2 1/2] trace: [linux-user] Commandline arguments to control tracing
2016-06-22 10:04 ` [Qemu-devel] [PATCH v2 1/2] trace: [linux-user] Commandline " Lluís Vilanova
@ 2016-06-28 14:38 ` Stefan Hajnoczi
2016-06-29 10:45 ` Lluís Vilanova
0 siblings, 1 reply; 8+ messages in thread
From: Stefan Hajnoczi @ 2016-06-28 14:38 UTC (permalink / raw)
To: Lluís Vilanova; +Cc: qemu-devel, Eric Blake, Riku Voipio
[-- Attachment #1: Type: text/plain, Size: 938 bytes --]
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?
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH v2 1/2] trace: [linux-user] Commandline arguments to control tracing
2016-06-28 14:38 ` Stefan Hajnoczi
@ 2016-06-29 10:45 ` Lluís Vilanova
2016-06-30 10:36 ` Stefan Hajnoczi
0 siblings, 1 reply; 8+ messages in thread
From: Lluís Vilanova @ 2016-06-29 10:45 UTC (permalink / raw)
To: Stefan Hajnoczi; +Cc: Riku Voipio, qemu-devel
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
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH v2 1/2] trace: [linux-user] Commandline arguments to control tracing
2016-06-29 10:45 ` Lluís Vilanova
@ 2016-06-30 10:36 ` Stefan Hajnoczi
0 siblings, 0 replies; 8+ messages in thread
From: Stefan Hajnoczi @ 2016-06-30 10:36 UTC (permalink / raw)
To: Riku Voipio, qemu-devel
[-- Attachment #1: Type: text/plain, Size: 1485 bytes --]
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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH v2 0/2] trace: [*-user] Add commandline arguments to control tracing
2016-06-22 10:04 [Qemu-devel] [PATCH v2 0/2] trace: [*-user] Add commandline arguments to control tracing Lluís Vilanova
2016-06-22 10:04 ` [Qemu-devel] [PATCH v2 1/2] trace: [linux-user] Commandline " Lluís Vilanova
2016-06-22 10:04 ` [Qemu-devel] [PATCH v2 2/2] trace: [bsd-user] " Lluís Vilanova
@ 2016-07-15 14:18 ` Stefan Hajnoczi
2016-07-15 17:07 ` Lluís Vilanova
2 siblings, 1 reply; 8+ messages in thread
From: Stefan Hajnoczi @ 2016-07-15 14:18 UTC (permalink / raw)
To: Lluís Vilanova; +Cc: qemu-devel, Stefan Hajnoczi
[-- Attachment #1: Type: text/plain, Size: 1080 bytes --]
On Wed, Jun 22, 2016 at 12:04:30PM +0200, Lluís Vilanova wrote:
> Adds three commandline arguments to the main *-user programs, following what's
> already available in softmmu:
>
> * -trace-enable
> * -trace-events
> * -trace-file
>
>
> Changes in v2
> =============
>
> * Tell user to use 'help' instead of '?' [Eric Blake].
> * Remove newlines on argument docs for bsd-user [Eric Blake].
>
>
> Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
> ---
>
> Lluís Vilanova (2):
> trace: [linux-user] Commandline arguments to control tracing
> trace: [bsd-user] Commandline arguments to control tracing
>
>
> bsd-user/main.c | 19 +++++++++++++++++++
> linux-user/main.c | 28 ++++++++++++++++++++++++++++
> 2 files changed, 47 insertions(+)
Hi Lluís,
Commit e9e0bb2af2248eabafb54402e3127f9f8a8690f5 ("trace: move
qemu_trace_opts to trace/control.c") made trace_events_init() static.
This conflicts with your patch series.
I suggest changing this series to use -trace ... just like
qemu/qemu-img/qemu-nbd.
Stefan
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH v2 0/2] trace: [*-user] Add commandline arguments to control tracing
2016-07-15 14:18 ` [Qemu-devel] [PATCH v2 0/2] trace: [*-user] Add commandline " Stefan Hajnoczi
@ 2016-07-15 17:07 ` Lluís Vilanova
0 siblings, 0 replies; 8+ messages in thread
From: Lluís Vilanova @ 2016-07-15 17:07 UTC (permalink / raw)
To: Stefan Hajnoczi; +Cc: qemu-devel, Stefan Hajnoczi
Stefan Hajnoczi writes:
> On Wed, Jun 22, 2016 at 12:04:30PM +0200, Lluís Vilanova wrote:
>> Adds three commandline arguments to the main *-user programs, following what's
>> already available in softmmu:
>>
>> * -trace-enable
>> * -trace-events
>> * -trace-file
>>
>>
>> Changes in v2
>> =============
>>
>> * Tell user to use 'help' instead of '?' [Eric Blake].
>> * Remove newlines on argument docs for bsd-user [Eric Blake].
>>
>>
>> Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
>> ---
>>
>> Lluís Vilanova (2):
>> trace: [linux-user] Commandline arguments to control tracing
>> trace: [bsd-user] Commandline arguments to control tracing
>>
>>
>> bsd-user/main.c | 19 +++++++++++++++++++
>> linux-user/main.c | 28 ++++++++++++++++++++++++++++
>> 2 files changed, 47 insertions(+)
> Hi Lluís,
> Commit e9e0bb2af2248eabafb54402e3127f9f8a8690f5 ("trace: move
> qemu_trace_opts to trace/control.c") made trace_events_init() static.
> This conflicts with your patch series.
> I suggest changing this series to use -trace ... just like
> qemu/qemu-img/qemu-nbd.
I'll send a new version adapted to that.
Thanks,
Lluis
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2016-07-15 17:07 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-22 10:04 [Qemu-devel] [PATCH v2 0/2] trace: [*-user] Add commandline arguments to control tracing Lluís Vilanova
2016-06-22 10:04 ` [Qemu-devel] [PATCH v2 1/2] trace: [linux-user] Commandline " Lluís Vilanova
2016-06-28 14:38 ` Stefan Hajnoczi
2016-06-29 10:45 ` Lluís Vilanova
2016-06-30 10:36 ` Stefan Hajnoczi
2016-06-22 10:04 ` [Qemu-devel] [PATCH v2 2/2] trace: [bsd-user] " Lluís Vilanova
2016-07-15 14:18 ` [Qemu-devel] [PATCH v2 0/2] trace: [*-user] Add commandline " Stefan Hajnoczi
2016-07-15 17:07 ` Lluís Vilanova
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.