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: 1030440 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=adacore.com Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43lhly1pjlz9s3l for ; Thu, 24 Jan 2019 23:48:28 +1100 (AEDT) Received: from localhost ([127.0.0.1]:52940 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gmeQj-0008Pt-3M for incoming@patchwork.ozlabs.org; Thu, 24 Jan 2019 07:48:25 -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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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;