1 # Copyright (C) 2009-2015 Free Software Foundation, Inc.
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 3 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16 # Test that GDB doesn't get stuck when stepping over an exec call done
17 # by a thread other than the main thread.
19 # There's no support for exec events in the remote protocol.
20 if { [is_remote target] } {
26 if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
27 executable debug] != "" } {
31 # Run the test proper. SCHEDLOCK specifies what scheduler-locking
34 proc do_test { schedlock } {
37 if {$schedlock == "non-stop"} {
40 set prefix "schedlock $schedlock"
42 with_test_prefix "$prefix" {
43 clean_restart ${binfile}
45 if {$schedlock == "non-stop"} {
46 gdb_test_no_output "set non-stop 1"
53 # Get ourselves to the thread that execs.
54 gdb_breakpoint "thread_execler"
55 gdb_test "continue" ".*thread_execler.*" "continue to thread start"
57 if {$schedlock == "non-stop"} {
59 "Switching to .*thread_execler.*" \
60 "switch to event thread"
63 # Now set a breakpoint at `main', and step over the execl call. The
64 # breakpoint at main should be reached. GDB should not try to revert
65 # back to the old thread from the old image and resume stepping it
69 if {$schedlock != "non-stop"} {
70 gdb_test_no_output "set scheduler-locking $schedlock"
72 gdb_test "next" ".*main.*" "get to main in new image"
76 foreach schedlock {"off" "step" "on" "non-stop"} {