From: KONRAD Frederic <frederic.konrad@adacore.com>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, philmd@redhat.com,
edgar.iglesias@xilinx.com, alistair.francis@wdc.com,
luc.michel@greensocs.com, frederic.konrad@adacore.com
Subject: [Qemu-devel] [PATCH] gdbstub: shutdown guest when the target is killed
Date: Thu, 24 Jan 2019 13:47:49 +0100 [thread overview]
Message-ID: <1548334069-9158-1-git-send-email-frederic.konrad@adacore.com> (raw)
Under MinGW when the target is killed no "W00" packet are received by GDB
because gdbstub takes the "exit(0)" path. So replace the "exit(0)" call by
a normal guest shutdown so the "W00" packet has a chance to be sent in
"gdb_cleanup".
Signed-off-by: KONRAD Frederic <frederic.konrad@adacore.com>
---
gdbstub.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/gdbstub.c b/gdbstub.c
index bfc7afb..c91a909 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -1389,7 +1389,12 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf)
case 'k':
/* Kill the target */
error_report("QEMU: Terminated via GDBstub");
+#ifdef CONFIG_USER_ONLY
exit(0);
+#else
+ qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN);
+#endif
+ break;
case 'D':
/* Detach packet */
pid = 1;
--
1.8.3.1
next reply other threads:[~2019-01-24 12:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-24 12:47 KONRAD Frederic [this message]
2019-01-24 13:04 ` [Qemu-devel] [PATCH] gdbstub: shutdown guest when the target is killed Peter Maydell
2019-01-24 14:00 ` KONRAD Frederic
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=1548334069-9158-1-git-send-email-frederic.konrad@adacore.com \
--to=frederic.konrad@adacore.com \
--cc=alistair.francis@wdc.com \
--cc=edgar.iglesias@xilinx.com \
--cc=luc.michel@greensocs.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@redhat.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).