return -1
 }
 
-# Global control variable used by the proc prepare.  Should be set to
-# either 'inferior' or 'server'.
-#
-# In the proc prepare we start gdbserver and extract a pid, which will
-# later be killed by calling the proc kill_server.
-#
-# When KILL_PID_OF is set to 'inferior' then the pid we kill is that
-# of the inferior running under gdbserver, when this process dies
-# gdbserver itself will exit.
-#
-# When KILL_PID_OF is set to 'server' then the pid we kill is that of
-# the gdbserver itself, this is a much more aggressive strategy and
-# exposes different bugs within GDB.
-set kill_pid_of "inferior"
-
 # Spawn GDBserver, run to main, extract GDBserver's PID and save it in
 # the SERVER_PID global.
 
 
     gdbserver_run ""
 
-    # Continue past server_pid assignment.  We do this for both scenarios,
-    # to avoid doing a backtrace from _start, which may not trigger remote
-    # communication.
     gdb_breakpoint ${srcfile}:[gdb_get_line_number "i = 0;"]
     gdb_continue_to_breakpoint "after server_pid assignment"
 
-    if { $::kill_pid_of == "inferior" } {
-       # Get the pid of GDBServer.
-       set test "p server_pid"
-       set server_pid 0
-       gdb_test_multiple $test $test {
-           -re " = ($decimal)\r\n$gdb_prompt $" {
-               set server_pid $expect_out(1,string)
-               pass $test
-           }
+    # Get the pid of GDBServer.
+    set server_pid 0
+    gdb_test_multiple "p server_pid" "" {
+       -re -wrap " = ($decimal)" {
+           set server_pid $expect_out(1,string)
+           pass $gdb_test_name
        }
-    } else {
-       set server_pid [exp_pid -i $::server_spawn_id]
     }
 
     if {$server_pid == 0} {
     gdb_test "stepi" "(Target disconnected|Remote connection closed|Remote communication error).*"
 }
 
-# Run each test twice, see the description of KILL_PID_OF earlier in
-# this file for more details.
+test_tstatus
+test_unwind_nosyms
+test_unwind_syms
+test_stepi
 
-foreach_with_prefix kill_pid_of { "inferior" "server" } {
-    test_tstatus
-    test_unwind_nosyms
-    test_unwind_syms
-    test_stepi
-}