Copyright year update in most files of the GDB Project.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / langs.exp
1 # Copyright (C) 1997-1998, 2007-2012 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 if $tracelevel then {
17 strace $tracelevel
18 }
19
20
21 set testfile langs
22 set binfile ${objdir}/${subdir}/${testfile}
23
24 if [is_remote host] {
25 remote_download host ${srcdir}/${subdir}/langs1.f
26 remote_download host ${srcdir}/${subdir}/langs2.cxx
27 }
28
29
30 if { [gdb_compile "${srcdir}/${subdir}/langs0.c" "${binfile}0.o" object {debug}] != "" } {
31 untested langs.exp
32 return -1
33 }
34
35 if { [gdb_compile "${srcdir}/${subdir}/langs1.c" "${binfile}1.o" object {debug}] != "" } {
36 untested langs.exp
37 return -1
38 }
39
40 if { [gdb_compile "${srcdir}/${subdir}/langs2.c" "${binfile}2.o" object {debug}] != "" } {
41 untested langs.exp
42 return -1
43 }
44
45 if { [gdb_compile "${binfile}0.o ${binfile}1.o ${binfile}2.o" ${binfile} executable {debug}] != "" } {
46 untested langs.exp
47 return -1
48 }
49
50 set oldtimeout $timeout
51 set timeout 10
52
53
54
55 # Create and source the file that provides information about the compiler
56 # used to compile the test case.
57 if [get_compiler_info ${binfile}] {
58 return -1;
59 }
60
61 gdb_exit
62 gdb_start
63 gdb_reinitialize_dir $srcdir/$subdir
64 gdb_load $binfile
65
66 gdb_test_multiple "b langs0" "break on nonexistent function in langs.exp" {
67 -re "Function \"langs0\" not defined\..*Make breakpoint pending on future shared library load.*y or .n.. $" {
68
69 gdb_test "n" "" "break on nonexistent function in langs.exp"
70 }
71 -re "Breakpoint .* (deferred).*$gdb_prompt $" {
72 pass "break on nonexistent function in langs.exp"
73 }
74 }
75
76 if {$hp_aCC_compiler} {
77 set isfixed 1
78 set lang c\\+\\+
79 set ext cxx
80 set foo_func foo__Fi__Fi
81 set do_func do::langs0
82 } else {
83 if {$hp_cc_compiler} {
84 set isfixed 1
85 set lang c
86 set ext c
87 } else {
88 set isfixed 0
89 }
90 set foo_func foo__Fi
91 set do_func langs0__2do
92 }
93
94 if [runto csub] then {
95
96 if { !$isfixed } { set lang c }
97 gdb_test "show language" "currently $lang\".*" \
98 "show language at csub in langs.exp"
99 # On some machines, foo doesn't get demangled because the N_SOL for
100 # langs2.cxx is seen only after the function stab for foo. So
101 # the following regexps are kludged to accept foo__Fi as well as foo,
102 # even though only the latter is correct. I haven't tried to xfail it
103 # because it depends on details of the compiler.
104
105 # Take out xfail. This test has been passing for some time now.
106 #if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
107 gdb_test "bt" "#0.*csub.*#1.*(foo|$foo_func) \\(.*#2.*cppsub_ .*#3.*fsub.*#4.*$do_func \\(.*#5 \[0-9a-fx\]* in main.*" "backtrace in langs.exp"
108
109 if { !$isfixed } { set lang c\\+\\+; set ext cxx }
110 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
111 gdb_test "up" ".* in (foo|$foo_func).* at langs2\\.$ext.*return csub \\(.*" \
112 "up to foo in langs.exp"
113 gdb_test "show language" "currently $lang.*" \
114 "show language at foo in langs.exp"
115
116 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
117 gdb_test "up" ".* in cppsub_ .* at langs2\\.$ext.*return foo \\(.*" \
118 "up to cppsub_ in langs.exp"
119 gdb_test "show language" "currently $lang.*" \
120 "show language at cppsub_ in langs.exp"
121
122 if { !$isfixed } { set lang fortran }
123 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
124 gdb_test "up" ".* in fsub.* at langs1\\.f.*" \
125 "up to fsub in langs.exp"
126 gdb_test "show language" "currently $lang.*" \
127 "show language at fsub in langs.exp"
128
129 # Take out xfail. This test has been passing for sometime now.
130 #if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
131 if { !$isfixed } { set lang c }
132 gdb_test "up" ".* in $do_func .* at .*langs0\\.c.*return fsub.*" \
133 "up to langs0__2do in langs.exp"
134 gdb_test "show language" "currently $lang\".*" \
135 "show language at langs0__2do in langs.exp"
136
137 gdb_test "up" ".* in main .* at .*langs0\\.c.*if \\(langs0__2do \\(.*" \
138 "up to main in langs.exp"
139 gdb_test "show language" "currently $lang\".*" \
140 "show language at main in langs.exp"
141
142 if [target_info exists gdb,noresults] { return }
143
144 gdb_continue_to_end "langs.exp"
145 }
146
147 gdb_exit
148 gdb_start
149 gdb_reinitialize_dir $srcdir/$subdir
150 gdb_load $binfile
151
152 # Try exercising the "minimal" language a bit...
153
154 if [runto csub] then {
155 gdb_test "set lang minimal" \
156 "Warning: the current language does not match this frame." \
157 "set lang to minimal"
158
159 gdb_test "print x" " = 5000" "print parameter value"
160 }
161
162 set timeout $oldtimeout
163 return 0
This page took 0.040273 seconds and 5 git commands to generate.