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