From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26095 invoked by alias); 1 May 2008 23:31:39 -0000 Received: (qmail 26087 invoked by uid 22791); 1 May 2008 23:31:39 -0000 X-Spam-Check-By: sourceware.org Received: from viper.snap.net.nz (HELO viper.snap.net.nz) (202.37.101.25) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 01 May 2008 23:31:11 +0000 Received: from kahikatea.snap.net.nz (103.31.255.123.static.snap.net.nz [123.255.31.103]) by viper.snap.net.nz (Postfix) with ESMTP id 0DFF13DA348; Fri, 2 May 2008 11:31:09 +1200 (NZST) Received: by kahikatea.snap.net.nz (Postfix, from userid 1000) id C115C8FC6D; Fri, 2 May 2008 11:31:06 +1200 (NZST) From: Nick Roberts MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <18458.21177.959458.278174@kahikatea.snap.net.nz> Date: Thu, 01 May 2008 23:31:00 -0000 To: Joel Brobecker Cc: gdb-patches@sources.redhat.com Subject: Re: [PATCH] New annotation for threads In-Reply-To: <20080501181758.GD3801@adacore.com> References: <18440.29531.916381.569346@kahikatea.snap.net.nz> <20080429023735.GD841@adacore.com> <18454.43094.168458.742737@kahikatea.snap.net.nz> <20080501181758.GD3801@adacore.com> X-Mailer: VM 7.19 under Emacs 22.2.50.2 X-IsSubscribed: yes 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: 2008-05/txt/msg00051.txt.bz2 > > > How about creating a new observer for new_threads events instead of > > > specifically calling an annotation function from "add_thread"? Seems > > > much cleaner that way. > > > > I'm not sure what you mean, or how I would register such an observer. > > All other annotations are done this way and, unlike MI, annotations don't > > have their own interpreter but just mark up CLI. > > The observers are documented in doc/observer.texi. Basically, you need > to do the following: > > static void > annotate_new_thread (struct thread_info *thread) > { > /* Your annotation here. */ > } > > And then attach this observer to the new_thread event using: > > observer_attach_new_thread (annotate_new_thread); Yes, I can see how observers work. I sent a patch earlier for thread-changed and frame-changed events. > All this can be done inside annotate.c. Where in annotate.c? It can't be in _initialize_annotate because that only gets called at startup and the annotation level can be changed with the "set annotate" command (which is also why deprecated_delete_breakpoint_hook and deprecated_modify_breakpoint_hook shouldn't be set there). None of the other annotations are implemented using observers and this patch is just meant as a stop gap before migrating fully to MI, not as a permanent feature. I therefore ask to commit this patch as is on the grounds that: 1) Emacs is the only application likely to use it. 2) All other users will be unaffected by this change. -- Nick http://www.inet.net.nz/~nickrob