Convert observers to C++
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.ada / same_component_name.exp
1 # Copyright 2017-2018 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 standard_ada_testfile foo
19
20 if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } {
21 return -1
22 }
23
24 clean_restart ${testfile}
25
26 set bp_top_location [gdb_get_line_number "BREAK_TOP" ${testdir}/pck.adb]
27 set bp_middle_location [gdb_get_line_number "BREAK_MIDDLE" ${testdir}/pck.adb]
28 set bp_bottom_location [gdb_get_line_number "BREAK_BOTTOM" ${testdir}/pck.adb]
29
30 gdb_breakpoint "pck.adb:$bp_top_location"
31 gdb_breakpoint "pck.adb:$bp_middle_location"
32 gdb_breakpoint "pck.adb:$bp_bottom_location"
33
34 gdb_run_cmd
35
36 gdb_test "" \
37 ".*Breakpoint $decimal, pck.top.assign \\(.*\\).*" \
38 "run to top assign breakpoint"
39
40 gdb_test "print obj.n" " = 1" "Print top component field"
41
42 gdb_test "continue" \
43 ".*Breakpoint $decimal, pck.assign \\(.*\\).*" \
44 "continue to bottom assign breakpoint"
45
46 gdb_test "print obj.n" " = 4\\.0" "Print bottom component field"
47
48 gdb_test "continue" \
49 ".*Breakpoint $decimal, pck.middle.assign \\(.*\\).*" \
50 "continue to middle assign breakpoint"
51
52 gdb_test "print obj.a" " = 48" \
53 "Print top component field in middle assign function"
54
55 gdb_test "continue" \
56 ".*Breakpoint $decimal, pck.assign \\(.*\\).*" \
57 "continue to bottom assign breakpoint (2nd time)"
58
59 gdb_test "print obj.x" " = 6" \
60 "Print field existing only in bottom component"
This page took 0.032172 seconds and 4 git commands to generate.