-# Copyright (C) 2009-2014 Free Software Foundation, Inc.
+# Copyright (C) 2009-2015 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
return -1
}
-clean_restart ${binfile}
+# Run the test proper. SCHEDLOCK specifies what scheduler-locking
+# should be set to.
-runto_main
+proc do_test { schedlock } {
+ global binfile
-# Get ourselves to the thread that execs
-gdb_breakpoint "thread_execler"
-gdb_test "continue" ".*thread_execler.*" "continue to thread start"
+ with_test_prefix "schedlock $schedlock" {
+ clean_restart ${binfile}
-# 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"
+ if ![runto_main] {
+ return 0
+ }
-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"
+ }
+}
+
+foreach schedlock {"off" "step" "on"} {
+ do_test $schedlock
+}