GDB: trad-frame: Store length of value_bytes in trad_frame_saved_reg
[binutils-gdb.git] / gdb / testsuite / gdb.ada / same_component_name.exp
blob84a48b4fd0ed722a22ad07677f5972806afd89af
1 # Copyright 2017-2024 Free Software Foundation, Inc.
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.
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.
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/>.
16 load_lib "ada.exp"
18 require allow_ada_tests
20 standard_ada_testfile foo
22 foreach_gnat_encoding scenario flags {all minimal} {
23 lappend flags debug
25 if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != "" } {
26 return -1
29 clean_restart ${testfile}-${scenario}
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]
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"
43 gdb_run_cmd
45 gdb_test "" \
46 ".*Breakpoint $decimal, pck.top.assign \\(.*\\).*" \
47 "run to top assign breakpoint"
49 gdb_test "print obj.n" " = 1" "Print top component field"
51 gdb_test "continue" \
52 ".*Breakpoint $decimal, pck.assign \\(.*\\).*" \
53 "continue to bottom assign breakpoint"
55 gdb_test "print obj.n" " = 4\\.0" "Print bottom component field"
57 gdb_test "continue" \
58 ".*Breakpoint $decimal, pck.middle.assign \\(.*\\).*" \
59 "continue to middle assign breakpoint"
61 gdb_test "print obj.a" " = 48" \
62 "Print top component field in middle assign function"
64 gdb_test "continue" \
65 ".*Breakpoint $decimal, pck.assign \\(.*\\).*" \
66 "continue to bottom assign breakpoint, 2nd time"
68 gdb_test "print obj.x" " = 6" \
69 "Print field existing only in bottom component"
71 gdb_test "continue" \
72 ".*Breakpoint $decimal, pck.dyn_middle.assign \\(.*\\).*" \
73 "continue to dyn_middle assign breakpoint"
75 gdb_test "print obj.u" " = 42" \
76 "Print field existing only in dyn_middle component"
78 gdb_test "continue" \
79 ".*Breakpoint $decimal, foo \\(.*\\).*" \
80 "continue to foo breakpoint"
82 gdb_test "print dma.a" " = 48" \
83 "print field in dynamic tagged type via access"