From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9613 invoked by alias); 17 Dec 2009 07:46:13 -0000 Received: (qmail 9605 invoked by uid 22791); 17 Dec 2009 07:46:12 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 17 Dec 2009 07:46:08 +0000 Received: (qmail 441 invoked from network); 17 Dec 2009 07:46:05 -0000 Received: from unknown (HELO wind.localnet) (vladimir@127.0.0.2) by mail.codesourcery.com with ESMTPA; 17 Dec 2009 07:46:05 -0000 From: Vladimir Prus To: gdb-patches@sourceware.org Subject: [MI, doc] flush output in -gdb-exit Date: Thu, 17 Dec 2009 07:46:00 -0000 User-Agent: KMail/1.12.2 (Linux/2.6.31-14-generic-pae; KDE/4.3.2; i686; ; ) MIME-Version: 1.0 Content-Type: Text/Plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Message-Id: <200912171046.03355.vladimir@codesourcery.com> Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-12/txt/msg00224.txt.bz2 I've noticed that under frontend, -gdb-exit may "timeout", even though it sends "^exit" immediately. There was a flush missing. This patch adds it, and clarifies that frontend should wait for GDB to actually exit, not just acknoledge the request. OK? - Volodya diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index e880838..1824a6c 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -21955,6 +21955,13 @@ Quitting @value{GDBN} just prints the result class @samp{^exit}. <- ^exit @end smallexample +Please note that @samp{^exit} is printed immediately, but it might +take some time for GDB to actually exit. During that time, GDB +performs necessary cleanups, including killing programs being debugged +or disconnecting from debug hardware, so the frontend should wait till +GDB exits and should only forcibly kill GDB if it fails to exit in +reasonable time. + @subheading A Bad Command Here's what happens if you pass a non-existent command: diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c index 2332752..0c8e917 100644 --- a/gdb/mi/mi-main.c +++ b/gdb/mi/mi-main.c @@ -111,6 +111,7 @@ mi_cmd_gdb_exit (char *command, char **argv, int argc) fputs_unfiltered (current_token, raw_stdout); fputs_unfiltered ("^exit\n", raw_stdout); mi_out_put (uiout, raw_stdout); + gdb_flush (raw_stdout); /* FIXME: The function called is not yet a formal libgdb function. */ quit_force (NULL, FROM_TTY); } - Volodya