* [Qemu-devel] [PATCH 0/2] trace: [*-user] Add commandline arguments to control tracing
@ 2016-06-21 13:23 Lluís Vilanova
2016-06-21 13:23 ` [Qemu-devel] [PATCH 1/2] trace: [linux-user] Commandline " Lluís Vilanova
2016-06-21 13:23 ` [Qemu-devel] [PATCH 2/2] trace: [bsd-user] " Lluís Vilanova
0 siblings, 2 replies; 7+ messages in thread
From: Lluís Vilanova @ 2016-06-21 13:23 UTC (permalink / raw)
To: qemu-devel; +Cc: Stefan Hajnoczi
Adds three commandline arguments to the main *-user programs, following what's
already available in softmmu:
* -trace-enable
* -trace-events
* -trace-file
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 | 21 +++++++++++++++++++++
linux-user/main.c | 28 ++++++++++++++++++++++++++++
2 files changed, 49 insertions(+)
To: qemu-devel@nongnu.org
Cc: Stefan Hajnoczi <stefanha@redhat.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Qemu-devel] [PATCH 1/2] trace: [linux-user] Commandline arguments to control tracing
2016-06-21 13:23 [Qemu-devel] [PATCH 0/2] trace: [*-user] Add commandline arguments to control tracing Lluís Vilanova
@ 2016-06-21 13:23 ` Lluís Vilanova
2016-06-21 22:08 ` Eric Blake
2016-06-21 13:23 ` [Qemu-devel] [PATCH 2/2] trace: [bsd-user] " Lluís Vilanova
1 sibling, 1 reply; 7+ messages in thread
From: Lluís Vilanova @ 2016-06-21 13:23 UTC (permalink / raw)
To: qemu-devel; +Cc: 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..b0d7d2b 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 '?' 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] 7+ messages in thread
* [Qemu-devel] [PATCH 2/2] trace: [bsd-user] Commandline arguments to control tracing
2016-06-21 13:23 [Qemu-devel] [PATCH 0/2] trace: [*-user] Add commandline arguments to control tracing Lluís Vilanova
2016-06-21 13:23 ` [Qemu-devel] [PATCH 1/2] trace: [linux-user] Commandline " Lluís Vilanova
@ 2016-06-21 13:23 ` Lluís Vilanova
2016-06-21 22:09 ` Eric Blake
1 sibling, 1 reply; 7+ messages in thread
From: Lluís Vilanova @ 2016-06-21 13:23 UTC (permalink / raw)
To: qemu-devel; +Cc: Stefan Hajnoczi, Blue Swirl
Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
---
bsd-user/main.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/bsd-user/main.c b/bsd-user/main.c
index 9f592be..ce2cc17 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,14 @@ 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\n"
+ " (pass '?' to show a list of events)\n"
+ "-trace-events eventsfile\n"
+ " enable tracing of specified event names\n"
+ " (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 +744,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 +850,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 +881,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] 7+ messages in thread
* Re: [Qemu-devel] [PATCH 1/2] trace: [linux-user] Commandline arguments to control tracing
2016-06-21 13:23 ` [Qemu-devel] [PATCH 1/2] trace: [linux-user] Commandline " Lluís Vilanova
@ 2016-06-21 22:08 ` Eric Blake
2016-06-22 9:53 ` Lluís Vilanova
0 siblings, 1 reply; 7+ messages in thread
From: Eric Blake @ 2016-06-21 22:08 UTC (permalink / raw)
To: Lluís Vilanova, qemu-devel; +Cc: Riku Voipio, Stefan Hajnoczi
[-- Attachment #1: Type: text/plain, Size: 717 bytes --]
On 06/21/2016 07:23 AM, Lluís Vilanova wrote:
> Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
> ---
> linux-user/main.c | 28 ++++++++++++++++++++++++++++
> 1 file changed, 28 insertions(+)
>
> + {"trace-enable", "QEMU_TRACE_ENABLE",true, handle_arg_trace_enable,
> + "name", "enable tracing of specified event names (pass '?' to show a list of events)"},
? is a shell metacharacter, and it requires quoting to be safe against
globbing against any single-letter files in the current directory. A
better suggestion would be to pass 'help' to show a list of events.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH 2/2] trace: [bsd-user] Commandline arguments to control tracing
2016-06-21 13:23 ` [Qemu-devel] [PATCH 2/2] trace: [bsd-user] " Lluís Vilanova
@ 2016-06-21 22:09 ` Eric Blake
2016-06-22 9:54 ` Lluís Vilanova
0 siblings, 1 reply; 7+ messages in thread
From: Eric Blake @ 2016-06-21 22:09 UTC (permalink / raw)
To: Lluís Vilanova, qemu-devel; +Cc: Blue Swirl, Stefan Hajnoczi
[-- Attachment #1: Type: text/plain, Size: 1178 bytes --]
On 06/21/2016 07:23 AM, Lluís Vilanova wrote:
> Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
> ---
> bsd-user/main.c | 21 +++++++++++++++++++++
> 1 file changed, 21 insertions(+)
>
> diff --git a/bsd-user/main.c b/bsd-user/main.c
> index 9f592be..ce2cc17 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,14 @@ 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\n"
> + " (pass '?' to show a list of events)\n"
Same complaint as in 1/2. Also, why does this one split into two lines,
while that one had long lines?
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH 1/2] trace: [linux-user] Commandline arguments to control tracing
2016-06-21 22:08 ` Eric Blake
@ 2016-06-22 9:53 ` Lluís Vilanova
0 siblings, 0 replies; 7+ messages in thread
From: Lluís Vilanova @ 2016-06-22 9:53 UTC (permalink / raw)
To: Eric Blake; +Cc: qemu-devel, Riku Voipio, Stefan Hajnoczi
Eric Blake writes:
> On 06/21/2016 07:23 AM, Lluís Vilanova wrote:
>> Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
>> ---
>> linux-user/main.c | 28 ++++++++++++++++++++++++++++
>> 1 file changed, 28 insertions(+)
>>
>> + {"trace-enable", "QEMU_TRACE_ENABLE",true, handle_arg_trace_enable,
>> + "name", "enable tracing of specified event names (pass '?' to show a list of events)"},
> ? is a shell metacharacter, and it requires quoting to be safe against
> globbing against any single-letter files in the current directory. A
> better suggestion would be to pass 'help' to show a list of events.
Right. The code internally uses 'is_help_option()' (also used by "-trace
enable=" and "-cpu" in vl.c), which accepts both '?' and 'help'. I'll just cite
using 'help' (even if both are accepted).
Thanks,
Lluis
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH 2/2] trace: [bsd-user] Commandline arguments to control tracing
2016-06-21 22:09 ` Eric Blake
@ 2016-06-22 9:54 ` Lluís Vilanova
0 siblings, 0 replies; 7+ messages in thread
From: Lluís Vilanova @ 2016-06-22 9:54 UTC (permalink / raw)
To: Eric Blake; +Cc: qemu-devel, Blue Swirl, Stefan Hajnoczi
Eric Blake writes:
> On 06/21/2016 07:23 AM, Lluís Vilanova wrote:
>> Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
>> ---
>> bsd-user/main.c | 21 +++++++++++++++++++++
>> 1 file changed, 21 insertions(+)
>>
>> diff --git a/bsd-user/main.c b/bsd-user/main.c
>> index 9f592be..ce2cc17 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,14 @@ 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\n"
>> + " (pass '?' to show a list of events)\n"
> Same complaint as in 1/2. Also, why does this one split into two lines,
> while that one had long lines?
An oversight on my side.
Thanks,
Lluis
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2016-06-22 9:54 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-21 13:23 [Qemu-devel] [PATCH 0/2] trace: [*-user] Add commandline arguments to control tracing Lluís Vilanova
2016-06-21 13:23 ` [Qemu-devel] [PATCH 1/2] trace: [linux-user] Commandline " Lluís Vilanova
2016-06-21 22:08 ` Eric Blake
2016-06-22 9:53 ` Lluís Vilanova
2016-06-21 13:23 ` [Qemu-devel] [PATCH 2/2] trace: [bsd-user] " Lluís Vilanova
2016-06-21 22:09 ` Eric Blake
2016-06-22 9:54 ` 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.