1 # Copyright 2021 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/>.
18 if { [skip_ada_tests] } { return -1 }
20 standard_ada_testfile local
22 if {[gdb_compile_ada "${srcfile}" "${binfile}" executable debug] != ""} {
26 clean_restart ${testfile}
28 set bp_location [gdb_get_line_number "STOP" ${testdir}/local.adb]
29 if ![runto "local.adb:$bp_location" ] then {
30 perror "Couldn't run ${testfile}"
34 # The test has two constants named 'three', with different values.
35 # This prints one of them and checks the value. WHICH_ENUM is the
36 # name of the enum, either "e1" or "e2".
37 proc print_three {which_enum value} {
38 # We don't know which in order gdb will print the constants, so
40 set menu1 [multi_line \
41 "Multiple matches for three" \
43 "\\\[1\\\] local\\.e2'\\(three\\) \\(enumeral\\)" \
44 "\\\[2\\\] local\\.e1'\\(three\\) \\(enumeral\\)" \
46 set menu2 [multi_line \
47 "Multiple matches for three" \
49 "\\\[1\\\] local\\.e1'\\(three\\) \\(enumeral\\)" \
50 "\\\[2\\\] local\\.e2'\\(three\\) \\(enumeral\\)" \
54 set test_name "menu for test index $which_enum"
55 gdb_test_multiple "print/d three" $test_name {
58 if {$which_enum == "e1"} {
66 if {$which_enum == "e1"} {
78 gdb_test $index " = $value"
85 # These will not result in a menu, as expression resolution should
86 # disambiguate the meaning of 'three'.
87 gdb_test "print v1(three)" " = 2" "print v1 element"
88 gdb_test "print v2(three)" " = 3" "print v2 element"