1 # Copyright 2021-2024 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 require allow_ada_tests
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"]} {
33 # The test has two constants named 'three', with different values.
34 # This prints one of them and checks the value. WHICH_ENUM is the
35 # name of the enum, either "e1" or "e2".
36 proc print_three {which_enum value} {
37 # We don't know which in order gdb will print the constants, so
39 set menu1 [multi_line \
40 "Multiple matches for three" \
42 "\\\[1\\\] local\\.e2'\\(three\\) \\(enumeral\\)" \
43 "\\\[2\\\] local\\.e1'\\(three\\) \\(enumeral\\)" \
45 set menu2 [multi_line \
46 "Multiple matches for three" \
48 "\\\[1\\\] local\\.e1'\\(three\\) \\(enumeral\\)" \
49 "\\\[2\\\] local\\.e2'\\(three\\) \\(enumeral\\)" \
53 set test_name "menu for test index $which_enum"
54 gdb_test_multiple "print/d three" $test_name {
57 if {$which_enum == "e1"} {
65 if {$which_enum == "e1"} {
77 gdb_test $index " = $value"
84 # These will not result in a menu, as expression resolution should
85 # disambiguate the meaning of 'three'.
86 gdb_test "print v1(three)" " = 2" "print v1 element"
87 gdb_test "print v2(three)" " = 3" "print v2 element"