Merge tag 'v2.4.0' into tizen_3.0_qemu_2.4
[sdk/emulator/qemu.git] / util / qemu-error.c
index 77ea6c6..19a9513 100644 (file)
 #include "monitor/monitor.h"
 #include "qemu/error-report.h"
 
+#ifdef CONFIG_MARU
+static QLIST_HEAD(, ErrorReporter) error_reporters =
+    QLIST_HEAD_INITIALIZER(error_reporters);
+
+void add_error_reporter(ErrorReporter *new_reporter)
+{
+    QLIST_INSERT_HEAD(&error_reporters, new_reporter, node);
+}
+
+static void report_to_clients(const char *fmt, va_list ap)
+{
+    ErrorReporter *reporter;
+    QLIST_FOREACH(reporter, &error_reporters, node) {
+        if (reporter->report) {
+            (*(reporter->report))(fmt, ap);
+        }
+    }
+}
+#endif
+
 /*
  * Print to current monitor if we have one, else to stderr.
  * TODO should return int, so callers can calculate width, but that
@@ -25,6 +45,9 @@ void error_vprintf(const char *fmt, va_list ap)
         monitor_vprintf(cur_mon, fmt, ap);
     } else {
         vfprintf(stderr, fmt, ap);
+#ifdef CONFIG_MARU
+        report_to_clients(fmt, ap);
+#endif
     }
 }