]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.ada/same_component_name.exp
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.ada / same_component_name.exp
CommitLineData
213516ef 1# Copyright 2017-2023 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
7a82e903
PA
18if { [skip_ada_tests] } { return -1 }
19
828d5846
XR
20standard_ada_testfile foo
21
4d1795ac
TT
22foreach_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] != "" } {
4d1795ac
TT
26 return -1
27 }
828d5846 28
5ae3df22 29 clean_restart ${testfile}-${scenario}
828d5846 30
4d1795ac
TT
31 set bp_top_location [gdb_get_line_number "BREAK_TOP" ${testdir}/pck.adb]
32 set bp_middle_location [gdb_get_line_number "BREAK_MIDDLE" ${testdir}/pck.adb]
33 set bp_bottom_location [gdb_get_line_number "BREAK_BOTTOM" ${testdir}/pck.adb]
34 set bp_dyn_middle_location [gdb_get_line_number "BREAK_DYN_MIDDLE" ${testdir}/pck.adb]
35 set bp_foo [gdb_get_line_number "STOP" ${testdir}/foo.adb]
828d5846 36
4d1795ac
TT
37 gdb_breakpoint "pck.adb:$bp_top_location"
38 gdb_breakpoint "pck.adb:$bp_middle_location"
39 gdb_breakpoint "pck.adb:$bp_bottom_location"
40 gdb_breakpoint "pck.adb:$bp_dyn_middle_location"
41 gdb_breakpoint "foo.adb:$bp_foo"
828d5846 42
4d1795ac 43 gdb_run_cmd
828d5846 44
4d1795ac
TT
45 gdb_test "" \
46 ".*Breakpoint $decimal, pck.top.assign \\(.*\\).*" \
47 "run to top assign breakpoint"
828d5846 48
4d1795ac 49 gdb_test "print obj.n" " = 1" "Print top component field"
828d5846 50
4d1795ac
TT
51 gdb_test "continue" \
52 ".*Breakpoint $decimal, pck.assign \\(.*\\).*" \
53 "continue to bottom assign breakpoint"
828d5846 54
4d1795ac 55 gdb_test "print obj.n" " = 4\\.0" "Print bottom component field"
828d5846 56
4d1795ac
TT
57 gdb_test "continue" \
58 ".*Breakpoint $decimal, pck.middle.assign \\(.*\\).*" \
59 "continue to middle assign breakpoint"
828d5846 60
4d1795ac
TT
61 gdb_test "print obj.a" " = 48" \
62 "Print top component field in middle assign function"
828d5846 63
4d1795ac
TT
64 gdb_test "continue" \
65 ".*Breakpoint $decimal, pck.assign \\(.*\\).*" \
66 "continue to bottom assign breakpoint, 2nd time"
828d5846 67
4d1795ac
TT
68 gdb_test "print obj.x" " = 6" \
69 "Print field existing only in bottom component"
1f5d1570 70
4d1795ac
TT
71 gdb_test "continue" \
72 ".*Breakpoint $decimal, pck.dyn_middle.assign \\(.*\\).*" \
73 "continue to dyn_middle assign breakpoint"
1f5d1570 74
4d1795ac
TT
75 gdb_test "print obj.u" " = 42" \
76 "Print field existing only in dyn_middle component"
1f5d1570 77
4d1795ac
TT
78 gdb_test "continue" \
79 ".*Breakpoint $decimal, foo \\(.*\\).*" \
80 "continue to foo breakpoint"
81
82 gdb_test "print dma.a" " = 48" \
83 "print field in dynamic tagged type via access"
84}