[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC 2/2] qemu-log: Interrupt the GDB session on guest-erro
From: |
edgar . iglesias |
Subject: |
[Qemu-devel] [RFC 2/2] qemu-log: Interrupt the GDB session on guest-errors |
Date: |
Wed, 22 May 2013 12:38:25 +0200 |
From: "Edgar E. Iglesias" <address@hidden>
Signed-off-by: Edgar E. Iglesias <address@hidden>
---
qemu-log.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/qemu-log.c b/qemu-log.c
index 797f2af..693bc94 100644
--- a/qemu-log.c
+++ b/qemu-log.c
@@ -19,6 +19,7 @@
#include "qemu-common.h"
#include "qemu/log.h"
+#include "exec/gdbstub.h"
static char *logfilename;
FILE *qemu_logfile;
@@ -45,6 +46,25 @@ void qemu_log_mask(int mask, const char *fmt, ...)
vfprintf(qemu_logfile, fmt, ap);
}
va_end(ap);
+
+ /*
+ * Break the GDB session (if connected) so that the user can inspect the
+ * guest state.
+ *
+ * TODO: Consider conditionalizing this on a cmdline option.
+ */
+ if (mask & LOG_GUEST_ERROR) {
+ char *msg;
+
+ va_start(ap, fmt);
+ if (vasprintf(&msg, fmt, ap) < 0) {
+ msg = NULL;
+ }
+ va_end(ap);
+
+ gdbserver_break(msg);
+ g_free(msg);
+ }
}
/* enable or disable low levels log */
--
1.7.10.4