]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.base/branch-to-self.exp
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / branch-to-self.exp
CommitLineData
f3abeff5
YQ
1# This testcase is part of GDB, the GNU debugger.
2#
1d506c26 3# Copyright 2016-2024 Free Software Foundation, Inc.
f3abeff5
YQ
4#
5# This program is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation; either version 3 of the License, or
8# (at your option) any later version.
9#
10# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13# GNU General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
16# along with this program. If not, see <http://www.gnu.org/licenses/>.
17
450d26c8 18require {!target_info exists gdb,nosignals}
11cf4ffb 19
f3abeff5
YQ
20standard_testfile
21
22if { [build_executable ${testfile}.exp ${testfile} $srcfile {debug}] == -1 } {
23 return -1
24}
25
26with_test_prefix "single-step" {
27 global testfile
28
29 clean_restart ${testfile}
30 if ![runto_main] {
31 return -1
32 }
33 set line_num [gdb_get_line_number "loop-line" ${testfile}.c]
34
35 gdb_test "break ${testfile}.c:${line_num}" "Breakpoint .*" \
36 "set breakpoint"
37 gdb_continue_to_breakpoint "hit breakpoint"
38 gdb_test "si" ".*${testfile}.c:${line_num}.*"
39}
40
41with_test_prefix "break-cond" {
42 global testfile
43
44 foreach_with_prefix side {"host" "target"} {
45
46 clean_restart ${testfile}
47
48 if ![runto_main] {
49 return -1
50 }
51
52 set test "set breakpoint condition-evaluation $side"
53 gdb_test_multiple $test $test {
54 -re "warning: Target does not support breakpoint condition evaluation.\r\nUsing host evaluation mode instead.\r\n$gdb_prompt $" {
55 # Target doesn't support breakpoint condition
56 # evaluation on its side. Skip the test.
57 continue
58 }
59 -re "^$test\r\n$gdb_prompt $" {
60 }
61 }
62
63 set line_num [gdb_get_line_number "loop-line" ${testfile}.c]
64 gdb_test "break ${testfile}.c:${line_num} if counter > 3" \
65 "Breakpoint .*" "set breakpoint with condition"
66
67 gdb_continue_to_breakpoint "continue to break"
68
69 gdb_test "p counter" ".* = 5"
70 }
71}