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/testsuite | |
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/testsuite')
-rw-r--r-- | gdb/testsuite/ChangeLog | 10 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/ending-run.exp | 2 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/help.exp | 4 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/multi-forks.exp | 86 |
4 files changed, 63 insertions, 39 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index ca40ca3..2d28df1 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,13 @@ +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. + 2009-07-02 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> * gdb.threads/tls-shared.exp: Update to locexpr_describe_location diff --git a/gdb/testsuite/gdb.base/ending-run.exp b/gdb/testsuite/gdb.base/ending-run.exp index cf33602..bc97e37 100644 --- a/gdb/testsuite/gdb.base/ending-run.exp +++ b/gdb/testsuite/gdb.base/ending-run.exp @@ -71,7 +71,7 @@ gdb_test "b ending-run.c:14" ".*Note.*also.*Breakpoint.*5.*" "b ending-run.c:14, gdb_test "cle ending-run.c:14" \ ".*Deleted breakpoint 5.*" "Cleared 2 by line" -send_gdb "inf line ending-run.c:14\n" +send_gdb "info line ending-run.c:14\n" gdb_expect { -re ".*address (0x\[0-9a-fA-F]*).*$gdb_prompt $" { set line_nine $expect_out(1,string) diff --git a/gdb/testsuite/gdb.base/help.exp b/gdb/testsuite/gdb.base/help.exp index 4618a2c..5647101 100644 --- a/gdb/testsuite/gdb.base/help.exp +++ b/gdb/testsuite/gdb.base/help.exp @@ -300,7 +300,9 @@ gdb_test "help inspect" "Same as \"print\" command, except that if you are runni # test help jump gdb_test "help jump" "Continue program being debugged at specified line or address\.\[\r\n\]+Give as argument either LINENUM or \[*\]+ADDR, where ADDR is an expression\[\r\n\]+for an address to start at\." "help jump" # test help kill -gdb_test "help kill" "Kill execution of program being debugged\." "help kill" +test_prefix_command_help "kill" { + "Kill execution of program being debugged\.\[\r\n\]+" +} # test help list "l" abbreviation gdb_test "help l" "List specified function or line\.\[\r\n\]+With no argument, lists ten more lines after or around previous listing\.\[\r\n\]+\"list -\" lists the ten lines before a previous ten-line listing\.\[\r\n\]+One argument specifies a line, and ten lines are listed around that line\.\[\r\n\]+Two arguments with comma between specify starting and ending lines to list\.\[\r\n\]+Lines can be specified in these ways:\[\r\n\]+ LINENUM, to list around that line in current file,\[\r\n\]+ FILE:LINENUM, to list around that line in that file,\[\r\n\]+ FUNCTION, to list around beginning of that function,\[\r\n\]+ FILE:FUNCTION, to distinguish among like-named static functions\.\[\r\n\]+ \[*\]ADDRESS, to list around the line containing that address\.\[\r\n\]+With two args if one is empty it stands for ten lines away from the other arg\." "help list \"l\" abbreviation" # test help list diff --git a/gdb/testsuite/gdb.base/multi-forks.exp b/gdb/testsuite/gdb.base/multi-forks.exp index f853180..c09c559 100644 --- a/gdb/testsuite/gdb.base/multi-forks.exp +++ b/gdb/testsuite/gdb.base/multi-forks.exp @@ -140,6 +140,19 @@ gdb_test "print pids\[0\]==0 || pids\[1\]==0 || pids\[2\]==0 || pids\[3\]==0" \ # Now test with detach-on-fork off. # +# detach-on-fork isn't implemented on hpux. +# +if {![istarget "*-*-linux*"]} then { + continue +} + +# Start with a fresh gdb + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + runto_main gdb_breakpoint $exit_bp_loc @@ -152,60 +165,59 @@ gdb_test "set detach off" "" "set detach off" # # We will now run every fork up to the exit bp, -# eventually winding up with 16 forks. +# eventually winding up with 16 inferiors. # for {set i 1} {$i <= 15} {incr i} { gdb_test "continue" "Breakpoint .* main .*exit.*" "Run to exit $i" - gdb_test "info fork" " 4 .* 3 .* 2 .* 1 .*" "info fork $i" - gdb_test "restart $i" "(_dl_sysinfo_int80|fork|__kernel_(v|)syscall).*" \ - "restart $i" + gdb_test "info inferior" " 5 .* 4 .* 3 .* 2 .*" "info inferior $i" + gdb_test "inferior $i + 1" "(_dl_sysinfo_int80|fork|__kernel_(v|)syscall).*" \ + "inferior $i" } gdb_test "continue" "Breakpoint .* main .*exit.*" "Run to exit 16" -gdb_test "info fork" " 4 .* 3 .* 2 .* 1 .*" "info fork 16" -gdb_test "restart 0" " main .*" "restart final" +gdb_test "info inferiors" " 5 .* 4 .* 3 .* 2 .*" "info inferior 16" +gdb_test "inferior 2" " main .*" "restart final" # # Now we should examine all the pids. # # -# Test detach fork +# Test detach inferior # -# [assumes we're at #0] -gdb_test "detach fork 1" "Detached .*" "Detach 1" -gdb_test "detach fork 2" "Detached .*" "Detach 2" -gdb_test "detach fork 3" "Detached .*" "Detach 3" -gdb_test "detach fork 4" "Detached .*" "Detach 4" +# [assumes we're at #1] +gdb_test "detach inferior 2" "Detaching .*" "Detach 2" +gdb_test "detach inferior 3" "Detaching .*" "Detach 3" +gdb_test "detach inferior 4" "Detaching .*" "Detach 4" +gdb_test "detach inferior 5" "Detaching .*" "Detach 5" # -# Test delete fork -# +# Test kill inferior +# -gdb_test "delete fork 5" "" "Delete 5" -gdb_test "info fork 5" "No fork number 5." "Did delete 5" -gdb_test "delete fork 6" "" "Delete 6" -gdb_test "info fork 6" "No fork number 6." "Did delete 6" -gdb_test "delete fork 7" "" "Delete 7" -gdb_test "info fork 7" "No fork number 7." "Did delete 7" -gdb_test "delete fork 8" "" "Delete 8" -gdb_test "info fork 8" "No fork number 8." "Did delete 8" -gdb_test "delete fork 9" "" "Delete 9" -gdb_test "info fork 9" "No fork number 9." "Did delete 9" -gdb_test "delete fork 10" "" "Delete 10" -gdb_test "info fork 10" "No fork number 10." "Did delete 10" -gdb_test "delete fork 11" "" "Delete 11" -gdb_test "info fork 11" "No fork number 11." "Did delete 11" -gdb_test "delete fork 12" "" "Delete 12" -gdb_test "info fork 12" "No fork number 12." "Did delete 12" -gdb_test "delete fork 13" "" "Delete 13" -gdb_test "info fork 13" "No fork number 13." "Did delete 13" -gdb_test "delete fork 14" "" "Delete 14" -gdb_test "info fork 14" "No fork number 14." "Did delete 14" -gdb_test "delete fork 15" "" "Delete 15" -gdb_test "info fork 15" "No fork number 15." "Did delete 15" +gdb_test "kill inferior 6" "" "Kill 6" +gdb_test "info inferior 6" "Inferior ID 6 not known." "Did kill 6" +gdb_test "kill inferior 7" "" "Kill 7" +gdb_test "info inferior 7" "Inferior ID 7 not known." "Did kill 7" +gdb_test "kill inferior 8" "" "Kill 8" +gdb_test "info inferior 8" "Inferior ID 8 not known." "Did kill 8" +gdb_test "kill inferior 9" "" "Kill 9" +gdb_test "info inferior 9" "Inferior ID 9 not known." "Did kill 9" +gdb_test "kill inferior 10" "" "Kill 10" +gdb_test "info inferior 10" "Inferior ID 10 not known." "Did kill 10" +gdb_test "kill inferior 11" "" "Kill 11" +gdb_test "info inferior 11" "Inferior ID 11 not known." "Did kill 11" +gdb_test "kill inferior 12" "" "Kill 12" +gdb_test "info inferior 12" "Inferior ID 12 not known." "Did kill 12" +gdb_test "kill inferior 13" "" "Kill 13" +gdb_test "info inferior 13" "Inferior ID 13 not known." "Did kill 13" +gdb_test "kill inferior 14" "" "Kill 14" +gdb_test "info inferior 14" "Inferior ID 14 not known." "Did kill 14" +gdb_test "kill inferior 15" "" "Kill 15" +gdb_test "info inferior 15" "Inferior ID 15 not known." "Did kill 15" +gdb_test "kill inferior 16" "" "Kill 16" +gdb_test "info inferior 16" "Inferior ID 16 not known." "Did kill 16" return 0 - |