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