Update copyright year range in all GDB files.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.ada / same_component_name.exp
CommitLineData
b811d2c2 1# Copyright 2017-2020 Free Software Foundation, Inc.
828d5846
XR
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
18standard_ada_testfile foo
19
20if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } {
21 return -1
22}
23
24clean_restart ${testfile}
25
26set bp_top_location [gdb_get_line_number "BREAK_TOP" ${testdir}/pck.adb]
27set bp_middle_location [gdb_get_line_number "BREAK_MIDDLE" ${testdir}/pck.adb]
28set bp_bottom_location [gdb_get_line_number "BREAK_BOTTOM" ${testdir}/pck.adb]
1f5d1570 29set bp_dyn_middle_location [gdb_get_line_number "BREAK_DYN_MIDDLE" ${testdir}/pck.adb]
828d5846
XR
30
31gdb_breakpoint "pck.adb:$bp_top_location"
32gdb_breakpoint "pck.adb:$bp_middle_location"
33gdb_breakpoint "pck.adb:$bp_bottom_location"
1f5d1570 34gdb_breakpoint "pck.adb:$bp_dyn_middle_location"
828d5846
XR
35
36gdb_run_cmd
37
38gdb_test "" \
39 ".*Breakpoint $decimal, pck.top.assign \\(.*\\).*" \
40 "run to top assign breakpoint"
41
42gdb_test "print obj.n" " = 1" "Print top component field"
43
44gdb_test "continue" \
45 ".*Breakpoint $decimal, pck.assign \\(.*\\).*" \
46 "continue to bottom assign breakpoint"
47
48gdb_test "print obj.n" " = 4\\.0" "Print bottom component field"
49
50gdb_test "continue" \
51 ".*Breakpoint $decimal, pck.middle.assign \\(.*\\).*" \
52 "continue to middle assign breakpoint"
53
54gdb_test "print obj.a" " = 48" \
55 "Print top component field in middle assign function"
56
57gdb_test "continue" \
58 ".*Breakpoint $decimal, pck.assign \\(.*\\).*" \
59 "continue to bottom assign breakpoint (2nd time)"
60
61gdb_test "print obj.x" " = 6" \
62 "Print field existing only in bottom component"
1f5d1570
JG
63
64gdb_test "continue" \
65 ".*Breakpoint $decimal, pck.dyn_middle.assign \\(.*\\).*" \
66 "continue to dyn_middle assign breakpoint"
67
68gdb_test "print obj.u" " = 42" \
69 "Print field existing only in dyn_middle component"
70
This page took 0.261961 seconds and 4 git commands to generate.