aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladimir Prus <vladimir@codesourcery.com>2008-05-03 15:10:42 +0000
committerVladimir Prus <vladimir@codesourcery.com>2008-05-03 15:10:42 +0000
commit063bfe2e12756ad30f4b4edb81974c0e4bd4299d (patch)
tree16adac2c33c56cb2c3fdd33e2c2e26851d195348
parent9cbdce76abdea25d9447f42b498c2ecdf5bc9a34 (diff)
downloadgdb-063bfe2e12756ad30f4b4edb81974c0e4bd4299d.zip
gdb-063bfe2e12756ad30f4b4edb81974c0e4bd4299d.tar.gz
gdb-063bfe2e12756ad30f4b4edb81974c0e4bd4299d.tar.bz2
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.
-rw-r--r--gdb/ChangeLog7
-rw-r--r--gdb/doc/ChangeLog4
-rw-r--r--gdb/doc/observer.texi4
-rw-r--r--gdb/linux-nat.c4
-rw-r--r--gdb/mi/mi-interp.c16
-rw-r--r--gdb/thread.c2
6 files changed, 35 insertions, 2 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 8928db4..7aed927 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -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
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog
index fd92048..afcdb9b 100644
--- a/gdb/doc/ChangeLog
+++ b/gdb/doc/ChangeLog
@@ -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
diff --git a/gdb/doc/observer.texi b/gdb/doc/observer.texi
index 5bcc76c..af3835b 100644
--- a/gdb/doc/observer.texi
+++ b/gdb/doc/observer.texi
@@ -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
+
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index 246712c..4b6c614 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -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));
diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c
index 146d875..8b0d909 100644
--- a/gdb/mi/mi-interp.c
+++ b/gdb/mi/mi-interp.c
@@ -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
diff --git a/gdb/thread.c b/gdb/thread.c
index c04c989..3de3289 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -170,6 +170,8 @@ delete_thread (ptid_t ptid)
else
thread_list = tp->next;
+ observer_notify_thread_exit (tp);
+
free_thread (tp);
}