diff mbox series

[v2,09/19] tracing: only allow -trace to override -D if set

Message ID 20200213225109.13120-10-alex.bennee@linaro.org
State Superseded
Headers show
Series testing and plugin updates | expand

Commit Message

Alex Bennée Feb. 13, 2020, 10:50 p.m. UTC
Otherwise any -D settings the user may have made get ignored.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

---
 trace/control.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

-- 
2.20.1

Comments

Robert Foley Feb. 14, 2020, 6:19 p.m. UTC | #1
On Thu, 13 Feb 2020 at 17:51, Alex Bennée <alex.bennee@linaro.org> wrote:
>

> Otherwise any -D settings the user may have made get ignored.

>

> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>


Reviewed-by: Robert Foley <robert.foley@linaro.org>
diff mbox series

Patch

diff --git a/trace/control.c b/trace/control.c
index 6c775e68eba..2ffe0008184 100644
--- a/trace/control.c
+++ b/trace/control.c
@@ -226,10 +226,15 @@  void trace_init_file(const char *file)
 #ifdef CONFIG_TRACE_SIMPLE
     st_set_trace_file(file);
 #elif defined CONFIG_TRACE_LOG
-    /* If both the simple and the log backends are enabled, "--trace file"
-     * only applies to the simple backend; use "-D" for the log backend.
+    /*
+     * If both the simple and the log backends are enabled, "--trace file"
+     * only applies to the simple backend; use "-D" for the log
+     * backend. However we should only override -D if we actually have
+     * something to override it with.
      */
-    qemu_set_log_filename(file, &error_fatal);
+    if (file) {
+        qemu_set_log_filename(file, &error_fatal);
+    }
 #else
     if (file) {
         fprintf(stderr, "error: --trace file=...: "