This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] New annotation for threads
- From: Nick Roberts <nickrob at snap dot net dot nz>
- To: Joel Brobecker <brobecker at adacore dot com>
- Cc: gdb-patches at sources dot redhat dot com
- Date: Fri, 2 May 2008 11:31:05 +1200
- Subject: Re: [PATCH] New annotation for threads
- 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>
> > > 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