This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] New annotation for threads
- From: Joel Brobecker <brobecker at adacore dot com>
- To: Nick Roberts <nickrob at snap dot net dot nz>
- Cc: gdb-patches at sources dot redhat dot com
- Date: Thu, 1 May 2008 11:17:58 -0700
- 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>
> > I'd really like to have others' opinions on this one. I thought that
> > we weren't going to change our annotations anymore. And even though
> > we were not going to remove annotations for a while longer, we were
> > going to focuse on MI instead.
>
> It doesn't impede MI development, so you could think of it as orthogonal.
> Clearly it can eventually be removed with the rest of annotations.
OK, here is what I can propose: Send a patch for approval that implements
this new annotation using observers. I will review it, and then we will
let it sit for an extra week to give everyone time to object if they
disagree.
> > > 2008-04-18 Nick Roberts <nickrob@snap.net.nz>
> > >
> > > * annotate.h: (annotate_new_thread): New extern.
> > >
> > > * annotate.c (annotate_new_thread): New function.
> > >
> > > * thread.c (add_thread_with_info): Use it.
> >
> > 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);
All this can be done inside annotate.c.
--
Joel