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