diff options
author | Vladimir Prus <vladimir@codesourcery.com> | 2008-03-14 17:21:08 +0000 |
---|---|---|
committer | Vladimir Prus <vladimir@codesourcery.com> | 2008-03-14 17:21:08 +0000 |
commit | 683f2885af8be6282b3a89b77b0bf06a616c0040 (patch) | |
tree | 5509137dc1e48acb3860e6381fff5d420a322249 /gdb/mi | |
parent | 0f2830ff5e67bb402e811cfb857c4f22bd7df455 (diff) | |
download | gdb-683f2885af8be6282b3a89b77b0bf06a616c0040.zip gdb-683f2885af8be6282b3a89b77b0bf06a616c0040.tar.gz gdb-683f2885af8be6282b3a89b77b0bf06a616c0040.tar.bz2 |
Implement MI notification for new threads.
* doc/observer.texi (new_thread): Document.
* observer.sh: Forward declare struct thread_info.
* thread.c (add_thread): Notify observer.
* interps.h (interp_init_ftype): New parameter
top_level.
(interp_set): Likewise.
(top_level_interpreter_data): Declare.
* interps.c (interp_set): New parameter top_level.
Pass it to interpreter's init function. Remember
top level interpreter.
(interpreter_exec_cmd): Adjust.
(top_level_interpreter_data): New.
* main.c (captured_main): Pass 1 for top_level
parameter of interp_set.
* cli/cli-interp.c (cli_interpreter_init): New
parameter top_level.
* tui/tui-interp.c (tui_init): New parameter top_level.
* mi/mi-interp.c (mi_new_thread): New.
(mi_interpreter_init): If top level, register
observer for new threads.
* Makefile.in (mi-interp.o, thread.o): Update dependencies.
Diffstat (limited to 'gdb/mi')
-rw-r--r-- | gdb/mi/mi-interp.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c index eb924cd..96229a0 100644 --- a/gdb/mi/mi-interp.c +++ b/gdb/mi/mi-interp.c @@ -31,6 +31,8 @@ #include "mi-cmds.h" #include "mi-out.h" #include "mi-console.h" +#include "observer.h" +#include "gdbthread.h" struct mi_interp { @@ -64,8 +66,10 @@ static void mi1_command_loop (void); 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_interpreter_init (void) +mi_interpreter_init (int top_level) { struct mi_interp *mi = XMALLOC (struct mi_interp); @@ -83,6 +87,9 @@ mi_interpreter_init (void) mi->targ = mi_console_file_new (raw_stdout, "@", '"'); mi->event_channel = mi_console_file_new (raw_stdout, "=", 0); + if (top_level) + observer_attach_new_thread (mi_new_thread); + return mi; } @@ -314,6 +321,15 @@ mi_command_loop (int mi_version) start_event_loop (); } +static void +mi_new_thread (struct thread_info *t) +{ + struct mi_interp *mi = top_level_interpreter_data (); + + fprintf_unfiltered (mi->event_channel, "thread-created,id=%d", t->num); + gdb_flush (mi->event_channel); +} + extern initialize_file_ftype _initialize_mi_interp; /* -Wmissing-prototypes */ void |