]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.threads/step-over-lands-on-breakpoint.exp
Update year range in copyright notice of all files owned by the GDB project.
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.threads / step-over-lands-on-breakpoint.exp
CommitLineData
32d0add0 1# Copyright (C) 2014-2015 Free Software Foundation, Inc.
b9f437de
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 when a step-over lands on a breakpoint, that breakpoint
17# hit is reported.
18
19standard_testfile
20set executable ${testfile}
21
22if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
23 executable [list debug "incdir=${objdir}"]] != "" } {
24 return -1
25}
26
27# Cover both stepping and non-stepping execution commands.
28foreach command {"step" "next" "continue" } {
29 with_test_prefix $command {
30 clean_restart $executable
31
32 if ![runto_main] {
33 continue
34 }
35
36 gdb_breakpoint [gdb_get_line_number "set wait-thread breakpoint here"]
37 gdb_continue_to_breakpoint "run to wait-thread breakpoint"
38 gdb_test "info threads" "2 .*\\\* 1.*" "info threads shows all threads"
39
40 gdb_test_no_output "set scheduler-locking on"
41
42 delete_breakpoints
43
44 gdb_breakpoint [gdb_get_line_number "set breakpoint child here"]
45 gdb_test "thread 2" "Switching to .*"
46 gdb_continue_to_breakpoint "run to breakpoint in thread 2"
47 gdb_test "p counter = 0" " = 0" "unbreak loop in thread 2"
48
49 # Set a breakpoint exactly where the step-over will land.
50 gdb_breakpoint [gdb_get_line_number "breakpoint after step-over here"]
51
52 # Switch back to thread 1 and disable scheduler locking.
53 gdb_test "thread 1" "Switching to .*"
54 gdb_test_no_output "set scheduler-locking off"
55
56 # Thread 2 is still stopped at a breakpoint that needs to be
57 # stepped over before proceeding thread 1. However, right
58 # where the step-over lands there's another breakpoint
59 # installed, which should trap and be reported to the user.
60 gdb_test "$command" "step-over here.*"
61 }
62}