From: edgar.iglesias@gmail.com
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [RFC 2/2] qemu-log: Interrupt the GDB session on guest-errors
Date: Wed, 22 May 2013 12:38:25 +0200 [thread overview]
Message-ID: <1369219105-9111-3-git-send-email-edgar.iglesias@gmail.com> (raw)
In-Reply-To: <1369219105-9111-1-git-send-email-edgar.iglesias@gmail.com>
From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
---
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
next prev parent reply other threads:[~2013-05-22 10:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-22 10:38 [Qemu-devel] [RFC 0/2] Break the debug session on sw errors edgar.iglesias
2013-05-22 10:38 ` [Qemu-devel] [RFC 1/2] gdbstub: Add gdbserver_break() edgar.iglesias
2013-05-22 10:38 ` edgar.iglesias [this message]
2013-05-22 10:45 ` [Qemu-devel] [RFC 2/2] qemu-log: Interrupt the GDB session on guest-errors Peter Maydell
2013-05-22 14:04 ` Edgar E. Iglesias
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=1369219105-9111-3-git-send-email-edgar.iglesias@gmail.com \
--to=edgar.iglesias@gmail.com \
--cc=qemu-devel@nongnu.org \
/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).