1 # Copyright
(C
) 2014-2022 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 when a step
-over lands
on a breakpoint
, that breakpoint
20 set executable $
{testfile
}
22 if {[gdb_compile_pthreads
"${srcdir}/${subdir}/${srcfile}" "${binfile}" \
23 executable
[list debug
"incdir=${objdir}"]] != "" } {
27 # The test proper. DISPLACED is true
if we should try with displaced
28 # stepping. COMMAND is the execution command to test.
29 proc do_test
{displaced command
} {
32 with_test_prefix
"displaced=$displaced: $command" {
33 clean_restart $executable
39 gdb_test_no_output
"set displaced-stepping $displaced"
41 set line
[gdb_get_line_number
"set wait-thread breakpoint here"]
42 if { ![gdb_breakpoint $line
] } {
45 gdb_continue_to_breakpoint
"run to wait-thread breakpoint"
46 gdb_test
"info threads" "\\\* 1 .* 2 .*" "info threads shows all threads"
48 gdb_test_no_output
"set scheduler-locking on"
52 gdb_breakpoint
[gdb_get_line_number
"set breakpoint child here"]
53 gdb_test
"thread 2" "Switching to .*"
54 gdb_continue_to_breakpoint
"run to breakpoint in thread 2"
55 gdb_test
"p counter = 0" " = 0" "unbreak loop in thread 2"
57 #
Set a breakpoint exactly where the step
-over will land.
58 gdb_breakpoint
[gdb_get_line_number
"breakpoint after step-over here"]
60 #
Switch back to thread
1 and disable scheduler locking.
61 gdb_test
"thread 1" "Switching to .*"
62 gdb_test_no_output
"set scheduler-locking off"
64 # Thread
2 is still stopped at a breakpoint that needs to be
65 # stepped over. However
, right where the step
-over lands
66 # there
's another breakpoint installed, which should trap and
67 # be reported to the user.
68 gdb_test "$command" "step-over here.*"
72 foreach displaced { "off" "on" } {
73 if { $displaced != "off" && ![support_displaced_stepping] } {
77 # Cover both stepping and non-stepping execution commands.
78 foreach command { "step" "next" "continue" } {
79 do_test $displaced $command