1 |
106 |
markom |
# Copyright (C) 1997, 1998 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 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}] != "" } {
|
37 |
|
|
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
|
38 |
|
|
}
|
39 |
|
|
|
40 |
|
|
if { [gdb_compile "${srcdir}/${subdir}/langs1.c" "${binfile}1.o" object {debug}] != "" } {
|
41 |
|
|
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
|
42 |
|
|
}
|
43 |
|
|
|
44 |
|
|
if { [gdb_compile "${srcdir}/${subdir}/langs2.c" "${binfile}2.o" object {debug}] != "" } {
|
45 |
|
|
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
|
46 |
|
|
}
|
47 |
|
|
|
48 |
|
|
if { [gdb_compile "${binfile}0.o ${binfile}1.o ${binfile}2.o" ${binfile} executable {debug}] != "" } {
|
49 |
|
|
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
|
50 |
|
|
}
|
51 |
|
|
|
52 |
|
|
set oldtimeout $timeout
|
53 |
|
|
set timeout 10
|
54 |
|
|
|
55 |
|
|
|
56 |
|
|
|
57 |
|
|
# Create and source the file that provides information about the compiler
|
58 |
|
|
# used to compile the test case.
|
59 |
|
|
if [get_compiler_info ${binfile}] {
|
60 |
|
|
return -1;
|
61 |
|
|
}
|
62 |
|
|
|
63 |
|
|
gdb_exit
|
64 |
|
|
gdb_start
|
65 |
|
|
gdb_reinitialize_dir $srcdir/$subdir
|
66 |
|
|
gdb_load $binfile
|
67 |
|
|
|
68 |
|
|
gdb_test "b langs0" "Function \"langs0\" not defined\.|Breakpoint .* (deferred).*" \
|
69 |
|
|
"break on nonexistent function in langs.exp"
|
70 |
|
|
|
71 |
|
|
if {$hp_aCC_compiler} {
|
72 |
|
|
set isfixed 1
|
73 |
|
|
set lang c\\+\\+
|
74 |
|
|
set ext cxx
|
75 |
|
|
set foo_func foo__Fi__Fi
|
76 |
|
|
set do_func do::langs0
|
77 |
|
|
} else {
|
78 |
|
|
if {$hp_cc_compiler} {
|
79 |
|
|
set isfixed 1
|
80 |
|
|
set lang c
|
81 |
|
|
set ext c
|
82 |
|
|
} else {
|
83 |
|
|
set isfixed 0
|
84 |
|
|
}
|
85 |
|
|
set foo_func foo__Fi
|
86 |
|
|
set do_func langs0__2do
|
87 |
|
|
}
|
88 |
|
|
|
89 |
|
|
if [runto csub] then {
|
90 |
|
|
|
91 |
|
|
if { !$isfixed } { set lang c }
|
92 |
|
|
gdb_test "show language" "currently $lang\".*" \
|
93 |
|
|
"show language at csub in langs.exp"
|
94 |
|
|
# On some machines, foo doesn't get demangled because the N_SOL for
|
95 |
|
|
# langs2.cxx is seen only after the function stab for foo. So
|
96 |
|
|
# the following regexps are kludged to accept foo__Fi as well as foo,
|
97 |
|
|
# even though only the latter is correct. I haven't tried to xfail it
|
98 |
|
|
# because it depends on details of the compiler.
|
99 |
|
|
|
100 |
|
|
# Take out xfail. This test has been passing for some time now.
|
101 |
|
|
#if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
|
102 |
|
|
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"
|
103 |
|
|
|
104 |
|
|
if { !$isfixed } { set lang c\\+\\+; set ext cxx }
|
105 |
|
|
if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
|
106 |
|
|
gdb_test "up" ".* in (foo|$foo_func).* at langs2\\.$ext.*return csub \\(.*" \
|
107 |
|
|
"up to foo in langs.exp"
|
108 |
|
|
gdb_test "show language" "currently $lang.*" \
|
109 |
|
|
"show language at foo in langs.exp"
|
110 |
|
|
|
111 |
|
|
if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
|
112 |
|
|
gdb_test "up" ".* in cppsub_ .* at langs2\\.$ext.*return foo \\(.*" \
|
113 |
|
|
"up to cppsub_ in langs.exp"
|
114 |
|
|
gdb_test "show language" "currently $lang.*" \
|
115 |
|
|
"show language at cppsub_ in langs.exp"
|
116 |
|
|
|
117 |
|
|
if { !$isfixed } { set lang fortran }
|
118 |
|
|
if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
|
119 |
|
|
gdb_test "up" ".* in fsub.* at langs1\\.f.*" \
|
120 |
|
|
"up to fsub in langs.exp"
|
121 |
|
|
gdb_test "show language" "currently $lang.*" \
|
122 |
|
|
"show language at fsub in langs.exp"
|
123 |
|
|
|
124 |
|
|
# Take out xfail. This test has been passing for sometime now.
|
125 |
|
|
#if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
|
126 |
|
|
if { !$isfixed } { set lang c }
|
127 |
|
|
gdb_test "up" ".* in $do_func .* at .*langs0\\.c.*return fsub.*" \
|
128 |
|
|
"up to langs0__2do in langs.exp"
|
129 |
|
|
gdb_test "show language" "currently $lang\".*" \
|
130 |
|
|
"show language at langs0__2do in langs.exp"
|
131 |
|
|
|
132 |
|
|
gdb_test "up" ".* in main .* at .*langs0\\.c.*if \\(langs0__2do \\(.*" \
|
133 |
|
|
"up to main in langs.exp"
|
134 |
|
|
gdb_test "show language" "currently $lang\".*" \
|
135 |
|
|
"show language at main in langs.exp"
|
136 |
|
|
|
137 |
|
|
if [target_info exists gdb,noresults] { return }
|
138 |
|
|
|
139 |
|
|
if [target_info exists use_gdb_stub] {
|
140 |
|
|
gdb_breakpoint "exit"
|
141 |
|
|
gdb_test "cont" "Breakpoint .*exit.*" "continue to exit in langs.exp"
|
142 |
|
|
} else {
|
143 |
|
|
gdb_test "cont" "Program exited normally\\..*" \
|
144 |
|
|
"continue to exit in langs.exp"
|
145 |
|
|
}
|
146 |
|
|
}
|
147 |
|
|
|
148 |
|
|
set timeout $oldtimeout
|
149 |
|
|
return 0
|