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