diff options
author | Pedro Alves <palves@redhat.com> | 2009-07-02 21:57:28 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2009-07-02 21:57:28 +0000 |
commit | 2277426b30143428d49daf1d3e422f5096c4c4cb (patch) | |
tree | e02a568122cbe0c10f2fdf3761746e39b35492f7 /gdb/doc | |
parent | 59837fe086d095b2ce147ac6e3539f6843007f4f (diff) | |
download | gdb-2277426b30143428d49daf1d3e422f5096c4c4cb.zip gdb-2277426b30143428d49daf1d3e422f5096c4c4cb.tar.gz gdb-2277426b30143428d49daf1d3e422f5096c4c4cb.tar.bz2 |
gdb/
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.
Diffstat (limited to 'gdb/doc')
-rw-r--r-- | gdb/doc/ChangeLog | 9 | ||||
-rw-r--r-- | gdb/doc/gdb.texinfo | 88 |
2 files changed, 52 insertions, 45 deletions
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index f5d4950..2ed8cc8 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,12 @@ +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. + 2009-07-02 Ulrich Weigand <uweigand@de.ibm.com> * gdbint.texinfo (Item Output Functions): Update signature diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 272e807..d1ce3e1 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -2374,7 +2374,39 @@ To find out what inferiors exist at any moment, use @code{info inferiors}: @kindex info inferiors @item info inferiors Print a list of all inferiors currently being managed by @value{GDBN}. +@end table + +To switch focus between inferiors, use the @code{inferior} command: + +@table @code +@kindex inferior @var{inferior-id} +@item inferior @var{inferior-id} +Make inferior number @var{inferior-id} the current inferior. The +argument @var{inferior-id} is the internal inferior number assigned by +@value{GDBN}, as shown in the first field of the @samp{info inferiors} +display. +@end table + +To quit debugging one of the inferiors, you can either detach from it +by using the @w{@code{detach inferior}} command (allowing it to run +independently), or kill it using the @w{@code{kill inferior}} command: +@table @code +@kindex detach inferior @var{inferior-id} +@item detach inferior @var{inferior-id} +Detach from the inferior identified by @value{GDBN} inferior number +@var{inferior-id}, and remove it from the inferior list. + +@kindex kill inferior @var{inferior-id} +@item kill inferior @var{inferior-id} +Kill the inferior identified by @value{GDBN} inferior number +@var{inferior-id}, and remove it from the inferior list. +@end table + +To be notified when inferiors are started or exit under @value{GDBN}'s +control use @w{@code{set print inferior-events}}: + +@table @code @kindex set print inferior-events @cindex print messages on inferior start and exit @item set print inferior-events @@ -2758,51 +2790,17 @@ is held suspended. Show whether detach-on-fork mode is on/off. @end table -If you choose to set @samp{detach-on-fork} mode off, then -@value{GDBN} will retain control of all forked processes (including -nested forks). You can list the forked processes under the control of -@value{GDBN} by using the @w{@code{info forks}} command, and switch -from one fork to another by using the @w{@code{fork}} command. - -@table @code -@kindex info forks -@item info forks -Print a list of all forked processes under the control of @value{GDBN}. -The listing will include a fork id, a process id, and the current -position (program counter) of the process. - -@kindex fork @var{fork-id} -@item fork @var{fork-id} -Make fork number @var{fork-id} the current process. The argument -@var{fork-id} is the internal fork number assigned by @value{GDBN}, -as shown in the first field of the @samp{info forks} display. - -@kindex process @var{process-id} -@item process @var{process-id} -Make process number @var{process-id} the current process. The -argument @var{process-id} must be one that is listed in the output of -@samp{info forks}. - -@end table +If you choose to set @samp{detach-on-fork} mode off, then @value{GDBN} +will retain control of all forked processes (including nested forks). +You can list the forked processes under the control of @value{GDBN} by +using the @w{@code{info inferiors}} command, and switch from one fork +to another by using the @code{inferior} command (@pxref{Inferiors, +,Debugging Multiple Inferiors}). To quit debugging one of the forked processes, you can either detach -from it by using the @w{@code{detach fork}} command (allowing it to -run independently), or delete (and kill) it using the -@w{@code{delete fork}} command. - -@table @code -@kindex detach fork @var{fork-id} -@item detach fork @var{fork-id} -Detach from the process identified by @value{GDBN} fork number -@var{fork-id}, and remove it from the fork list. The process will be -allowed to run independently. - -@kindex delete fork @var{fork-id} -@item delete fork @var{fork-id} -Kill the process identified by @value{GDBN} fork number @var{fork-id}, -and remove it from the fork list. - -@end table +from it by using the @w{@code{detach inferior}} command (allowing it +to run independently), or kill it using the @w{@code{kill inferior}} +command. @xref{Inferiors, ,Debugging Multiple Inferiors}. If you ask to debug a child process and a @code{vfork} is followed by an @code{exec}, @value{GDBN} executes the new target up to the first @@ -2810,8 +2808,8 @@ breakpoint in the new target. If you have a breakpoint set on @code{main} in your original program, the breakpoint will also be set on the child process's @code{main}. -When a child process is spawned by @code{vfork}, you cannot debug the -child or parent until an @code{exec} call completes. +On some systems, when a child process is spawned by @code{vfork}, you +cannot debug the child or parent until an @code{exec} call completes. If you issue a @code{run} command to @value{GDBN} after an @code{exec} call executes, the new target restarts. To restart the parent process, |