summaryrefslogtreecommitdiff
path: root/vl.c
diff options
context:
space:
mode:
authorLluís <xscript@gmx.net>2011-08-31 20:31:03 +0200
committerStefan Hajnoczi <stefanha@linux.vnet.ibm.com>2011-09-01 10:34:53 +0100
commite4858974ec36afd8a6b3a9e2b0ad8f357f28efc7 (patch)
treeceb7f2b2cdff3c511e1807e65eb862b82cfac16c /vl.c
parentedb47ec498a5c00607e8d428668d5141822a9eac (diff)
downloadqemu-e4858974ec36afd8a6b3a9e2b0ad8f357f28efc7.tar.gz
trace: avoid conditional code compilation during option parsing
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 <vilanova@ac.upc.edu>
Diffstat (limited to 'vl.c')
-rw-r--r--vl.c17
1 files changed, 9 insertions, 8 deletions
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