From 6d8a764e0fcdde8e3a62fb3fc5911b338c8893ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Llu=C3=ADs?= Date: Wed, 31 Aug 2011 20:30:43 +0200 Subject: trace: [configure] rename CONFIG_*_TRACE into CONFIG_TRACE_* MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Provides a more hierarchical view of the variable domain. Also adds the CONFIG_TRACE_* variables for all backends. [Stefan added missing 'test' in stap if statement] Signed-off-by: Lluís Vilanova Signed-off-by: Stefan Hajnoczi --- vl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'vl.c') diff --git a/vl.c b/vl.c index 9cd67a3746..8c7aaaa192 100644 --- a/vl.c +++ b/vl.c @@ -2928,7 +2928,7 @@ int main(int argc, char **argv, char **envp) } xen_mode = XEN_ATTACH; break; -#ifdef CONFIG_SIMPLE_TRACE +#ifdef CONFIG_TRACE_SIMPLE case QEMU_OPTION_trace: opts = qemu_opts_parse(qemu_find_opts("trace"), optarg, 0); if (opts) { -- cgit v1.2.3 From edb47ec498a5c00607e8d428668d5141822a9eac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Llu=C3=ADs?= Date: Wed, 31 Aug 2011 20:30:57 +0200 Subject: trace: move backend-specific code into the trace/ directory MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Lluís Vilanova --- vl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'vl.c') diff --git a/vl.c b/vl.c index 8c7aaaa192..145d7384d8 100644 --- a/vl.c +++ b/vl.c @@ -156,7 +156,7 @@ int main(int argc, char **argv) #include "slirp/libslirp.h" #include "trace.h" -#include "simpletrace.h" +#include "trace/simple.h" #include "qemu-queue.h" #include "cpus.h" #include "arch_init.h" -- cgit v1.2.3 From e4858974ec36afd8a6b3a9e2b0ad8f357f28efc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Llu=C3=ADs?= Date: Wed, 31 Aug 2011 20:31:03 +0200 Subject: trace: avoid conditional code compilation during option parsing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A default implementation for backend-specific routines is provided in "trace/default.c", which backends can override by setting "trace_default=no" in "configure". Signed-off-by: Lluís Vilanova --- vl.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'vl.c') diff --git a/vl.c b/vl.c index 145d7384d8..60322b62a4 100644 --- a/vl.c +++ b/vl.c @@ -156,7 +156,7 @@ int main(int argc, char **argv) #include "slirp/libslirp.h" #include "trace.h" -#include "trace/simple.h" +#include "trace/control.h" #include "qemu-queue.h" #include "cpus.h" #include "arch_init.h" @@ -2130,7 +2130,6 @@ int main(int argc, char **argv, char **envp) int show_vnc_port = 0; #endif int defconfig = 1; - const char *trace_file = NULL; const char *log_mask = NULL; const char *log_file = NULL; GMemVTable mem_trace = { @@ -2138,6 +2137,7 @@ int main(int argc, char **argv, char **envp) .realloc = realloc_and_trace, .free = free_and_trace, }; + const char *trace_file = NULL; atexit(qemu_run_exit_notifiers); error_set_progname(argv[0]); @@ -2928,14 +2928,15 @@ int main(int argc, char **argv, char **envp) } xen_mode = XEN_ATTACH; break; -#ifdef CONFIG_TRACE_SIMPLE case QEMU_OPTION_trace: + { opts = qemu_opts_parse(qemu_find_opts("trace"), optarg, 0); - if (opts) { - trace_file = qemu_opt_get(opts, "file"); + if (!opts) { + exit(1); } + trace_file = qemu_opt_get(opts, "file"); break; -#endif + } case QEMU_OPTION_readconfig: { int ret = qemu_read_config_file(optarg); @@ -2993,8 +2994,8 @@ int main(int argc, char **argv, char **envp) set_cpu_log(log_mask); } - if (!st_init(trace_file)) { - fprintf(stderr, "warning: unable to initialize simple trace backend\n"); + if (!trace_backend_init(trace_file)) { + exit(1); } /* If no data_dir is specified then try to find it relative to the -- cgit v1.2.3 From 23d15e860b33819ad76092fbb32577542fe0c44d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Llu=C3=ADs?= Date: Wed, 31 Aug 2011 20:31:31 +0200 Subject: trace: add "-trace events" argument to control initial state MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The "-trace events" argument can be used to provide a file with a list of trace event names that will be enabled prior to starting execution, thus providing early tracing. This saves the user from manually toggling event states through the monitor interface or whichever backend-specific interface. Signed-off-by: Lluís Vilanova --- vl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'vl.c') diff --git a/vl.c b/vl.c index 60322b62a4..c6dc6895b4 100644 --- a/vl.c +++ b/vl.c @@ -2137,6 +2137,7 @@ int main(int argc, char **argv, char **envp) .realloc = realloc_and_trace, .free = free_and_trace, }; + const char *trace_events = NULL; const char *trace_file = NULL; atexit(qemu_run_exit_notifiers); @@ -2934,6 +2935,7 @@ int main(int argc, char **argv, char **envp) if (!opts) { exit(1); } + trace_events = qemu_opt_get(opts, "events"); trace_file = qemu_opt_get(opts, "file"); break; } @@ -2994,7 +2996,7 @@ int main(int argc, char **argv, char **envp) set_cpu_log(log_mask); } - if (!trace_backend_init(trace_file)) { + if (!trace_backend_init(trace_events, trace_file)) { exit(1); } -- cgit v1.2.3