]>
Commit | Line | Data |
---|---|---|
3666a048 | 1 | # Copyright 2020-2021 Free Software Foundation, Inc. |
7ff5b937 TT |
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" | |
cc9d6997 | 17 | load_lib "gdb-python.exp" |
7ff5b937 TT |
18 | |
19 | if { [skip_ada_tests] } { return -1 } | |
20 | ||
21 | standard_ada_testfile p | |
22 | ||
23 | foreach_with_prefix scenario {all minimal} { | |
24 | set flags [list debug additional_flags=-fgnat-encodings=$scenario] | |
25 | ||
26 | if {[gdb_compile_ada "${srcfile}" "${binfile}" executable $flags] != ""} { | |
27 | return -1 | |
28 | } | |
29 | ||
30 | clean_restart ${testfile} | |
31 | ||
32 | set bp_location [gdb_get_line_number "START" ${testdir}/p.adb] | |
33 | runto "p.adb:$bp_location" | |
34 | ||
35 | set v1 "(tag => object, values => (2, 2, 2, 2, 2))" | |
36 | set v2 "(tag => unused)" | |
37 | ||
38 | gdb_test "print objects" \ | |
39 | [string_to_regexp " = ($v1, $v2)"] \ | |
40 | "print entire array" | |
41 | gdb_test "print objects(1)" \ | |
42 | [string_to_regexp " = $v1"] \ | |
43 | "print first array element" | |
44 | gdb_test "print objects(1 .. 1)" \ | |
45 | [string_to_regexp " = ($v1)"] \ | |
46 | "print first array slice" | |
47 | gdb_test "print objects(2)" \ | |
48 | [string_to_regexp " = $v2"] \ | |
49 | "print second array element" | |
50 | gdb_test "print objects(2 .. 2)" \ | |
51 | [string_to_regexp " = (2 => $v2)"] \ | |
52 | "print second array slice" | |
cc9d6997 TT |
53 | |
54 | # This is only supported for the DWARF encoding. | |
55 | if {$scenario == "minimal" && ![skip_python_tests]} { | |
56 | gdb_test_no_output \ | |
57 | "python o = gdb.parse_and_eval('objects')" \ | |
58 | "fetch value for python" | |
59 | gdb_test "python print(o)" \ | |
60 | [string_to_regexp "($v1, $v2)"] \ | |
61 | "python print array" | |
62 | gdb_test "python print(o\[1\])" \ | |
63 | [string_to_regexp "$v1"] \ | |
64 | "python print first array element" | |
65 | gdb_test "python print(o\[2\])" \ | |
66 | [string_to_regexp "$v2"] \ | |
67 | "python print second array element" | |
68 | } | |
7ff5b937 | 69 | } |