From nobody Fri Nov 7 14:33:20 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1548334140819448.0952855008386; Thu, 24 Jan 2019 04:49:00 -0800 (PST) Received: from localhost ([127.0.0.1]:52942 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gmeRH-0000L2-RE for importer@patchew.org; Thu, 24 Jan 2019 07:48:59 -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) 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) X-Virus-Scanned: Debian amavisd-new at eu.adacore.com 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 =3D 1; --=20 1.8.3.1