]> Git Repo - binutils.git/blob - gdb/testsuite/gdb.ada/operator_bp.exp
New Ada testcase for breakpoints on operators.
[binutils.git] / gdb / testsuite / gdb.ada / operator_bp.exp
1 # Copyright 2012 Free Software Foundation, Inc.
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 load_lib "ada.exp"
17
18 if { [skip_ada_tests] } { return -1 }
19
20 set testdir "operator_bp"
21 set testfile "${testdir}/ops_test"
22 set srcfile ${srcdir}/${subdir}/${testfile}.adb
23 set binfile ${objdir}/${subdir}/${testfile}
24
25 file mkdir ${objdir}/${subdir}/${testdir}
26 if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug}] != ""} {
27     return -1
28 }
29
30 clean_restart ${testfile}
31
32 set bp_location [gdb_get_line_number "BEGIN" ${testdir}/ops_test.adb]
33 runto "ops_test.adb:$bp_location"
34
35 # Set breakpoints for all operators, using just the operator name in quotes.
36
37 foreach op { "+" "-" } {
38     set op_re [string_to_regexp $op]
39     gdb_test "break \"$op\"" \
40              "Breakpoint $decimal at $hex: \"$op_re\"\. \\(2 locations\\)"
41 }
42
43 foreach op { "*" "/" "mod" "rem" "**" "<" "<=" ">" ">=" "=" "and" "or" "xor" "&" "abs" "not"} {
44     set op_re [string_to_regexp $op]
45     gdb_test "break \"$op\"" \
46              "Breakpoint $decimal at $hex: file .*ops.adb, line $decimal."
47 }
48
49 # Make sure we stop correctly in each operator function.
50
51 foreach op { "+" "-" "*" "/" "mod" "rem" "**" "<" "<=" ">" ">=" "=" "and" "or" "xor" "&" "abs" "not"} {
52     set op_re [string_to_regexp $op]
53     gdb_test "continue" \
54              "Breakpoint $decimal, ops\\.\"$op_re\" .*"\
55              "continue to \"$op\""
56 }
57
58 # Perform the same test, but using the qualified name of the operator,
59 # instead of the just the operator name (as in 'break ops."+"').
60
61 clean_restart ${testfile}
62
63 runto "ops_test.adb:$bp_location"
64
65 # Set breakpoints for all operators, using just the operator name in quotes.
66
67 foreach op { "+" "-" } {
68     set op_re [string_to_regexp $op]
69     gdb_test "break ops.\"$op\"" \
70              "Breakpoint $decimal at $hex: ops\\.\"$op_re\"\. \\(2 locations\\)"
71 }
72
73 foreach op { "*" "/" "mod" "rem" "**" "<" "<=" ">" ">=" "=" "and" "or" "xor" "&" "abs" "not"} {
74     set op_re [string_to_regexp $op]
75     gdb_test "break ops.\"$op\"" \
76              "Breakpoint $decimal at $hex: file .*ops.adb, line $decimal."
77 }
78
79 # Make sure we stop correctly in each operator function.
80
81 foreach op { "+" "-" "*" "/" "mod" "rem" "**" "<" "<=" ">" ">=" "=" "and" "or" "xor" "&" "abs" "not"} {
82     set op_re [string_to_regexp $op]
83     gdb_test "continue" \
84              "Breakpoint $decimal, ops\\.\"$op_re\" .*"\
85              "continue to ops.\"$op\""
86 }
87
88
This page took 0.027695 seconds and 4 git commands to generate.