trace: Send "-d trace:help" output to stdout

... for consistency with "-d help".

Signed-off-by: Doug Evans <dje@google.com>
Message-id: 20201125215245.3514695-1-dje@google.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
Doug Evans 2020-11-25 13:52:45 -08:00 committed by Stefan Hajnoczi
parent 41192db338
commit 6745c8a01f
2 changed files with 8 additions and 7 deletions

View File

@ -125,18 +125,18 @@ TraceEvent *trace_event_iter_next(TraceEventIter *iter)
return NULL; return NULL;
} }
void trace_list_events(void) void trace_list_events(FILE *f)
{ {
TraceEventIter iter; TraceEventIter iter;
TraceEvent *ev; TraceEvent *ev;
trace_event_iter_init(&iter, NULL); trace_event_iter_init(&iter, NULL);
while ((ev = trace_event_iter_next(&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 #ifdef CONFIG_TRACE_DTRACE
fprintf(stderr, "This list of names of trace points may be incomplete " fprintf(f, "This list of names of trace points may be incomplete "
"when using the DTrace/SystemTap backends.\n" "when using the DTrace/SystemTap backends.\n"
"Run 'qemu-trace-stap list %s' to print the full list.\n", "Run 'qemu-trace-stap list %s' to print the full list.\n",
error_get_progname()); error_get_progname());
#endif #endif
} }
@ -176,7 +176,7 @@ static void do_trace_enable_events(const char *line_buf)
void trace_enable_events(const char *line_buf) void trace_enable_events(const char *line_buf)
{ {
if (is_help_option(line_buf)) { if (is_help_option(line_buf)) {
trace_list_events(); trace_list_events(stdout);
if (monitor_cur() == NULL) { if (monitor_cur() == NULL) {
exit(0); exit(0);
} }

View File

@ -201,10 +201,11 @@ void trace_fini_vcpu(CPUState *vcpu);
/** /**
* trace_list_events: * trace_list_events:
* @f: Where to send output.
* *
* List all available events. * List all available events.
*/ */
void trace_list_events(void); void trace_list_events(FILE *f);
/** /**
* trace_enable_events: * trace_enable_events: