From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25657 invoked by alias); 4 Mar 2011 06:22:29 -0000 Received: (qmail 25647 invoked by uid 22791); 4 Mar 2011 06:22:28 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 04 Mar 2011 06:22:24 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id AECB42BAE66; Fri, 4 Mar 2011 01:22:22 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id HmLV1rNHovMn; Fri, 4 Mar 2011 01:22:22 -0500 (EST) Received: from kwai.gnat.com (kwai.gnat.com [205.232.38.4]) by rock.gnat.com (Postfix) with ESMTP id 9C5E02BAE61; Fri, 4 Mar 2011 01:22:22 -0500 (EST) Received: by kwai.gnat.com (Postfix, from userid 4233) id 9796492A53; Fri, 4 Mar 2011 01:22:22 -0500 (EST) From: Joel Brobecker To: gdb-patches@sourceware.org Cc: Joel Brobecker Subject: [VxWorks 03/20] New toplevel_command_post observer Date: Fri, 04 Mar 2011 06:22:00 -0000 Message-Id: <1299219720-13398-4-git-send-email-brobecker@adacore.com> In-Reply-To: <1299219720-13398-1-git-send-email-brobecker@adacore.com> References: <1299219720-13398-1-git-send-email-brobecker@adacore.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: 2011-03/txt/msg00254.txt.bz2 gdb/ChangeLog: * doc/observer.texi (toplevel_command_post): New observer. * event-top.c: #include "observer.h". (toplevel_command_cleanup): New function. (command_handler): Add toplevel_command_cleanup cleanup. --- gdb/doc/observer.texi | 5 +++++ gdb/event-top.c | 20 +++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletions(-) diff --git a/gdb/doc/observer.texi b/gdb/doc/observer.texi index d16c865..146731f 100644 --- a/gdb/doc/observer.texi +++ b/gdb/doc/observer.texi @@ -132,6 +132,11 @@ Called with @var{objfile} equal to @code{NULL} to indicate previously loaded symbol table data has now been invalidated. @end deftypefun +@deftypefun void toplevel_command_post (void) +The debugger just finished executing a command entered at the command +prompt. +@end deftypefun + @deftypefun void new_thread (struct thread_info *@var{t}) The thread specified by @var{t} has been created. @end deftypefun diff --git a/gdb/event-top.c b/gdb/event-top.c index 71accf6..da10f1d 100644 --- a/gdb/event-top.c +++ b/gdb/event-top.c @@ -33,7 +33,7 @@ #include "cli/cli-script.h" /* for reset_command_nest_depth */ #include "main.h" #include "gdbthread.h" - +#include "observer.h" #include "gdbcmd.h" /* for dont_repeat() */ /* readline include files. */ @@ -467,6 +467,20 @@ async_disable_stdin (void) } +/* The actions to perform once a command from the top-level command + loop has finished executing. + + This function is defined in such a way as to allow its use with + the cleanup mechanism, to make sure that the actions are always + performed, even when an exception is raised during the treatment + of the command. */ + +static void +toplevel_command_cleanup (void *unused) +{ + observer_notify_toplevel_command_post (); +} + /* Handles a gdb command. This function is called by command_line_handler, which has processed one or more input lines into COMMAND. */ @@ -494,7 +508,11 @@ command_handler (char *command) execute_command ("quit", stdin == instream); } + /* We insert the command-stats entry first in order to see + the command stats be displayed at the end, after all the other + cleanup entries have been handled. */ stat_chain = make_command_stats_cleanup (1); + make_cleanup (toplevel_command_cleanup, NULL); execute_command (command, instream == stdin); -- 1.7.0.4