[PATCH] New annotation for threads

Nick Roberts nickrob@snap.net.nz
Thu May 1 23:31:00 GMT 2008


 > >  > 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



More information about the Gdb-patches mailing list