From: KONRAD Frederic <frederic.konrad@adacore.com>
To: Max Filippov <jcmvbkbc@gmail.com>, qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
Luc Michel <luc.michel@greensocs.com>
Subject: Re: [Qemu-devel] [PATCH] gdbstub: allow killing QEMU via vKill command
Date: Wed, 30 Jan 2019 14:37:12 +0100 [thread overview]
Message-ID: <cfc9fee5-9f8b-2fb2-d58e-f8e08f5a0a52@adacore.com> (raw)
In-Reply-To: <20190129203219.6473-1-jcmvbkbc@gmail.com>
Hi,
Le 1/29/19 à 9:32 PM, Max Filippov a écrit :
> With multiprocess extensions gdb uses 'vKill' packet instead of 'k' to
> kill the inferior. Handle 'vKill' the same way 'k' was handled in the
> presence of single process.
>
> Fixes: 7cf48f6752e5 ("gdbstub: add multiprocess support to
> (f|s)ThreadInfo and ThreadExtraInfo")
>
> Cc: Luc Michel <luc.michel@greensocs.com>
> Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
> ---
> gdbstub.c | 22 ++++++++++++++++++++++
> 1 file changed, 22 insertions(+)
>
> diff --git a/gdbstub.c b/gdbstub.c
> index bfc7afb50968..1ef31240c055 100644
> --- a/gdbstub.c
> +++ b/gdbstub.c
> @@ -1383,6 +1383,28 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf)
>
> put_packet(s, buf);
> break;
> + } else if (strncmp(p, "Kill;", 5) == 0) {
> + unsigned long pid;
> +
> + p += 5;
> +
> + if (qemu_strtoul(p, &p, 16, &pid)) {
> + put_packet(s, "E22");
> + break;
> + }
> + process = gdb_get_process(s, pid);
> +
> + if (process == NULL) {
> + put_packet(s, "E22");
> + break;
> + }
> + if (s->process_num <= 1) {
> + /* Kill the target */
> + error_report("QEMU: Terminated via GDBstub");
> + exit(0);
I suggest:
#ifdef CONFIG_USER_ONLY
exit(0);
#else
qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN);
#endif
instead of exit(0);
> + }
> + /* TODO: handle multiprocess case */
> + goto unknown_command;
> } else {
> goto unknown_command;
> }
>
next prev parent reply other threads:[~2019-01-30 13:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-29 20:32 [Qemu-devel] [PATCH] gdbstub: allow killing QEMU via vKill command Max Filippov
2019-01-30 13:37 ` KONRAD Frederic [this message]
2019-01-30 14:31 ` Luc Michel
2019-01-30 14:56 ` 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=cfc9fee5-9f8b-2fb2-d58e-f8e08f5a0a52@adacore.com \
--to=frederic.konrad@adacore.com \
--cc=jcmvbkbc@gmail.com \
--cc=luc.michel@greensocs.com \
--cc=peter.maydell@linaro.org \
--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).