This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA] Report the main thread.
- From: Nick Roberts <nickrob at snap dot net dot nz>
- To: gdb-patches at sourceware dot org
- Date: Sun, 11 May 2008 00:47:44 +1200
- Subject: Re: [RFA] Report the main thread.
> 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