return -1
}
-clean_restart ${binfile}
-
-runto_main
-
-# Get ourselves to the thread that execs
-gdb_breakpoint "thread_execler"
-gdb_test "continue" ".*thread_execler.*" "continue to thread start"
-
-# Now set a breakpoint at `main', and step over the execl call. The
-# breakpoint at main should be reached. GDB should not try to revert
-# back to the old thread from the old image and resume stepping it
-# (since it is gone).
-gdb_breakpoint "main"
-gdb_test "next" ".*main.*" "get to main in new image"
+# Run the test proper. SCHEDLOCK specifies what scheduler-locking
+# should be set to.
+
+proc do_test { schedlock } {
+ global binfile
+
+ with_test_prefix "schedlock $schedlock" {
+ clean_restart ${binfile}
+
+ if ![runto_main] {
+ return 0
+ }
+
+ # Get ourselves to the thread that execs.
+ gdb_breakpoint "thread_execler"
+ gdb_test "continue" ".*thread_execler.*" "continue to thread start"
+
+ # Now set a breakpoint at `main', and step over the execl call. The
+ # breakpoint at main should be reached. GDB should not try to revert
+ # back to the old thread from the old image and resume stepping it
+ # (since it is gone).
+ gdb_breakpoint "main"
+ gdb_test_no_output "set scheduler-locking $schedlock"
+ gdb_test "next" ".*main.*" "get to main in new image"
+ }
+}
-return 0
+foreach schedlock {"off" "step" "on"} {
+ do_test $schedlock
+}