Commit | Line | Data |
---|---|---|
b811d2c2 | 1 | # Copyright 2008-2020 Free Software Foundation, Inc. |
0ecbca72 JB |
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 | ||
0ecbca72 JB |
16 | load_lib "ada.exp" |
17 | ||
8223e12c | 18 | standard_ada_testfile homonym_main |
0ecbca72 | 19 | |
0ecbca72 JB |
20 | if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" } { |
21 | return -1 | |
22 | } | |
23 | ||
09050809 | 24 | clean_restart ${testfile} |
0ecbca72 | 25 | |
f8eba3c6 TT |
26 | |
27 | # Do these tests before running, so we are operating in a known | |
28 | # environment. | |
29 | ||
30 | gdb_test "break Get_Value" \ | |
31 | "Breakpoint \[0-9\]+ at $hex: Get_Value. .2 locations." \ | |
32 | "set breakpoint at Get_Value" | |
33 | ||
34 | gdb_test "break homonym.adb:Get_Value" \ | |
35 | "Breakpoint \[0-9\]+ at $hex: homonym.adb:Get_Value. .2 locations." \ | |
36 | "set breakpoint at homonym.adb:Get_Value" | |
37 | ||
38 | gdb_test "break <homonym__get_value>" \ | |
a2cd4f14 | 39 | "Breakpoint \[0-9\]+ at $hex: file .*homonym\\.adb, line $decimal\\." \ |
f8eba3c6 TT |
40 | "set breakpoint at <homonym__get_value>" |
41 | ||
42 | delete_breakpoints | |
43 | ||
0ecbca72 JB |
44 | set bp_location [gdb_get_line_number "BREAK_1" ${testdir}/homonym.adb] |
45 | runto "homonym.adb:$bp_location" | |
46 | ||
47 | # Check the variables and types defined inside the current scope. | |
48 | # There are some homonyms in a different scope, so we want to make | |
49 | # sure that the debugger doesn't get mixed up. | |
50 | ||
51 | gdb_test "ptype local_type" \ | |
52 | "type = range -100 \\.\\. 100" \ | |
53 | "ptype local_type at BREAK_1" | |
54 | ||
55 | gdb_test "ptype local_type_subtype" \ | |
56 | "type = range -100 \\.\\. 100" \ | |
57 | "ptype local_type_subtype at BREAK_1" | |
58 | ||
59 | gdb_test "ptype int_type" \ | |
60 | "type = range -100 \\.\\. 100" \ | |
61 | "ptype int_type at BREAK_1" | |
62 | ||
63 | gdb_test "ptype lcl" \ | |
64 | "type = range -100 \\.\\. 100" \ | |
65 | "ptype lcl at BREAK_1" | |
66 | ||
67 | gdb_test "print lcl" \ | |
b6db24e5 | 68 | "= 29" \ |
0ecbca72 JB |
69 | "print lcl at BREAK_1" |
70 | ||
71 | # Now, continue until reaching BREAK_2, and do the same commands | |
72 | # as above. The result should be different since the definitions | |
73 | # in the new scope are different. | |
74 | ||
75 | set bp_location [gdb_get_line_number "BREAK_2" ${testdir}/homonym.adb] | |
76 | gdb_test "break homonym.adb:$bp_location" \ | |
77 | "Breakpoint \[0-9\]+ at 0x\[0-9a-fA-F\]+: file .*homonym\.adb, line \[0-9\]+\." \ | |
78 | "break at BREAK_2" | |
79 | ||
80 | gdb_test "continue" \ | |
81 | ".*Breakpoint \[0-9\]+, homonym\\.get_value \\(\\) at .*homonym\\.adb:.*" \ | |
82 | "continue until BREAK_2" | |
83 | ||
84 | gdb_test "ptype local_type" \ | |
85 | "type = range 1 \\.\\. 19740804" \ | |
86 | "ptype local_type at BREAK_2" | |
87 | ||
88 | gdb_test "ptype local_type_subtype" \ | |
89 | "type = range 1 \\.\\. 19740804" \ | |
90 | "ptype local_type_subtype at BREAK_2" | |
91 | ||
92 | gdb_test "ptype lcl" \ | |
93 | "type = range 1 \\.\\. 19740804" \ | |
94 | "ptype lcl at BREAK_2" | |
95 | ||
96 | gdb_test "print lcl" \ | |
b6db24e5 | 97 | "= 17" \ |
0ecbca72 | 98 | "print lcl at BREAK_2" |