From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2577 invoked by alias); 10 May 2008 12:48:26 -0000 Received: (qmail 2569 invoked by uid 22791); 10 May 2008 12:48:26 -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; Sat, 10 May 2008 12:47:58 +0000 Received: from kahikatea.snap.net.nz (101.30.255.123.static.snap.net.nz [123.255.30.101]) by viper.snap.net.nz (Postfix) with ESMTP id AA25A3D9E31 for ; Sun, 11 May 2008 00:47:52 +1200 (NZST) Received: by kahikatea.snap.net.nz (Postfix, from userid 1000) id 5B7758FC6D; Sun, 11 May 2008 00:47:45 +1200 (NZST) From: Nick Roberts MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <18469.39280.284106.858072@kahikatea.snap.net.nz> Date: Sat, 10 May 2008 18:00:00 -0000 To: gdb-patches@sourceware.org Subject: Re: [RFA] Report the main thread. 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/msg00337.txt.bz2 > Vladimir Prus wrote: >> Daniel Jacobowitz wrote: >> >>> On Sat, Apr 26, 2008 at 08:44:23PM +0400, Vladimir Prus wrote: >>>> Will some approach that only produce MI output be fine with you? >>> >>> Perhaps that means any observer for a new MI thread should go in >>> add_thread_silent? >> >> Yes, moving the observer call to add_thread_silent is the most >> direct approach to make MI work the way I want without disturbing CLI. > Here's a patch to that effect. OK? > * thread.c (add_thread): Move observer call to ... > (add_thread_silent): ... here. > --- > gdb/thread.c | 5 +++-- > > 1 files changed, 3 insertions(+), 2 deletions(-) > diff --git a/gdb/thread.c b/gdb/thread.c > index 46e6ba7..d3cfb32 100644 > --- a/gdb/thread.c > +++ b/gdb/thread.c > @@ -124,6 +124,9 @@ add_thread_silent (ptid_t ptid) > tp->num = ++highest_thread_num; > tp->next = thread_list; > thread_list = tp; > + > + observer_notify_new_thread (tp); > + > return tp; > } Now that Joel has requested that I use observer_attach_new_thread for annotations this approach doesn't only produce MI output so it needs to be conditioned on MI: @@ -124,6 +124,10 @@ add_thread_silent (ptid_t ptid) tp->num = ++highest_thread_num; tp->next = thread_list; thread_list = tp; + + if (ui_out_is_mi_like_p (uiout)) + observer_notify_new_thread (tp); + return tp; } -- Nick http://www.inet.net.nz/~nickrob