Imported Upstream version 7.8.1
[platform/upstream/gdb.git] / gdb / testsuite / gdb.base / solib-overlap.exp
index 68731be..7486b07 100644 (file)
@@ -82,16 +82,7 @@ foreach prelink_lib1 {0x40000000 0x50000000} { with_test_prefix "$prelink_lib1"
        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 &]
-    sleep 2
-    if { [istarget "*-*-cygwin*"] } {
-       # testpid is the Cygwin PID, GDB uses the Windows PID, which might be
-       # different due to the way fork/exec works.
-       set testpid [ exec ps -e | gawk "{ if (\$1 == $testpid) print \$4; }" ]
-    }
+    set testpid [spawn_wait_for_attach $binfile]
 
     remote_exec build "mv -f ${binfile_lib1} ${binfile_lib1}-running"
     remote_exec build "mv -f ${binfile_lib2} ${binfile_lib2}-running"