diff options
Diffstat (limited to 'gdb/testsuite/gdb.base')
-rw-r--r-- | gdb/testsuite/gdb.base/attach-pie-misread.exp | 16 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/attach-pie-noexec.exp | 5 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/attach-twice.exp | 5 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/attach.exp | 40 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/break-interp.exp | 10 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/solib-overlap.exp | 7 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/valgrind-infcall.exp | 8 |
7 files changed, 47 insertions, 44 deletions
diff --git a/gdb/testsuite/gdb.base/attach-pie-misread.exp b/gdb/testsuite/gdb.base/attach-pie-misread.exp index 679c050..5f09cd9 100644 --- a/gdb/testsuite/gdb.base/attach-pie-misread.exp +++ b/gdb/testsuite/gdb.base/attach-pie-misread.exp @@ -126,25 +126,25 @@ if {$first_offset == 0} { set test "start inferior" gdb_exit -set res [remote_spawn host $binfile] -if { $res < 0 || $res == "" } { +set test_spawn_id [remote_spawn host $binfile] +if { $test_spawn_id < 0 || $test_spawn_id == "" } { perror "Spawning $binfile failed." fail $test return } -set pid [exp_pid -i $res] +set testpid [spawn_id_get_pid $test_spawn_id] gdb_expect { -re "sleeping\r\n" { pass $test } eof { fail "$test (eof)" - remote_exec host "kill -9 $pid" + wait -i $test_spawn_id return } timeout { fail "$test (timeout)" - remote_exec host "kill -9 $pid" + kill_wait_spawned_process $test_spawn_id return } } @@ -176,8 +176,8 @@ foreach align_mult {1 2} { with_test_prefix "shift-by-$align_mult" { clean_restart $executable set test "attach" - gdb_test_multiple "attach $pid" $test { - -re "Attaching to program: .*, process $pid\r\n" { + gdb_test_multiple "attach $testpid" $test { + -re "Attaching to program: .*, process $testpid\r\n" { # Missing "$gdb_prompt $" is intentional. pass $test } @@ -196,4 +196,4 @@ foreach align_mult {1 2} { with_test_prefix "shift-by-$align_mult" { gdb_test "detach" "Detaching from program: .*" }} -remote_exec host "kill -9 $pid" +kill_wait_spawned_process $test_spawn_id diff --git a/gdb/testsuite/gdb.base/attach-pie-noexec.exp b/gdb/testsuite/gdb.base/attach-pie-noexec.exp index 30a2f4d..fc53b2d 100644 --- a/gdb/testsuite/gdb.base/attach-pie-noexec.exp +++ b/gdb/testsuite/gdb.base/attach-pie-noexec.exp @@ -55,7 +55,8 @@ if {$arch == ""} { # Start the program running and then wait for a bit, to be sure # that it can be attached to. -set testpid [spawn_wait_for_attach $binfile] +set test_spawn_id [spawn_wait_for_attach $binfile] +set testpid [spawn_id_get_pid $test_spawn_id] gdb_start file delete -- $binfile @@ -63,4 +64,4 @@ gdb_test "attach $testpid" "Attaching to process $testpid\r\n.*: No such file or gdb_test "set architecture $arch" "The target architecture is assumed to be $arch" gdb_test "info shared" "From\[ \t\]+To\[ \t\]+Syms Read\[ \t\]+Shared Object Library\r\n0x.*" -eval exec kill -9 $testpid +kill_wait_spawned_process $test_spawn_id diff --git a/gdb/testsuite/gdb.base/attach-twice.exp b/gdb/testsuite/gdb.base/attach-twice.exp index f6a9eb6..380c80e 100644 --- a/gdb/testsuite/gdb.base/attach-twice.exp +++ b/gdb/testsuite/gdb.base/attach-twice.exp @@ -27,7 +27,8 @@ if { [prepare_for_testing ${testfile}.exp $executable] } { # Start the program running and then wait for a bit, to be sure # that it can be attached to. -set testpid [spawn_wait_for_attach $binfile] +set test_spawn_id [spawn_wait_for_attach $binfile] +set testpid [spawn_id_get_pid $test_spawn_id] set parentpid 0 @@ -48,4 +49,4 @@ gdb_test_multiple "attach $testpid" $test { if {$parentpid != 0} { eval exec kill -9 $parentpid } -eval exec kill -9 $testpid +kill_wait_spawned_process $test_spawn_id diff --git a/gdb/testsuite/gdb.base/attach.exp b/gdb/testsuite/gdb.base/attach.exp index f2ebe3a..bf0d84e 100644 --- a/gdb/testsuite/gdb.base/attach.exp +++ b/gdb/testsuite/gdb.base/attach.exp @@ -82,7 +82,8 @@ proc do_attach_tests {} { # Start the program running and then wait for a bit, to be sure # that it can be attached to. - set testpid [spawn_wait_for_attach $binfile] + set test_spawn_id [spawn_wait_for_attach $binfile] + set testpid [spawn_id_get_pid $test_spawn_id] # Verify that we cannot attach to nonsense. @@ -279,10 +280,11 @@ proc do_attach_tests {} { # the next test run (and prevent the compile by keeping # the text file busy), in case the "set should_exit" didn't # work. - - remote_exec build "kill -9 ${testpid}" - set testpid [spawn_wait_for_attach $binfile] + kill_wait_spawned_process $test_spawn_id + + set test_spawn_id [spawn_wait_for_attach $binfile] + set testpid [spawn_id_get_pid $test_spawn_id] # Verify that we can attach to the process, and find its a.out # when we're cd'd to some directory that doesn't contain the @@ -322,14 +324,15 @@ proc do_attach_tests {} { "y" # Another "don't leave a process around" - remote_exec build "kill -9 ${testpid}" + kill_wait_spawned_process $test_spawn_id } proc do_call_attach_tests {} { global gdb_prompt global binfile2 - set testpid [spawn_wait_for_attach $binfile2] + set test_spawn_id [spawn_wait_for_attach $binfile2] + set testpid [spawn_id_get_pid $test_spawn_id] # Attach @@ -366,7 +369,7 @@ proc do_call_attach_tests {} { # Be paranoid - remote_exec build "kill -9 ${testpid}" + kill_wait_spawned_process $test_spawn_id } proc do_command_attach_tests {} { @@ -382,27 +385,21 @@ proc do_command_attach_tests {} { return 0 } - set testpid [spawn_wait_for_attach $binfile] + set test_spawn_id [spawn_wait_for_attach $binfile] + set testpid [spawn_id_get_pid $test_spawn_id] gdb_exit - if $verbose>1 then { - send_user "Spawning $GDB $INTERNAL_GDBFLAGS $GDBFLAGS --pid=$testpid\n" - } - eval "spawn $GDB $INTERNAL_GDBFLAGS $GDBFLAGS --pid=$testpid" + set res [gdb_spawn_with_cmdline_opts "--pid=$testpid"] set test "starting with --pid" - expect { + gdb_test_multiple "" $test { -re "Reading symbols from.*$gdb_prompt $" { pass "$test" } - timeout { - fail "$test (timeout)" - } } # Get rid of the process - - remote_exec build "kill -9 ${testpid}" + kill_wait_spawned_process $test_spawn_id } # Test ' gdb --pid PID -ex "run" '. GDB used to have a bug where @@ -418,7 +415,8 @@ proc test_command_line_attach_run {} { } with_test_prefix "cmdline attach run" { - set testpid [spawn_wait_for_attach $binfile] + set test_spawn_id [spawn_wait_for_attach $binfile] + set testpid [spawn_id_get_pid $test_spawn_id] set test "run to prompt" gdb_exit @@ -427,7 +425,7 @@ proc test_command_line_attach_run {} { "-iex \"set height 0\" -iex \"set width 0\" --pid=$testpid -ex \"start\""] if { $res != 0} { fail $test - remote_exec build "kill -9 ${testpid}" + kill_wait_spawned_process $test_spawn_id return $res } gdb_test_multiple "" $test { @@ -446,7 +444,7 @@ proc test_command_line_attach_run {} { } # Get rid of the process - remote_exec build "kill -9 ${testpid}" + kill_wait_spawned_process $test_spawn_id } } diff --git a/gdb/testsuite/gdb.base/break-interp.exp b/gdb/testsuite/gdb.base/break-interp.exp index aca2c02..5941159 100644 --- a/gdb/testsuite/gdb.base/break-interp.exp +++ b/gdb/testsuite/gdb.base/break-interp.exp @@ -308,23 +308,25 @@ proc test_attach {file displacement {relink_args ""}} { set test "sleep function started" set command "${file} sleep" - set res [remote_spawn host $command] - if { $res < 0 || $res == "" } { + set test_spawn_id [remote_spawn host $command] + if { $test_spawn_id < 0 || $test_spawn_id == "" } { perror "Spawning $command failed." fail $test return } - set pid [exp_pid -i $res] + set pid [spawn_id_get_pid $test_spawn_id] gdb_expect { -re "sleeping\r\n" { pass $test } eof { fail "$test (eof)" + wait -i $test_spawn_id return } timeout { fail "$test (timeout)" + kill_wait_spawned_process $test_spawn_id return } } @@ -364,7 +366,7 @@ proc test_attach {file displacement {relink_args ""}} { file_copy $interp_saved $interp } - remote_exec host "kill -9 $pid" + kill_wait_spawned_process $test_spawn_id } proc test_ld {file ifmain trynosym displacement} { diff --git a/gdb/testsuite/gdb.base/solib-overlap.exp b/gdb/testsuite/gdb.base/solib-overlap.exp index ad96d02..95a1849 100644 --- a/gdb/testsuite/gdb.base/solib-overlap.exp +++ b/gdb/testsuite/gdb.base/solib-overlap.exp @@ -81,7 +81,8 @@ foreach prelink_lib1 {0x40000000 0x50000000} { with_test_prefix "$prelink_lib1" return -1 } - set testpid [spawn_wait_for_attach $binfile] + set test_spawn_id [spawn_wait_for_attach $binfile] + set testpid [spawn_id_get_pid $test_spawn_id] remote_exec build "mv -f ${binfile_lib1} ${binfile_lib1}-running" remote_exec build "mv -f ${binfile_lib2} ${binfile_lib2}-running" @@ -92,7 +93,7 @@ foreach prelink_lib1 {0x40000000 0x50000000} { with_test_prefix "$prelink_lib1" if { [gdb_compile_shlib ${srcfile_lib} ${binfile_lib1} $lib_flags] != "" || [gdb_compile_shlib ${srcfile_lib} ${binfile_lib2} $lib_flags] != ""} { untested "Could not recompile ${binfile_lib1_test_msg} or ${binfile_lib2_test_msg}." - remote_exec build "kill -9 ${testpid}" + kill_wait_spawned_process $test_spawn_id return -1 } @@ -123,5 +124,5 @@ foreach prelink_lib1 {0x40000000 0x50000000} { with_test_prefix "$prelink_lib1" sleep 5 - remote_exec build "kill -9 ${testpid}" + kill_wait_spawned_process $test_spawn_id }} diff --git a/gdb/testsuite/gdb.base/valgrind-infcall.exp b/gdb/testsuite/gdb.base/valgrind-infcall.exp index 3d3fdd3..b835c67 100644 --- a/gdb/testsuite/gdb.base/valgrind-infcall.exp +++ b/gdb/testsuite/gdb.base/valgrind-infcall.exp @@ -76,7 +76,7 @@ gdb_test_multiple "" $test { } # Do not kill valgrind. -set valgrind_pid [exp_pid -i [board_info host fileid]] +set valgrind_spawn_id [board_info host fileid] unset gdb_spawn_id set board [host_info name] unset_board_info fileid @@ -99,13 +99,13 @@ while {$loop && $continue_count < 100} { -re "Remote connection closed.*\r\n$gdb_prompt $" { fail "$test (remote connection closed)" # Only if valgrind got stuck. - remote_exec host "kill -9 ${valgrind_pid}" + kill_wait_spawned_process $valgrind_spawn_id return -1 } -re "The program is not being run\\.\r\n$gdb_prompt $" { fail "$test (valgrind vgdb has terminated)" # Only if valgrind got stuck. - remote_exec host "kill -9 ${valgrind_pid}" + kill_wait_spawned_process $valgrind_spawn_id return -1 } -re "\r\n$gdb_prompt $" { @@ -126,4 +126,4 @@ gdb_test_multiple $test $test { } # Only if valgrind got stuck. -remote_exec host "kill -9 ${valgrind_pid}" +kill_wait_spawned_process $valgrind_spawn_id |