dcavalca / rpms / qemu

Forked from rpms/qemu a year ago
Clone

Blame 0109-trace-Replace-error-with-warning-if-event-is-not-def.patch

0410ae
From 2e6870993d226dd8af3e2db502e8e183ee63d66a Mon Sep 17 00:00:00 2001
0410ae
From: Alexey Kardashevskiy <aik@ozlabs.ru>
0410ae
Date: Wed, 21 May 2014 18:16:01 +1000
0410ae
Subject: [PATCH] trace: Replace error with warning if event is not defined
0410ae
0410ae
At the moment QEMU exits if trace point is not defined which makes
0410ae
a developer life harder if he has to switch between branches with
0410ae
different traces implemented.
0410ae
0410ae
This replaces error+exit wit WARNING if the tracepoint does not exist or
0410ae
not traceable.
0410ae
0410ae
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
0410ae
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
0410ae
(cherry picked from commit 82432638ebeedda8a2e18838b6fbef4b14a94f31)
0410ae
---
0410ae
 trace/control.c | 14 +++++++-------
0410ae
 1 file changed, 7 insertions(+), 7 deletions(-)
0410ae
0410ae
diff --git a/trace/control.c b/trace/control.c
0410ae
index 49f61e1..4aa02cf 100644
0410ae
--- a/trace/control.c
0410ae
+++ b/trace/control.c
0410ae
@@ -112,15 +112,15 @@ void trace_backend_init_events(const char *fname)
0410ae
                 TraceEvent *ev = trace_event_name(line_ptr);
0410ae
                 if (ev == NULL) {
0410ae
                     fprintf(stderr,
0410ae
-                            "error: trace event '%s' does not exist\n", line_ptr);
0410ae
-                    exit(1);
0410ae
-                }
0410ae
-                if (!trace_event_get_state_static(ev)) {
0410ae
+                            "WARNING: trace event '%s' does not exist\n",
0410ae
+                            line_ptr);
0410ae
+                } else if (!trace_event_get_state_static(ev)) {
0410ae
                     fprintf(stderr,
0410ae
-                            "error: trace event '%s' is not traceable\n", line_ptr);
0410ae
-                    exit(1);
0410ae
+                            "WARNING: trace event '%s' is not traceable\n",
0410ae
+                            line_ptr);
0410ae
+                } else {
0410ae
+                    trace_event_set_state_dynamic(ev, enable);
0410ae
                 }
0410ae
-                trace_event_set_state_dynamic(ev, enable);
0410ae
             }
0410ae
         }
0410ae
     }