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