after gdb_run_cmd, gdb_expect -> gdb_test_multiple/gdb_test
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.threads / thread-execl.exp
CommitLineData
ecd75fc8 1# Copyright (C) 2009-2014 Free Software Foundation, Inc.
b3444185
PA
2
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.
7#
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.
12#
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/>.
15
16# Test that GDB doesn't get stuck when stepping over an exec call done
17# by a thread other than the main thread.
18
19# There's no support for exec events in the remote protocol.
20if { [is_remote target] } {
21 return 0
22}
23
0efbbabc 24standard_testfile
b3444185
PA
25
26if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
0efbbabc 27 executable debug] != "" } {
b3444185
PA
28 return -1
29}
30
034f788c
PA
31# Run the test proper. SCHEDLOCK specifies what scheduler-locking
32# should be set to.
33
34proc do_test { schedlock } {
35 global binfile
36
37 with_test_prefix "schedlock $schedlock" {
38 clean_restart ${binfile}
39
40 if ![runto_main] {
41 return 0
42 }
43
44 # Get ourselves to the thread that execs.
45 gdb_breakpoint "thread_execler"
46 gdb_test "continue" ".*thread_execler.*" "continue to thread start"
47
48 # Now set a breakpoint at `main', and step over the execl call. The
49 # breakpoint at main should be reached. GDB should not try to revert
50 # back to the old thread from the old image and resume stepping it
51 # (since it is gone).
52 gdb_breakpoint "main"
53 gdb_test_no_output "set scheduler-locking $schedlock"
54 gdb_test "next" ".*main.*" "get to main in new image"
55 }
56}
b3444185 57
034f788c
PA
58foreach schedlock {"off" "step" "on"} {
59 do_test $schedlock
60}
This page took 0.63441 seconds and 4 git commands to generate.