diff options
author | Vladimir Prus <vladimir@codesourcery.com> | 2010-02-24 07:51:46 +0000 |
---|---|---|
committer | Vladimir Prus <vladimir@codesourcery.com> | 2010-02-24 07:51:46 +0000 |
commit | a79b8f6ea8c26650ad9b6f29e3df46f86f4f3530 (patch) | |
tree | d5b62817438cabc5c97eed521f7366b4b52a0aab /gdb/inferior.c | |
parent | 115d30f9b6746bc41746961a4f4bab5183c6eb80 (diff) | |
download | gdb-a79b8f6ea8c26650ad9b6f29e3df46f86f4f3530.zip gdb-a79b8f6ea8c26650ad9b6f29e3df46f86f4f3530.tar.gz gdb-a79b8f6ea8c26650ad9b6f29e3df46f86f4f3530.tar.bz2 |
Multiexec MI
* breakpoint.c (clear_syscall_counts): Take struct inferior*.
* inferior.c (add_inferior_silent): Notify inferior_added
observer.
(delete_inferior_1): Notify inferior_removed observer.
(exit_inferior_1): Pass inferior, not pid, to observer.
(inferior_appeared): Likewise.
(add_inferior_with_spaces): New.
(add_inferior_command): Use the above.
* inferior.h (delete_inferior_1, add_inferior_with_spaces):
Declare.
* inflow.c (inflow_inferior_exit): Likewise.
* jit.c (jit_inferior_exit_hook): Likewise.
* mi/mi-cmds.c (mi_cmds): Register add-inferior and
remove-inferior.
* mi/mi-cmds.h (mi_cmd_add_inferior, mi_cmd_remove_inferior): New.
* mi/mi-interp.c (mi_inferior_added, mi_inferior_removed): New.
(report_initial_inferior): New.
(mi_inferior_removed): Register the above. Make sure
inferior_added observer is called on the first inferior.
(mi_new_thread, mi_thread_exit): Thread group is now identified by
inferior number, not pid.
(mi_solib_loaded, mi_solib_unloaded): Report which inferiors are
affected.
* mi/mi-main.c (current_context): New.
(proceed_thread_callback): Use typed closure.
Proceed everything if pid is 0. Most implementation split into
(proceed_thread): ... this.
(run_one_inferior): New.
(mi_cmd_exec_continue, mi_cmd_exec_interrupt, mi_cmd_exec_run):
Adjust for multiexec behaviour.
(mi_cmd_add_inferior, mi_cmd_remove_inferior): New.
(mi_cmd_execute): Handle the 'thread-group' option here.
Do some extra checks.
* mi-parse.c (mi_parse): Handle the --all and --thread-group
options.
* mi-parse.h (struct mi_parse): New fields all and thread_group.
Diffstat (limited to 'gdb/inferior.c')
-rw-r--r-- | gdb/inferior.c | 43 |
1 files changed, 27 insertions, 16 deletions
diff --git a/gdb/inferior.c b/gdb/inferior.c index 0667bfa..f1991c9 100644 --- a/gdb/inferior.c +++ b/gdb/inferior.c @@ -133,6 +133,8 @@ add_inferior_silent (int pid) inferior_alloc_data (inf); + observer_notify_inferior_added (inf); + if (pid != 0) inferior_appeared (inf, pid); @@ -194,7 +196,7 @@ delete_threads_of_inferior (int pid) /* If SILENT then be quiet -- don't announce a inferior death, or the exit of its threads. */ -static void +void delete_inferior_1 (struct inferior *todel, int silent) { struct inferior *inf, *infprev; @@ -219,6 +221,8 @@ delete_inferior_1 (struct inferior *todel, int silent) else inferior_list = inf->next; + observer_notify_inferior_removed (inf); + free_inferior (inf); } @@ -265,7 +269,7 @@ exit_inferior_1 (struct inferior *inftoex, int silent) /* Notify the observers before removing the inferior from the list, so that the observers have a chance to look it up. */ - observer_notify_inferior_exit (inf->pid); + observer_notify_inferior_exit (inf); inf->pid = 0; if (inf->vfork_parent != NULL) @@ -315,7 +319,7 @@ inferior_appeared (struct inferior *inf, int pid) { inf->pid = pid; - observer_notify_inferior_appeared (pid); + observer_notify_inferior_appeared (inf); } void @@ -738,6 +742,24 @@ remove_inferior_command (char *args, int from_tty) delete_inferior_1 (inf, 1); } +struct inferior * +add_inferior_with_spaces (void) +{ + struct address_space *aspace; + struct program_space *pspace; + struct inferior *inf; + + /* If all inferiors share an address space on this system, this + doesn't really return a new address space; otherwise, it + really does. */ + aspace = maybe_new_address_space (); + pspace = add_program_space (aspace); + inf = add_inferior (0); + inf->pspace = pspace; + inf->aspace = pspace->aspace; + + return inf; +} /* add-inferior [-copies N] [-exec FILENAME] */ @@ -782,18 +804,7 @@ add_inferior_command (char *args, int from_tty) for (i = 0; i < copies; ++i) { - struct address_space *aspace; - struct program_space *pspace; - struct inferior *inf; - - /* If all inferiors share an address space on this system, this - doesn't really return a new address space; otherwise, it - really does. */ - aspace = maybe_new_address_space (); - pspace = add_program_space (aspace); - inf = add_inferior (0); - inf->pspace = pspace; - inf->aspace = pspace->aspace; + struct inferior *inf = add_inferior_with_spaces (); printf_filtered (_("Added inferior %d\n"), inf->num); @@ -801,7 +812,7 @@ add_inferior_command (char *args, int from_tty) { /* Switch over temporarily, while reading executable and symbols.q */ - set_current_program_space (pspace); + set_current_program_space (inf->pspace); set_current_inferior (inf); switch_to_thread (null_ptid); |