]>
Commit | Line | Data |
---|---|---|
6aba47ca | 1 | # Copyright (C) 1997, 1998, 2007 Free Software Foundation, Inc. |
c906108c SS |
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 2 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, write to the Free Software | |
15 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
16 | ||
17 | # Please email any bugs, comments, and/or additions to this file to: | |
18 | # bug-gdb@prep.ai.mit.edu | |
19 | ||
20 | if $tracelevel then { | |
21 | strace $tracelevel | |
22 | } | |
23 | ||
24 | set prms_id 0 | |
25 | set bug_id 0 | |
26 | ||
27 | set testfile langs | |
28 | set binfile ${objdir}/${subdir}/${testfile} | |
29 | ||
30 | if [is_remote host] { | |
31 | remote_download host ${srcdir}/${subdir}/langs1.f | |
32 | remote_download host ${srcdir}/${subdir}/langs2.cxx | |
33 | } | |
34 | ||
35 | ||
36 | if { [gdb_compile "${srcdir}/${subdir}/langs0.c" "${binfile}0.o" object {debug}] != "" } { | |
b60f0898 JB |
37 | untested langs.exp |
38 | return -1 | |
c906108c SS |
39 | } |
40 | ||
41 | if { [gdb_compile "${srcdir}/${subdir}/langs1.c" "${binfile}1.o" object {debug}] != "" } { | |
b60f0898 JB |
42 | untested langs.exp |
43 | return -1 | |
c906108c SS |
44 | } |
45 | ||
46 | if { [gdb_compile "${srcdir}/${subdir}/langs2.c" "${binfile}2.o" object {debug}] != "" } { | |
b60f0898 JB |
47 | untested langs.exp |
48 | return -1 | |
c906108c SS |
49 | } |
50 | ||
51 | if { [gdb_compile "${binfile}0.o ${binfile}1.o ${binfile}2.o" ${binfile} executable {debug}] != "" } { | |
b60f0898 JB |
52 | untested langs.exp |
53 | return -1 | |
c906108c SS |
54 | } |
55 | ||
085dd6e6 JM |
56 | set oldtimeout $timeout |
57 | set timeout 10 | |
c906108c SS |
58 | |
59 | ||
60 | ||
61 | # Create and source the file that provides information about the compiler | |
62 | # used to compile the test case. | |
63 | if [get_compiler_info ${binfile}] { | |
64 | return -1; | |
65 | } | |
66 | ||
67 | gdb_exit | |
68 | gdb_start | |
69 | gdb_reinitialize_dir $srcdir/$subdir | |
70 | gdb_load $binfile | |
71 | ||
18fe2033 | 72 | gdb_test_multiple "b langs0" "break on nonexistent function in langs.exp" { |
9b50c11b | 73 | -re "Function \"langs0\" not defined\..*Make breakpoint pending on future shared library load.*y or .n.. $" { |
18fe2033 JJ |
74 | |
75 | gdb_test "n" "" "break on nonexistent function in langs.exp" | |
76 | } | |
77 | -re "Breakpoint .* (deferred).*$gdb_prompt $" { | |
78 | pass "break on nonexistent function in langs.exp" | |
79 | } | |
80 | } | |
c906108c | 81 | |
085dd6e6 JM |
82 | if {$hp_aCC_compiler} { |
83 | set isfixed 1 | |
84 | set lang c\\+\\+ | |
85 | set ext cxx | |
86 | set foo_func foo__Fi__Fi | |
87 | set do_func do::langs0 | |
88 | } else { | |
89 | if {$hp_cc_compiler} { | |
90 | set isfixed 1 | |
91 | set lang c | |
92 | set ext c | |
93 | } else { | |
94 | set isfixed 0 | |
95 | } | |
96 | set foo_func foo__Fi | |
97 | set do_func langs0__2do | |
98 | } | |
99 | ||
c906108c SS |
100 | if [runto csub] then { |
101 | ||
085dd6e6 JM |
102 | if { !$isfixed } { set lang c } |
103 | gdb_test "show language" "currently $lang\".*" \ | |
c906108c SS |
104 | "show language at csub in langs.exp" |
105 | # On some machines, foo doesn't get demangled because the N_SOL for | |
106 | # langs2.cxx is seen only after the function stab for foo. So | |
107 | # the following regexps are kludged to accept foo__Fi as well as foo, | |
108 | # even though only the latter is correct. I haven't tried to xfail it | |
109 | # because it depends on details of the compiler. | |
110 | ||
085dd6e6 JM |
111 | # Take out xfail. This test has been passing for some time now. |
112 | #if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" } | |
113 | 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 | 114 | |
085dd6e6 | 115 | if { !$isfixed } { set lang c\\+\\+; set ext cxx } |
c906108c | 116 | if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" } |
085dd6e6 | 117 | gdb_test "up" ".* in (foo|$foo_func).* at langs2\\.$ext.*return csub \\(.*" \ |
c906108c | 118 | "up to foo in langs.exp" |
085dd6e6 | 119 | gdb_test "show language" "currently $lang.*" \ |
c906108c SS |
120 | "show language at foo in langs.exp" |
121 | ||
122 | if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" } | |
085dd6e6 | 123 | gdb_test "up" ".* in cppsub_ .* at langs2\\.$ext.*return foo \\(.*" \ |
c906108c | 124 | "up to cppsub_ in langs.exp" |
085dd6e6 | 125 | gdb_test "show language" "currently $lang.*" \ |
c906108c SS |
126 | "show language at cppsub_ in langs.exp" |
127 | ||
085dd6e6 | 128 | if { !$isfixed } { set lang fortran } |
c906108c | 129 | if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" } |
085dd6e6 | 130 | gdb_test "up" ".* in fsub.* at langs1\\.f.*" \ |
c906108c | 131 | "up to fsub in langs.exp" |
085dd6e6 | 132 | gdb_test "show language" "currently $lang.*" \ |
c906108c SS |
133 | "show language at fsub in langs.exp" |
134 | ||
085dd6e6 JM |
135 | # Take out xfail. This test has been passing for sometime now. |
136 | #if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" } | |
137 | if { !$isfixed } { set lang c } | |
138 | gdb_test "up" ".* in $do_func .* at .*langs0\\.c.*return fsub.*" \ | |
c906108c | 139 | "up to langs0__2do in langs.exp" |
085dd6e6 | 140 | gdb_test "show language" "currently $lang\".*" \ |
c906108c SS |
141 | "show language at langs0__2do in langs.exp" |
142 | ||
143 | gdb_test "up" ".* in main .* at .*langs0\\.c.*if \\(langs0__2do \\(.*" \ | |
144 | "up to main in langs.exp" | |
085dd6e6 | 145 | gdb_test "show language" "currently $lang\".*" \ |
c906108c SS |
146 | "show language at main in langs.exp" |
147 | ||
148 | if [target_info exists gdb,noresults] { return } | |
149 | ||
150 | if [target_info exists use_gdb_stub] { | |
151 | gdb_breakpoint "exit" | |
152 | gdb_test "cont" "Breakpoint .*exit.*" "continue to exit in langs.exp" | |
153 | } else { | |
154 | gdb_test "cont" "Program exited normally\\..*" \ | |
155 | "continue to exit in langs.exp" | |
156 | } | |
157 | } | |
158 | ||
f125c9a4 JB |
159 | gdb_exit |
160 | gdb_start | |
161 | gdb_reinitialize_dir $srcdir/$subdir | |
162 | gdb_load $binfile | |
163 | ||
164 | # Try exercising the "minimal" language a bit... | |
165 | ||
166 | if [runto csub] then { | |
167 | gdb_test "set lang minimal" \ | |
168 | "Warning: the current language does not match this frame." \ | |
169 | "set lang to minimal" | |
170 | ||
171 | gdb_test "print x" " = 5000" "print parameter value" | |
172 | } | |
173 | ||
085dd6e6 | 174 | set timeout $oldtimeout |
c906108c | 175 | return 0 |