| 1 | # Copyright 2012-2013 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 | standard_ada_testfile ops_test |
| 21 | |
| 22 | if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug}] != ""} { |
| 23 | return -1 |
| 24 | } |
| 25 | |
| 26 | clean_restart ${testfile} |
| 27 | |
| 28 | # This test won't work properly if system debuginfo is installed. |
| 29 | gdb_test_no_output "set debug-file-directory" |
| 30 | |
| 31 | set bp_location [gdb_get_line_number "BEGIN" ${testdir}/ops_test.adb] |
| 32 | runto "ops_test.adb:$bp_location" |
| 33 | |
| 34 | # Set breakpoints for all operators, using just the operator name in quotes. |
| 35 | |
| 36 | foreach op { "+" "-" } { |
| 37 | set op_re [string_to_regexp $op] |
| 38 | gdb_test "break \"$op\"" \ |
| 39 | "Breakpoint $decimal at $hex: \"$op_re\"\. \\(2 locations\\)" |
| 40 | } |
| 41 | |
| 42 | foreach op { "*" "/" "mod" "rem" "**" "<" "<=" ">" ">=" "=" "and" "or" "xor" "&" "abs" "not"} { |
| 43 | set op_re [string_to_regexp $op] |
| 44 | gdb_test "break \"$op\"" \ |
| 45 | "Breakpoint $decimal at $hex: file .*ops.adb, line $decimal." |
| 46 | } |
| 47 | |
| 48 | # Make sure we stop correctly in each operator function. |
| 49 | |
| 50 | foreach op { "+" "-" "*" "/" "mod" "rem" "**" "<" "<=" ">" ">=" "=" "and" "or" "xor" "&" "abs" "not"} { |
| 51 | set op_re [string_to_regexp $op] |
| 52 | gdb_test "continue" \ |
| 53 | "Breakpoint $decimal, ops\\.\"$op_re\" .*"\ |
| 54 | "continue to \"$op\"" |
| 55 | } |
| 56 | |
| 57 | # Perform the same test, but using the qualified name of the operator, |
| 58 | # instead of the just the operator name (as in 'break ops."+"'). |
| 59 | |
| 60 | clean_restart ${testfile} |
| 61 | |
| 62 | runto "ops_test.adb:$bp_location" |
| 63 | |
| 64 | # Set breakpoints for all operators, using just the operator name in quotes. |
| 65 | |
| 66 | foreach op { "+" "-" } { |
| 67 | set op_re [string_to_regexp $op] |
| 68 | gdb_test "break ops.\"$op\"" \ |
| 69 | "Breakpoint $decimal at $hex: ops\\.\"$op_re\"\. \\(2 locations\\)" |
| 70 | } |
| 71 | |
| 72 | foreach op { "*" "/" "mod" "rem" "**" "<" "<=" ">" ">=" "=" "and" "or" "xor" "&" "abs" "not"} { |
| 73 | set op_re [string_to_regexp $op] |
| 74 | gdb_test "break ops.\"$op\"" \ |
| 75 | "Breakpoint $decimal at $hex: file .*ops.adb, line $decimal." |
| 76 | } |
| 77 | |
| 78 | # Make sure we stop correctly in each operator function. |
| 79 | |
| 80 | foreach op { "+" "-" "*" "/" "mod" "rem" "**" "<" "<=" ">" ">=" "=" "and" "or" "xor" "&" "abs" "not"} { |
| 81 | set op_re [string_to_regexp $op] |
| 82 | gdb_test "continue" \ |
| 83 | "Breakpoint $decimal, ops\\.\"$op_re\" .*"\ |
| 84 | "continue to ops.\"$op\"" |
| 85 | } |
| 86 | |
| 87 | |