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