[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 2/2] trace: skip qemu_set_log_filename if no "-D" option was
From: |
Eric Blake |
Subject: |
Re: [PATCH 2/2] trace: skip qemu_set_log_filename if no "-D" option was passed |
Date: |
Tue, 9 Feb 2021 13:36:21 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 |
On 2/9/21 8:57 AM, Paolo Bonzini wrote:
> When the "simple" backend is not active but the "log" backend is,
> both "-trace file=" and "-D" will result in a call to
> qemu_set_log_filename. Unfortunately, QEMU was also calling
> qemu_set_log_filename if "-D" was not passed, so the "-trace
> file=" option had no effect and the tracepoints went back to
> stderr.
>
> Fortunately we can just skip qemu_set_log_filename in that case,
> because the log backend will initialize itself just fine as soon
> as qemu_set_log is called, also in qemu_process_early_options.
>
> Cc: stefanha@redhat.com
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> softmmu/vl.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
Reviewed-by: Eric Blake <eblake@redhat.com>
> diff --git a/softmmu/vl.c b/softmmu/vl.c
> index b219ce1f35..e67f91dd37 100644
> --- a/softmmu/vl.c
> +++ b/softmmu/vl.c
> @@ -2367,7 +2367,9 @@ static void qemu_process_early_options(void)
> trace_init_file();
>
> /* Open the logfile at this point and set the log mask if necessary. */
> - qemu_set_log_filename(log_file, &error_fatal);
> + if (log_file) {
> + qemu_set_log_filename(log_file, &error_fatal);
> + }
> if (log_mask) {
> int mask;
> mask = qemu_str_to_log_mask(log_mask);
>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org