bool trace_init_backends(const char *events, const char *file) { #ifdef CONFIG_TRACE_SIMPLE if (!st_init(file)) { fprintf(stderr, "failed to initialize simple tracing backend.\n"); return false; } #else if (file) { fprintf(stderr, "error: -trace file=...: " "option not supported by the selected tracing backends\n"); return false; } #endif #ifdef CONFIG_TRACE_FTRACE if (!ftrace_init()) { fprintf(stderr, "failed to initialize ftrace backend.\n"); return false; } #endif trace_init_events(events); return true; }
char *trace_opt_parse(const char *optarg) { char *trace_file; QemuOpts *opts = qemu_opts_parse_noisily(qemu_find_opts("trace"), optarg, true); if (!opts) { exit(1); } if (qemu_opt_get(opts, "enable")) { trace_enable_events(qemu_opt_get(opts, "enable")); } trace_init_events(qemu_opt_get(opts, "events")); trace_file = g_strdup(qemu_opt_get(opts, "file")); qemu_opts_del(opts); return trace_file; }