]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - gdb/testsuite/gdb.threads/attach-stopped.exp
testsuite: tcl exec& -> 'kill -9 $pid' is racy (attach-many-short-lived-thread.exp...
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.threads / attach-stopped.exp
index ac35ac5570d6027cdf4f4b7b4dcd964b724aa134..9a7edc54185e2d6ba0f20caf44ff69ee4e2758ae 100644 (file)
@@ -44,13 +44,8 @@ proc corefunc { threadtype } {
        return -1
     }
 
-    # Start the program running and then wait for a bit, to be sure
-    # that it can be attached to.
-
-    set testpid [eval exec $binfile &]
-
-    # Avoid some race:
-    sleep 2
+    set test_spawn_id [spawn_wait_for_attach $binfile]
+    set testpid [spawn_id_get_pid $test_spawn_id]
 
     # Stop the program 
     remote_exec build "kill -s STOP ${testpid}"
@@ -86,7 +81,7 @@ proc corefunc { threadtype } {
     # the Linux kernel version.  The behavior is not tested as it is not
     # dependent on GDB.
 
-    remote_exec build "kill -9 ${testpid}"
+    kill_wait_spawned_process $test_spawn_id
 }
 
 # build the test case first without threads