From patchwork Thu Jan 24 12:47:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: KONRAD Frederic X-Patchwork-Id: 10778869 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E63AF1390 for ; Thu, 24 Jan 2019 12:48:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D3BB328D0A for ; Thu, 24 Jan 2019 12:48:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C65EC2C45D; Thu, 24 Jan 2019 12:48:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2DBA628D0A for ; Thu, 24 Jan 2019 12:48:45 +0000 (UTC) Received: from localhost ([127.0.0.1]:52940 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gmeR2-0008Pt-QL for patchwork-qemu-devel@patchwork.kernel.org; Thu, 24 Jan 2019 07:48:44 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43751) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gmeQJ-0008Or-Bc for qemu-devel@nongnu.org; Thu, 24 Jan 2019 07:47:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gmeQI-0008Bj-I8 for qemu-devel@nongnu.org; Thu, 24 Jan 2019 07:47:59 -0500 Received: from mel.act-europe.fr ([194.98.77.210]:34206 helo=smtp.eu.adacore.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gmeQI-00088w-CC for qemu-devel@nongnu.org; Thu, 24 Jan 2019 07:47:58 -0500 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id D695E8138A; Thu, 24 Jan 2019 13:47:55 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at eu.adacore.com Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id HjDAM6HJO7i2; Thu, 24 Jan 2019 13:47:55 +0100 (CET) Received: from openvpn-soho-18.act-europe.fr (openvpn-soho-18.act-europe.fr [10.10.9.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id 2528381380; Thu, 24 Jan 2019 13:47:55 +0100 (CET) From: KONRAD Frederic To: qemu-devel@nongnu.org Date: Thu, 24 Jan 2019 13:47:49 +0100 Message-Id: <1548334069-9158-1-git-send-email-frederic.konrad@adacore.com> X-Mailer: git-send-email 1.8.3.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 194.98.77.210 Subject: [Qemu-devel] [PATCH] gdbstub: shutdown guest when the target is killed X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: edgar.iglesias@xilinx.com, peter.maydell@linaro.org, frederic.konrad@adacore.com, alistair.francis@wdc.com, philmd@redhat.com, luc.michel@greensocs.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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;