2008-05-03 Pedro Alves <pedro@codesourcery.com>
authorVladimir Prus <vladimir@codesourcery.com>
Sat, 3 May 2008 15:10:42 +0000 (15:10 +0000)
committerVladimir Prus <vladimir@codesourcery.com>
Sat, 3 May 2008 15:10:42 +0000 (15:10 +0000)
* thread.c (delete_thread): Call observer_notify_thread_exit.
        * mi/mi-interp.c (mi_interpreter_init): Register mi_thread_exit as
        thread_exit observer.
        (mi_thread_exit): New.

gdb/ChangeLog
gdb/doc/ChangeLog
gdb/doc/observer.texi
gdb/linux-nat.c
gdb/mi/mi-interp.c
gdb/thread.c

index 8928db44c5a33174c544e0954795e78ed99930a9..7aed9278d8ec20b0595f81ef22289d57f4611ac4 100644 (file)
@@ -1,3 +1,10 @@
+2008-05-03  Pedro Alves  <pedro@codesourcery.com>
+
+       * thread.c (delete_thread): Call observer_notify_thread_exit.
+        * mi/mi-interp.c (mi_interpreter_init): Register mi_thread_exit as
+        thread_exit observer.
+        (mi_thread_exit): New.
+
 2008-05-03  Thiago Jung Bauermann  <bauerman@br.ibm.com>
 
        * breakpoint.c (create_exception_catchpoint): Remove prototype
index fd92048207afb61d0228a09e12e805f6d16faa2b..afcdb9b42821e4ff9e88db6713c364b798f70f0f 100644 (file)
@@ -1,3 +1,7 @@
+2008-05-03  Pedro Alves  <pedro@codesourcery.com>
+
+       * observer.texi (thread_exit): New.
+
 2008-05-02  Pedro Alves  <pedro@codesourcery.com>
 
        * gdb.texinfo (Debugging Output): Document "set/show debug
index 5bcc76c6560cb200d77584a4847d97b0c2ec5d54..af3835bafb2ecc040608eba7b7153f55caec9e67 100644 (file)
@@ -133,3 +133,7 @@ previously loaded symbol table data has now been invalidated.
 The thread specified by @var{t} has been created.
 @end deftypefun
 
+@deftypefun void thread_exit (struct thread_info *@var{t})
+The thread specified by @var{t} has exited.
+@end deftypefun
+
index 246712cb5a71e9789df713c9eeffc1847923bad8..4b6c6142abffbffeb7ad4717426d204d78a9bb60 100644 (file)
@@ -1022,7 +1022,9 @@ prune_lwps (void)
 static void
 exit_lwp (struct lwp_info *lp)
 {
-  if (in_thread_list (lp->ptid))
+  struct thread_info *th = find_thread_pid (lp->ptid);
+
+  if (th)
     {
       if (print_thread_events)
        printf_unfiltered (_("[%s exited]\n"), target_pid_to_str (lp->ptid));
index 146d87540840992e0eb6ba5087cf503f80916ad4..8b0d9091c5b3db495eead22c99681675505510bd 100644 (file)
@@ -67,6 +67,7 @@ static void mi_insert_notify_hooks (void);
 static void mi_remove_notify_hooks (void);
 
 static void mi_new_thread (struct thread_info *t);
+static void mi_thread_exit (struct thread_info *t);
 
 static void *
 mi_interpreter_init (int top_level)
@@ -88,7 +89,10 @@ mi_interpreter_init (int top_level)
   mi->event_channel = mi_console_file_new (raw_stdout, "=", 0);
 
   if (top_level)
-    observer_attach_new_thread (mi_new_thread);
+    {
+      observer_attach_new_thread (mi_new_thread);
+      observer_attach_thread_exit (mi_thread_exit);
+    }
 
   return mi;
 }
@@ -317,6 +321,16 @@ mi_new_thread (struct thread_info *t)
   gdb_flush (mi->event_channel);
 }
 
+static void
+mi_thread_exit (struct thread_info *t)
+{
+  struct mi_interp *mi = top_level_interpreter_data ();
+
+  target_terminal_ours ();
+  fprintf_unfiltered (mi->event_channel, "thread-exited,id=\"%d\"", t->num);
+  gdb_flush (mi->event_channel);
+}
+
 extern initialize_file_ftype _initialize_mi_interp; /* -Wmissing-prototypes */
 
 void
index c04c989e829677a0eb9b9cf27506edf4827acfe1..3de3289a480341ca53783fc7acb7b151654b8250 100644 (file)
@@ -170,6 +170,8 @@ delete_thread (ptid_t ptid)
   else
     thread_list = tp->next;
 
+  observer_notify_thread_exit (tp);
+
   free_thread (tp);
 }
 
This page took 0.037365 seconds and 4 git commands to generate.