* inferior.c (print_inferior): Align columns left. Remove header
for the the "current" column. Rename column "Id" to "Num".
Rename column "PID" to "Description". Print if there's no selected
inferior.
gdb/doc/
* gdb.texinfo (Debugging Multiple Inferiors): Add "info inferiors"
small example, and describe its columns. Replace "inferior-id" by
"infno" throughout.
2009-07-02 Pedro Alves <pedro@codesourcery.com>
* linux-nat.c (linux_child_follow_fork): If we're staying attached
to the child process, enable event reporting on it. Don't handle
checkpoints here. Instead, add the child fork to the lwp thread
and inferior lists without clobbering the previous inferior. Let
the thread_db layer learn about a new child process, even if
following the parent.
(linux_nat_switch_fork): Delete lwps of the current inferior only,
instead of clearing the whole list. Use thread_change_ptid to
give the core the illusion the new checkpoint is still the same
inferior. Clear the register cache.
(linux_handle_extended_wait): Handle checkpoints here.
(linux_multi_process): Turn on.
* linux-fork.c (struct fork_info) <pc>: Remove field.
(init_fork_list): Do not delete the checkpoint from the inferior
list (it is not there).
(fork_load_infrun_state): Don't switch inferior_ptid here. Pass
the new checkpoint's ptid to linux_nat_switch_fork.
(fork_save_infrun_state): Make static. Don't stop the pc field of
fork_info, it's gone.
(linux_fork_mourn_inferior): Don't delete the checkpoint from the
inferior list, it's not there.
(linux_fork_detach): Ditto.
(delete_fork_command): Replace mention of fork/checkpoint by
checkpoint only.
(detach_fork_command): Likewise. Don't delete the checkpoint from
the inferior list.
(info_forks_command): Adjust.
(restore_detach_fork): Delete.
(checkpointing_pid): New.
(linux_fork_checkpointing_p): New.
(save_detach_fork): Delete.
(checkpoint_command): Delete temp_detach_fork. Don't remove
breakpoints, that's a nop. Store the pid of the process we're
checkpointing, and use make_cleanup_restore_integer to restore it.
Don't reinsert breakpoints here.
(process_command, fork_command): Delete.
(restart_command): Update comments to only mention checkpoints,
not forks.
(_initialize_linux_fork): Delete "fork", "process", "info forks"
commands.
* linux-fork.h (fork_save_infrun_state, fork_list): Delete
declarations.
(linux_fork_checkpointing_p): Declare.
* cli/cli-cmds.c (killlist): New.
* cli/cli-cmds.h (killlist): Declare.
* gdbcmd.h (killlist): Declare.
* inferior.c: Include "gdbthread.h".
(detach_inferior_command, kill_inferior_command)
(inferior_command): New.
(info_inferiors_command): Allow specifying a specific inferior id.
(_initialize_inferiors): Register "inferior", "kill inferior" and
"detach inferior" commands.
* infcmd.c (_initialize_infcmd): Make "kill" a prefix command.
* gdbthread.h (any_thread_of_process): Declare.
* thread.c (any_thread_of_process): New.
* NEWS: Mention multi-inferior debugging. Mention 'info
inferiors', 'inferior', 'detach inferior' and 'kill inferior' as
new commands.
(Removed commands): New section, mentioning that 'info forks',
'fork', 'process', 'delete fork' and 'detach fork' are now gone.
gdb/testsuite/
2009-07-02 Pedro Alves <pedro@codesourcery.com>
* gdb.base/multi-forks.exp: Only run detach-on-fork tests on
linux. Adjust to use "inferior", "info inferiors", "detach
inferior" and "kill inferior" instead of "restart", "info fork",
"detach fork" and "delete fork".
* gdb.base/ending-run.exp: Spell out "info".
* gdb.base/help.exp: Adjust to use test_prefix_command_help for
the "kill" command.
gdb/doc/
2009-07-02 Pedro Alves <pedro@codesourcery.com>
* gdb.texinfo (Debugging multiple inferiors): Document the
"inferior", "detach inferior" and "kill inferior" commands.
(Debugging Programs with Multiple Processes): Adjust to mention
generic "inferior" commands. Delete mention of "detach fork" and
"delete fork". Cross reference to "Debugging multiple inferiors"
section.
(inferior_process_group): Delete global variable declaration.
(inferior_process_group): New function declaration.
* inflow.c: Include observer.h.
(inferior_ttystate, our_ttystate, tflags_inferior, tflags_ours):
Delete.
(struct terminal_info): New struct.
(our_terminal_info): New global.
(inferior_process_group): New function.
(inferior_thisrun_terminal): Extend description comment.
(gdb_has_a_terminal): Adjust to write to our_terminal_info fields
instead of globals.
(terminal_init_inferior_with_pgrp): Adjust to per-inferior
terminal settings.
(terminal_inferior): Ditto.
(terminal_ours_1): Ditto.
(inflow_new_inferior, inflow_inferior_exit): New functions.
(child_terminal_info): Adjust to per-inferior terminal settings.
(osig_set): New global.
(set_sigint_trap): Adjust to per-inferior terminal settings. Set
or clear `osig_set' accordingly.
(clear_sigint_trap): Check `osig_set' to decide wheater to restore
SIGINT handler, instead of checking the current inferior (which
may be none).
(_initialize_inflow): Attach inflow_new_inferior and
inflow_inferior_exit to the "new_inferior" and "inferior_exit"
notifications, respectively.
* inferior.h (struct terminal_info): Forward declare.
(struct inferior): Add `terminal_info' field.
* inferior.c (delete_inferior_1): Notify the inferior_exit
observers before removing the inferior from the lists and deleting
it.
* inf-ptrace.c (inf_ptrace_stop): `inferior_process_group' is now
a function instead of a variable. Adjust.
* procfs.c (procfs_stop): Ditto.
(do_all_inferior_continuations)
(discard_all_inferior_continuations): Declare.
* utils.c (add_inferior_continuation)
(do_all_inferior_continuations)
(discard_all_inferior_continuations): New.
* inferior.h (struct inferior) <continuations>: New field.
* inferior.c (free_inferior): Discard all the inferior
continuations.
* inf-loop.c (inferior_event_handler): Do all current inferior
continuations.
* infcmd.c (attach_command): Register an inferior continuation
instead of a thread continuation.
* infrun.c (handle_inferior_event): If stop_soon is
STOP_QUIETLY_NO_SIGSTOP, also expect a TARGET_SIGNAL_0.
* remote.c (struct remote_state): Add extended and
multi_process_aware fields.
(remote_multi_process_p): New.
(PACKET_vKill): New.
(record_currthread): Use thread_change_ptid. Notice new
inferiors.
(set_thread, remote_thread_alive): Use write_ptid.
(write_ptid, read_ptid): New.
(remote_current_thread, remote_threads_extra_info): Use them.
(remote_threads_info): Likewise. Detect new inferiors.
(remote_start_remote): Add inferior to inferior list.
(remote_multi_process_feature): New.
(remote_protocol_features): Add "multiprocess" feature.
(remote_query_supported): Pass "multiprocess+" as supported
features.
(remote_open_1): Clear multi_process_aware. Set extended
accordingly.
(remote_detach_1): Detach current process. Use extended packet
format for extended-remote multi-process. Detach process from the
inferior list. Only mourn after printing output.
(extended_remote_attach_1): Add process to the inferior list.
(remote_vcont_resume): Use write_ptid to pass the thread ids.
(remote_wait): Use read_ptid. Implement the extended
multi-process extension format of the 'W' and 'X' reply packets.
Remove exited inferiors from inferior list.
(remote_xfer_memory): Set general thread.
(remote_vkill): New.
(extended_remote_kill): New.
(remote_mourn_1): Discard all inferiors.
(select_new_thread_callback): New.
(extended_remote_mourn_1): If there are more processes to debug,
switch to a thread in another process, and don't pop the target.
(extended_remote_create_inferior_1): Add the new process to the
inferior list.
(remote_stopped_by_watchpoint): Indenting.
(remote_xfer_partial): Set the general thread.
(remote_pid_to_str): If the remote is multi-process aware, print
the process id as well as the thread id.
(remote_get_thread_local_address): Use write_ptid.
(init_extended_remote_ops): Register extended_remote_kill.
(_initialize_remote): Register new packets. Change
magic_null_ptid's, not_sent_ptid's and any_thread_ptid's pid
member to 42000.
* thread.c (thread_change_ptid): Also account for the inferior pid
changing.
* inferior.h (discard_all_inferiors): Declare.
* inferior.c (discard_all_inferiors): New.