return NULL;
}
-void trace_list_events(void)
+void trace_list_events(FILE *f)
{
TraceEventIter iter;
TraceEvent *ev;
trace_event_iter_init(&iter, NULL);
while ((ev = trace_event_iter_next(&iter)) != NULL) {
- fprintf(stderr, "%s\n", trace_event_get_name(ev));
+ fprintf(f, "%s\n", trace_event_get_name(ev));
}
#ifdef CONFIG_TRACE_DTRACE
- fprintf(stderr, "This list of names of trace points may be incomplete "
- "when using the DTrace/SystemTap backends.\n"
- "Run 'qemu-trace-stap list %s' to print the full list.\n",
+ fprintf(f, "This list of names of trace points may be incomplete "
+ "when using the DTrace/SystemTap backends.\n"
+ "Run 'qemu-trace-stap list %s' to print the full list.\n",
error_get_progname());
#endif
}
void trace_enable_events(const char *line_buf)
{
if (is_help_option(line_buf)) {
- trace_list_events();
+ trace_list_events(stdout);
if (monitor_cur() == NULL) {
exit(0);
}
loc_pop(&loc);
}
-void trace_init_file(const char *file)
+void trace_init_file(void)
{
+ QemuOpts *opts = qemu_find_opts_singleton("trace");
+ const char *file = qemu_opt_get(opts, "file");
#ifdef CONFIG_TRACE_SIMPLE
st_set_trace_file(file);
if (init_trace_on_startup) {
return true;
}
-char *trace_opt_parse(const char *optarg)
+void trace_opt_parse(const char *optarg)
{
- char *trace_file;
QemuOpts *opts = qemu_opts_parse_noisily(qemu_find_opts("trace"),
optarg, true);
if (!opts) {
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"));
init_trace_on_startup = true;
qemu_opts_del(opts);
-
- return trace_file;
}
uint32_t trace_get_vcpu_event_count(void)