[patch:MI] Observer for thread-changed

Pedro Alves pedro@codesourcery.com
Mon Jun 9 15:06:00 GMT 2008


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



More information about the Gdb-patches mailing list