From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4324 invoked by alias); 9 Jun 2008 13:59:59 -0000 Received: (qmail 4297 invoked by uid 22791); 9 Jun 2008 13:59:57 -0000 X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 09 Jun 2008 13:59:35 +0000 Received: (qmail 23719 invoked from network); 9 Jun 2008 13:59:33 -0000 Received: from unknown (HELO orlando.local) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 9 Jun 2008 13:59:33 -0000 From: Pedro Alves To: gdb-patches@sourceware.org Subject: Re: [patch:MI] Observer for thread-changed Date: Mon, 09 Jun 2008 15:06:00 -0000 User-Agent: KMail/1.9.9 Cc: Nick Roberts , gdb-patches@sources.redhat.com, ghost@cs.msu.su References: <18509.7945.19078.399646@kahikatea.snap.net.nz> <200806091428.29157.pedro@codesourcery.com> In-Reply-To: <200806091428.29157.pedro@codesourcery.com> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Message-Id: <200806091459.31482.pedro@codesourcery.com> 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-06/txt/msg00162.txt.bz2 A Monday 09 June 2008 14:28:28, Pedro Alves wrote: > Plus, do_captured_thread_select is already printing the thread change > to MI, which means you'll get the output twice now, in MI? Oh, got it, you're the output as an event in the observer. The rest of the comment still applies though. Another issue: A Monday 09 June 2008 13:16:09, Nick Roberts wrote: > /* Print notices when new threads are attached and detached. */ > Index: infrun.c > =================================================================== > RCS file: /cvs/src/src/gdb/infrun.c,v > retrieving revision 1.278 > diff -p -u -p -r1.278 infrun.c > --- infrun.c 6 Jun 2008 00:33:52 -0000 1.278 > +++ infrun.c 9 Jun 2008 12:13:25 -0000 > @@ -3605,6 +3605,7 @@ normal_stop (void) > target_terminal_ours_for_output (); > printf_filtered (_("[Switching to %s]\n"), > target_pid_to_str (inferior_ptid)); > + observer_notify_thread_changed (); > annotate_thread_changed (); > previous_inferior_ptid = inferior_ptid; > } Hmm, will we want the observer to have access to the selected frame of the new selected thread? If so, then, the observer call should be moved to the end of normal_stop after the "done:" label, so any dummy frame is poped; if not, then I guess a comment here would be good, as it seems something natural to be doing from inside the observer in the future. Also, it may make sense to add a "reason" parameter to the observer, as in "changed due to user/frontend request", or "due to a stop event", but that's not actually required right now. -- Pedro Alves From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4320 invoked by alias); 9 Jun 2008 13:59:58 -0000 Received: (qmail 4298 invoked by uid 22791); 9 Jun 2008 13:59:57 -0000 X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 09 Jun 2008 13:59:35 +0000 Received: (qmail 23719 invoked from network); 9 Jun 2008 13:59:33 -0000 Received: from unknown (HELO orlando.local) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 9 Jun 2008 13:59:33 -0000 From: Pedro Alves To: gdb-patches@sourceware.org Subject: Re: [patch:MI] Observer for thread-changed Date: Mon, 09 Jun 2008 14:15:00 -0000 User-Agent: KMail/1.9.9 Cc: Nick Roberts , gdb-patches@sources.redhat.com, ghost@cs.msu.su References: <18509.7945.19078.399646@kahikatea.snap.net.nz> <200806091428.29157.pedro@codesourcery.com> In-Reply-To: <200806091428.29157.pedro@codesourcery.com> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Message-ID: <200806091459.31482.pedro@codesourcery.com> 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-06/txt/msg00161.txt.bz2 Message-ID: <20080609141500.YdCEn4GPyKPURFMxO_bUdOb2g8ccNeHDC2a2LPpSLEA@z> A Monday 09 June 2008 14:28:28, Pedro Alves wrote: > Plus, do_captured_thread_select is already printing the thread change > to MI, which means you'll get the output twice now, in MI? Oh, got it, you're the output as an event in the observer. The rest of the comment still applies though. Another issue: A Monday 09 June 2008 13:16:09, Nick Roberts wrote: > /* Print notices when new threads are attached and detached. */ > Index: infrun.c > =================================================================== > RCS file: /cvs/src/src/gdb/infrun.c,v > retrieving revision 1.278 > diff -p -u -p -r1.278 infrun.c > --- infrun.c 6 Jun 2008 00:33:52 -0000 1.278 > +++ infrun.c 9 Jun 2008 12:13:25 -0000 > @@ -3605,6 +3605,7 @@ normal_stop (void) > target_terminal_ours_for_output (); > printf_filtered (_("[Switching to %s]\n"), > target_pid_to_str (inferior_ptid)); > + observer_notify_thread_changed (); > annotate_thread_changed (); > previous_inferior_ptid = inferior_ptid; > } Hmm, will we want the observer to have access to the selected frame of the new selected thread? If so, then, the observer call should be moved to the end of normal_stop after the "done:" label, so any dummy frame is poped; if not, then I guess a comment here would be good, as it seems something natural to be doing from inside the observer in the future. Also, it may make sense to add a "reason" parameter to the observer, as in "changed due to user/frontend request", or "due to a stop event", but that's not actually required right now. -- Pedro Alves