From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12471 invoked by alias); 25 Apr 2010 15:47:58 -0000 Received: (qmail 12454 invoked by uid 22791); 25 Apr 2010 15:47:55 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=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; Sun, 25 Apr 2010 15:47:48 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id C5A9C2BAC7E for ; Sun, 25 Apr 2010 11:47:46 -0400 (EDT) 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 CugChPMK5ufw for ; Sun, 25 Apr 2010 11:47:46 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 950CF2BAC6A for ; Sun, 25 Apr 2010 11:47:46 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id 368FCF5896; Sun, 25 Apr 2010 11:47:46 -0400 (EDT) From: Joel Brobecker To: gdb-patches@sourceware.org Subject: [vxworks 02/14] New command_post observer. Date: Sun, 25 Apr 2010 15:48:00 -0000 Message-Id: <1272210447-13895-3-git-send-email-brobecker@adacore.com> In-Reply-To: <1272210447-13895-1-git-send-email-brobecker@adacore.com> References: <1272210447-13895-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: 2010-04/txt/msg00842.txt.bz2 Just as the current language, or current inferior, or current thread, affect some of the commands being issued by the user to the debugger, with multi-partition systems, we now have a current partition (formerly known as a Protection Domain, or PD). What we are trying to do is to keep the user informed of the current PD (which is identified by either PD ID or name, but we like to print both). The problem is that we cannot just print a message everytime the PD gets switched, because many commands result in a temporary switch of partition. For instance, info threads will need to switch to the associated PDs in order to get the PC and associated symbolic info. We don't want to write the notification for each switch. However, we do want to print that notification if we just hit a breakpoint for some code living in a different partition... The way we solved this is by remembering the PD ID before we issued the last command. At the end of a command execution, if the PD ID changed, then we write a notification... This patch introduces an observer (command_post) that gets triggered at the end of a command execution... 2010-04-24 Joel Brobecker * doc/observer.texi (command_post): New observer. * top.c: #include "observer.h". (execute_command): Call observer_notify_command_post. --- gdb/doc/observer.texi | 4 ++++ gdb/top.c | 4 ++++ 2 files changed, 8 insertions(+), 0 deletions(-) diff --git a/gdb/doc/observer.texi b/gdb/doc/observer.texi index e19b8ed..ceb5b87 100644 --- a/gdb/doc/observer.texi +++ b/gdb/doc/observer.texi @@ -132,6 +132,10 @@ Called with @var{objfile} equal to @code{NULL} to indicate previously loaded symbol table data has now been invalidated. @end deftypefun +@deftypefun void command_post (void) +The debugger just finished executing a command. +@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/top.c b/gdb/top.c index dc2104c..e7eb4e6 100644 --- a/gdb/top.c +++ b/gdb/top.c @@ -63,6 +63,7 @@ #include #include "ui-out.h" #include "cli-out.h" +#include "observer.h" /* Default command line prompt. This is overriden in some configs. */ @@ -475,6 +476,9 @@ execute_command (char *p, int from_tty) warned = 1; } } + + /* Emit the "command_post" notification. */ + observer_notify_command_post (); } /* Read commands from `instream' and execute them -- 1.6.3.3