[PATCH] New annotation for threads

Nick Roberts nickrob@snap.net.nz
Fri May 2 00:07:00 GMT 2008


 > The printing of the annotation was already guarded by the annotation
 > level. So you can in fact attach the observer from your _initialize
 > procedure, no?

Yes.  You're probably right this looks a better change as
observer_attach_new_thread already exists and changes are confined to
annotate.c.  The patch now looks like below.  I'll write a test and fully check
the testsuite.

Thanks.

-- 
Nick                                           http://www.inet.net.nz/~nickrob


2008-05-02  Nick Roberts  <nickrob@snap.net.nz>

	* annotate.c: Include observer.h.
	(annotate_new_thread): New function
	(_initialize_annotate): Register it in the new_thread observer.


*** annotate.c	10 Jan 2008 11:34:21 +1300	1.15
--- annotate.c	02 May 2008 11:54:05 +1200	
***************
*** 23,28 ****
--- 23,29 ----
  #include "target.h"
  #include "gdbtypes.h"
  #include "breakpoint.h"
+ #include "observer.h"
  
  
  /* Prototypes for local functions. */
*************** annotate_frames_invalid (void)
*** 234,239 ****
--- 235,249 ----
  }
  
  void
+ annotate_new_thread (struct thread_info *thread)
+ {
+   if (annotation_level > 1)
+     {
+       printf_unfiltered (("\n\032\032new-thread\n"));
+     }
+ }
+ 
+ void
  annotate_field_begin (struct type *type)
  {
    if (annotation_level == 2)
*************** _initialize_annotate (void)
*** 580,583 ****
--- 590,595 ----
        deprecated_delete_breakpoint_hook = breakpoint_changed;
        deprecated_modify_breakpoint_hook = breakpoint_changed;
      }
+ 
+     observer_attach_new_thread (annotate_new_thread);
  }



More information about the Gdb-patches mailing list