Fix zero_ext documentation
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / multi-forks.exp
index feb7af114bb54b92a6e6d0ea7fb4985fb3dfb5b9..1eaaa71db15d4449813459cdac2366c98847b1cf 100644 (file)
@@ -1,5 +1,4 @@
-#   Copyright 2005, 2006, 2007, 2008, 2009, 2010
-#   Free Software Foundation, Inc.
+#   Copyright 2005-2016 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-if $tracelevel then {
-       strace $tracelevel
-       }
-
-if { [is_remote target] || ![isnative] } then {
-    continue
-}
-
 # Until "set follow-fork-mode" and "catch fork" are implemented on
 # other targets...
 #
-if {![istarget "hppa*-hp-hpux*"] && ![istarget "*-*-linux*"]} then {
+if { ![istarget "*-*-linux*"] } then {
     continue
 }
 
 
-set testfile "multi-forks"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile .c
 
 if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
      untested multi-forks.exp
@@ -41,10 +30,7 @@ if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
 
 # Start with a fresh gdb
 
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
 
 global gdb_prompt
 
@@ -60,6 +46,7 @@ set exit_bp_loc [gdb_get_line_number "Set exit breakpoint here."]
 
 proc continue_to_exit_bp_loc {} {
     global exit_bp_loc decimal gdb_prompt
+    global inferior_spawn_id gdb_spawn_id
 
     gdb_breakpoint $exit_bp_loc
 
@@ -80,6 +67,7 @@ proc continue_to_exit_bp_loc {} {
        # first in the script that occurs anywhere in the input, so that
        # we don't skip anything.
        gdb_expect {
+           -i "$inferior_spawn_id $gdb_spawn_id"
            -re "($decimal done)|(Breakpoint)|($gdb_prompt)" {
                if {[info exists expect_out(1,string)]} {
                    incr seen_done
@@ -119,8 +107,9 @@ proc continue_to_exit_bp_loc {} {
 # First set gdb to follow the child.
 # The result should be that each of the 4 forks returns zero.
 
+clean_restart ${binfile}
 runto_main
-gdb_test "set follow-fork child"
+gdb_test_no_output "set follow-fork child"
 continue_to_exit_bp_loc
 
 gdb_test "print pids" "\\$.* = \\{0, 0, 0, 0\\}.*" "follow child, print pids"
@@ -128,8 +117,9 @@ gdb_test "print pids" "\\$.* = \\{0, 0, 0, 0\\}.*" "follow child, print pids"
 # Now set gdb to follow the parent.
 # Result should be that none of the 4 forks returns zero.
 
+clean_restart ${binfile}
 runto_main
-gdb_test "set follow-fork parent" "" ""
+gdb_test_no_output "set follow-fork parent" ""
 continue_to_exit_bp_loc
 
 gdb_test "print pids\[0\]==0 || pids\[1\]==0 || pids\[2\]==0 || pids\[3\]==0" \
@@ -139,18 +129,9 @@ 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}
+clean_restart ${binfile}
 
 runto_main
 gdb_breakpoint $exit_bp_loc
@@ -160,7 +141,7 @@ gdb_test "help set detach-on-fork" "whether gdb will detach the child.*" \
 
 gdb_test "show detach-on-fork" "on." "show detach default on"
 
-gdb_test "set detach off" "" "set detach off"
+gdb_test_no_output "set detach off" "set detach off"
 
 #
 # We will now run every fork up to the exit bp, 
@@ -169,13 +150,13 @@ gdb_test "set detach off" "" "set detach off"
 
 for {set i 1} {$i <= 15} {incr i} {
   gdb_test "continue" "Breakpoint .* main .*exit.*" "Run to exit $i"
-  gdb_test "info inferior" " 5 .* 4 .* 3 .* 2 .*" "info inferior $i"
+  gdb_test "info inferior" " 2 .* 3 .* 4 .* 5 .*" "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 inferiors" " 5 .* 4 .* 3 .* 2 .*" "info inferior 16"
+gdb_test "info inferior" " 2 .* 3 .* 4 .* 5 .*" "info inferior 16"
 gdb_test "inferior 2" " main .*" "restart final"
 
 #
@@ -196,27 +177,9 @@ gdb_test "detach inferior 5" "Detaching .*" "Detach 5"
 # Test kill inferior
 #
 
-gdb_test "kill inferior 6" "" "Kill 6"
-gdb_test "info inferior 6" "<null>.*" "Did kill 6"
-gdb_test "kill inferior 7" "" "Kill 7"
-gdb_test "info inferior 7" "<null>.*" "Did kill 7"
-gdb_test "kill inferior 8" "" "Kill 8"
-gdb_test "info inferior 8" "<null>.*" "Did kill 8"
-gdb_test "kill inferior 9" "" "Kill 9"
-gdb_test "info inferior 9" "<null>.*" "Did kill 9"
-gdb_test "kill inferior 10" "" "Kill 10"
-gdb_test "info inferior 10" "<null>.*" "Did kill 10"
-gdb_test "kill inferior 11" "" "Kill 11"
-gdb_test "info inferior 11" "<null>.*" "Did kill 11"
-gdb_test "kill inferior 12" "" "Kill 12"
-gdb_test "info inferior 12" "<null>.*" "Did kill 12"
-gdb_test "kill inferior 13" "" "Kill 13"
-gdb_test "info inferior 13" "<null>.*" "Did kill 13"
-gdb_test "kill inferior 14" "" "Kill 14"
-gdb_test "info inferior 14" "<null>.*" "Did kill 14"
-gdb_test "kill inferior 15" "" "Kill 15"
-gdb_test "info inferior 15" "<null>.*" "Did kill 15"
-gdb_test "kill inferior 16" "" "Kill 16"
-gdb_test "info inferior 16" "<null>.*" "Did kill 16"
+for {set i 6} { $i <= 16} {incr i} {
+    gdb_test_no_output "kill inferior $i" "Kill $i"
+    gdb_test "info inferior $i" "<null>.*" "Did kill $i"
+}
 
 return 0
This page took 0.026841 seconds and 4 git commands to generate.