]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.ada/unc_arr_ptr_in_var_rec.exp
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.ada / unc_arr_ptr_in_var_rec.exp
1 # Copyright 2012-2024 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 require allow_ada_tests
19
20 standard_ada_testfile foo
21
22 foreach_with_prefix scenario {all minimal} {
23 set flags [list debug additional_flags=-fgnat-encodings=$scenario]
24
25 if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} {
26 return -1
27 }
28
29 clean_restart ${testfile}-${scenario}
30
31 set bp_location [gdb_get_line_number "STOP1" ${testdir}/foo.adb]
32 runto "foo.adb:$bp_location"
33
34 # Print My_Object and My_Object.Ptr when Ptr is null...
35
36 gdb_test "print my_object" \
37 "= \\(n => 3, ptr => 0x0, data => \\(3, 5, 8\\)\\)" \
38 "print My_Object with null Ptr"
39
40 gdb_test "print my_object.ptr" \
41 "= \\(foo.table_access\\) 0x0" \
42 "print My_Object.Ptr when null"
43
44 # Same for My_P_Object...
45
46 gdb_test "print my_p_object" \
47 "= \\(n => 3, ptr => 0x0, data => \\(3, 5, 8\\)\\)" \
48 "print My_P_Object with null Ptr"
49
50 gdb_test "print my_p_object.ptr" \
51 "\\(foo.p_table_access\\) 0x0" \
52 "print My_P_Object.Ptr when null"
53
54 # Continue until the Ptr component of both objects get allocated.
55
56 set bp_location [gdb_get_line_number "STOP2" ${testdir}/foo.adb]
57
58 gdb_breakpoint "foo.adb:$bp_location"
59
60 gdb_test "continue" \
61 "Breakpoint $decimal, foo \\(\\) at .*foo.adb:$decimal.*" \
62 "continue to STOP2"
63
64 # Inspect My_Object again...
65
66 gdb_test "print my_object" \
67 "= \\(n => 3, ptr => $hex, data => \\(3, 5, 8\\)\\)" \
68 "print my_object after setting Ptr"
69
70 gdb_test "print my_object.ptr" \
71 "\\(foo.table_access\\) $hex" \
72 "print my_object.ptr when no longer null"
73
74 gdb_test "print my_object.ptr.all" \
75 "= \\(13, 21, 34\\)"
76
77 # Same with My_P_Object...
78
79 gdb_test "print my_p_object" \
80 "= \\(n => 3, ptr => $hex, data => \\(3, 5, 8\\)\\)" \
81 "print my_p_object after setting Ptr"
82
83 gdb_test "print my_p_object.ptr" \
84 "= \\(foo.p_table_access\\) $hex" \
85 "print My_P_Object.Ptr when no longer null"
86
87 gdb_test "print my_p_object.ptr.all" \
88 "\\(13, 21, 34\\)"
89
90 }