qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: armbru@redhat.com, stefanha@redhat.com
Subject: [PATCH 2/2] trace: skip qemu_set_log_filename if no "-D" option was passed
Date: Tue,  9 Feb 2021 15:57:59 +0100	[thread overview]
Message-ID: <20210209145759.141231-3-pbonzini@redhat.com> (raw)
In-Reply-To: <20210209145759.141231-1-pbonzini@redhat.com>

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(-)

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);
-- 
2.29.2



  parent reply	other threads:[~2021-02-09 15:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-09 14:57 [PATCH 0/2] trace: fix "-trace file=...." Paolo Bonzini
2021-02-09 14:57 ` [PATCH 1/2] trace: fix "-trace file=..." Paolo Bonzini
2021-02-09 19:35   ` Eric Blake
2021-02-09 14:57 ` Paolo Bonzini [this message]
2021-02-09 19:36   ` [PATCH 2/2] trace: skip qemu_set_log_filename if no "-D" option was passed Eric Blake
2021-02-15 17:34 ` [PATCH 0/2] trace: fix "-trace file=...." Stefan Hajnoczi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210209145759.141231-3-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=armbru@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).