Commit | Line | Data |
---|---|---|
7b6bb8da | 1 | # Copyright (C) 1997, 1998, 2007, 2008, 2009, 2010, 2011 |
4c38e0a4 | 2 | # Free Software Foundation, Inc. |
c906108c SS |
3 | |
4 | # This program is free software; you can redistribute it and/or modify | |
5 | # it under the terms of the GNU General Public License as published by | |
e22f8b7c | 6 | # the Free Software Foundation; either version 3 of the License, or |
c906108c | 7 | # (at your option) any later version. |
e22f8b7c | 8 | # |
c906108c SS |
9 | # This program is distributed in the hope that it will be useful, |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. | |
e22f8b7c | 13 | # |
c906108c | 14 | # You should have received a copy of the GNU General Public License |
e22f8b7c | 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
c906108c | 16 | |
c906108c SS |
17 | if $tracelevel then { |
18 | strace $tracelevel | |
19 | } | |
20 | ||
c906108c SS |
21 | |
22 | set testfile langs | |
23 | set binfile ${objdir}/${subdir}/${testfile} | |
24 | ||
25 | if [is_remote host] { | |
26 | remote_download host ${srcdir}/${subdir}/langs1.f | |
27 | remote_download host ${srcdir}/${subdir}/langs2.cxx | |
28 | } | |
29 | ||
30 | ||
31 | if { [gdb_compile "${srcdir}/${subdir}/langs0.c" "${binfile}0.o" object {debug}] != "" } { | |
b60f0898 JB |
32 | untested langs.exp |
33 | return -1 | |
c906108c SS |
34 | } |
35 | ||
36 | if { [gdb_compile "${srcdir}/${subdir}/langs1.c" "${binfile}1.o" object {debug}] != "" } { | |
b60f0898 JB |
37 | untested langs.exp |
38 | return -1 | |
c906108c SS |
39 | } |
40 | ||
41 | if { [gdb_compile "${srcdir}/${subdir}/langs2.c" "${binfile}2.o" object {debug}] != "" } { | |
b60f0898 JB |
42 | untested langs.exp |
43 | return -1 | |
c906108c SS |
44 | } |
45 | ||
46 | if { [gdb_compile "${binfile}0.o ${binfile}1.o ${binfile}2.o" ${binfile} executable {debug}] != "" } { | |
b60f0898 JB |
47 | untested langs.exp |
48 | return -1 | |
c906108c SS |
49 | } |
50 | ||
085dd6e6 JM |
51 | set oldtimeout $timeout |
52 | set timeout 10 | |
c906108c SS |
53 | |
54 | ||
55 | ||
56 | # Create and source the file that provides information about the compiler | |
57 | # used to compile the test case. | |
58 | if [get_compiler_info ${binfile}] { | |
59 | return -1; | |
60 | } | |
61 | ||
62 | gdb_exit | |
63 | gdb_start | |
64 | gdb_reinitialize_dir $srcdir/$subdir | |
65 | gdb_load $binfile | |
66 | ||
18fe2033 | 67 | gdb_test_multiple "b langs0" "break on nonexistent function in langs.exp" { |
9b50c11b | 68 | -re "Function \"langs0\" not defined\..*Make breakpoint pending on future shared library load.*y or .n.. $" { |
18fe2033 JJ |
69 | |
70 | gdb_test "n" "" "break on nonexistent function in langs.exp" | |
71 | } | |
72 | -re "Breakpoint .* (deferred).*$gdb_prompt $" { | |
73 | pass "break on nonexistent function in langs.exp" | |
74 | } | |
75 | } | |
c906108c | 76 | |
085dd6e6 JM |
77 | if {$hp_aCC_compiler} { |
78 | set isfixed 1 | |
79 | set lang c\\+\\+ | |
80 | set ext cxx | |
81 | set foo_func foo__Fi__Fi | |
82 | set do_func do::langs0 | |
83 | } else { | |
84 | if {$hp_cc_compiler} { | |
85 | set isfixed 1 | |
86 | set lang c | |
87 | set ext c | |
88 | } else { | |
89 | set isfixed 0 | |
90 | } | |
91 | set foo_func foo__Fi | |
92 | set do_func langs0__2do | |
93 | } | |
94 | ||
c906108c SS |
95 | if [runto csub] then { |
96 | ||
085dd6e6 JM |
97 | if { !$isfixed } { set lang c } |
98 | gdb_test "show language" "currently $lang\".*" \ | |
c906108c SS |
99 | "show language at csub in langs.exp" |
100 | # On some machines, foo doesn't get demangled because the N_SOL for | |
101 | # langs2.cxx is seen only after the function stab for foo. So | |
102 | # the following regexps are kludged to accept foo__Fi as well as foo, | |
103 | # even though only the latter is correct. I haven't tried to xfail it | |
104 | # because it depends on details of the compiler. | |
105 | ||
085dd6e6 JM |
106 | # Take out xfail. This test has been passing for some time now. |
107 | #if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" } | |
108 | 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" | |
c906108c | 109 | |
085dd6e6 | 110 | if { !$isfixed } { set lang c\\+\\+; set ext cxx } |
c906108c | 111 | if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" } |
085dd6e6 | 112 | gdb_test "up" ".* in (foo|$foo_func).* at langs2\\.$ext.*return csub \\(.*" \ |
c906108c | 113 | "up to foo in langs.exp" |
085dd6e6 | 114 | gdb_test "show language" "currently $lang.*" \ |
c906108c SS |
115 | "show language at foo in langs.exp" |
116 | ||
117 | if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" } | |
085dd6e6 | 118 | gdb_test "up" ".* in cppsub_ .* at langs2\\.$ext.*return foo \\(.*" \ |
c906108c | 119 | "up to cppsub_ in langs.exp" |
085dd6e6 | 120 | gdb_test "show language" "currently $lang.*" \ |
c906108c SS |
121 | "show language at cppsub_ in langs.exp" |
122 | ||
085dd6e6 | 123 | if { !$isfixed } { set lang fortran } |
c906108c | 124 | if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" } |
085dd6e6 | 125 | gdb_test "up" ".* in fsub.* at langs1\\.f.*" \ |
c906108c | 126 | "up to fsub in langs.exp" |
085dd6e6 | 127 | gdb_test "show language" "currently $lang.*" \ |
c906108c SS |
128 | "show language at fsub in langs.exp" |
129 | ||
085dd6e6 JM |
130 | # Take out xfail. This test has been passing for sometime now. |
131 | #if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" } | |
132 | if { !$isfixed } { set lang c } | |
133 | gdb_test "up" ".* in $do_func .* at .*langs0\\.c.*return fsub.*" \ | |
c906108c | 134 | "up to langs0__2do in langs.exp" |
085dd6e6 | 135 | gdb_test "show language" "currently $lang\".*" \ |
c906108c SS |
136 | "show language at langs0__2do in langs.exp" |
137 | ||
138 | gdb_test "up" ".* in main .* at .*langs0\\.c.*if \\(langs0__2do \\(.*" \ | |
139 | "up to main in langs.exp" | |
085dd6e6 | 140 | gdb_test "show language" "currently $lang\".*" \ |
c906108c SS |
141 | "show language at main in langs.exp" |
142 | ||
143 | if [target_info exists gdb,noresults] { return } | |
144 | ||
fda326dd | 145 | gdb_continue_to_end "langs.exp" |
c906108c SS |
146 | } |
147 | ||
f125c9a4 JB |
148 | gdb_exit |
149 | gdb_start | |
150 | gdb_reinitialize_dir $srcdir/$subdir | |
151 | gdb_load $binfile | |
152 | ||
153 | # Try exercising the "minimal" language a bit... | |
154 | ||
155 | if [runto csub] then { | |
156 | gdb_test "set lang minimal" \ | |
157 | "Warning: the current language does not match this frame." \ | |
158 | "set lang to minimal" | |
159 | ||
160 | gdb_test "print x" " = 5000" "print parameter value" | |
161 | } | |
162 | ||
085dd6e6 | 163 | set timeout $oldtimeout |
c906108c | 164 | return 0 |