]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.ada/same_component_name.exp
cb846046171e05f4a47ac3a9bc351600643c49ff
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.ada / same_component_name.exp
1 # Copyright 2017-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
16 load_lib "ada.exp"
17
18 if { [skip_ada_tests] } { return -1 }
19
20 standard_ada_testfile foo
21
22 if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } {
23 return -1
24 }
25
26 clean_restart ${testfile}
27
28 set bp_top_location [gdb_get_line_number "BREAK_TOP" ${testdir}/pck.adb]
29 set bp_middle_location [gdb_get_line_number "BREAK_MIDDLE" ${testdir}/pck.adb]
30 set bp_bottom_location [gdb_get_line_number "BREAK_BOTTOM" ${testdir}/pck.adb]
31 set bp_dyn_middle_location [gdb_get_line_number "BREAK_DYN_MIDDLE" ${testdir}/pck.adb]
32
33 gdb_breakpoint "pck.adb:$bp_top_location"
34 gdb_breakpoint "pck.adb:$bp_middle_location"
35 gdb_breakpoint "pck.adb:$bp_bottom_location"
36 gdb_breakpoint "pck.adb:$bp_dyn_middle_location"
37
38 gdb_run_cmd
39
40 gdb_test "" \
41 ".*Breakpoint $decimal, pck.top.assign \\(.*\\).*" \
42 "run to top assign breakpoint"
43
44 gdb_test "print obj.n" " = 1" "Print top component field"
45
46 gdb_test "continue" \
47 ".*Breakpoint $decimal, pck.assign \\(.*\\).*" \
48 "continue to bottom assign breakpoint"
49
50 gdb_test "print obj.n" " = 4\\.0" "Print bottom component field"
51
52 gdb_test "continue" \
53 ".*Breakpoint $decimal, pck.middle.assign \\(.*\\).*" \
54 "continue to middle assign breakpoint"
55
56 gdb_test "print obj.a" " = 48" \
57 "Print top component field in middle assign function"
58
59 gdb_test "continue" \
60 ".*Breakpoint $decimal, pck.assign \\(.*\\).*" \
61 "continue to bottom assign breakpoint, 2nd time"
62
63 gdb_test "print obj.x" " = 6" \
64 "Print field existing only in bottom component"
65
66 gdb_test "continue" \
67 ".*Breakpoint $decimal, pck.dyn_middle.assign \\(.*\\).*" \
68 "continue to dyn_middle assign breakpoint"
69
70 gdb_test "print obj.u" " = 42" \
71 "Print field existing only in dyn_middle component"
72