-# Copyright 1997-2015 Free Software Foundation, Inc.
+# Copyright 1997-2018 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/>. */
-
-# On HP-UX 11.0, this test is causing a process running the program
-# "attach" to be left around spinning. Until we figure out why, I am
-# commenting out the test to avoid polluting tiamat (our 11.0 nightly
-# test machine) with these processes. RT
-#
-# Setting the magic bit in the target app should work. I added a
-# "kill", and also a test for the R3 register warning. JB
-if { [istarget "hppa*-*-hpux*"] } {
- return 0
-}
-
if {![can_spawn_for_attach]} {
return 0
}
# build the first test case
#
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
- untested attach.exp
+ untested "failed to compile"
return -1
}
# Build the in-system-call test
if { [gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${binfile2}" executable {debug}] != "" } {
- untested attach.exp
+ untested "failed to compile in-system-call test"
return -1
}
# 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.
# 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
"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
- gdb_test "file $binfile2" ".*" "force switch to gdb64, if necessary"
+ gdb_test "file $binfile2" ".*" "load file"
set test "attach call"
gdb_test_multiple "attach $testpid" "$test" {
-re "warning: reading register.*I.*O error.*$gdb_prompt $" {
# Be paranoid
- remote_exec build "kill -9 ${testpid}"
+ kill_wait_spawned_process $test_spawn_id
}
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
}
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
"-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 {
}
# Get rid of the process
- remote_exec build "kill -9 ${testpid}"
+ kill_wait_spawned_process $test_spawn_id
}
}