Commit | Line | Data |
---|---|---|
e2882c85 | 1 | # Copyright (C) 1997-2018 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 | |
e22f8b7c | 5 | # the Free Software Foundation; either version 3 of the License, or |
c906108c | 6 | # (at your option) any later version. |
e22f8b7c | 7 | # |
c906108c SS |
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. | |
e22f8b7c | 12 | # |
c906108c | 13 | # You should have received a copy of the GNU General Public License |
e22f8b7c | 14 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
c906108c | 15 | |
c906108c | 16 | |
f8b41b00 | 17 | standard_testfile langs0.c langs1.c langs2.c |
c906108c SS |
18 | |
19 | if [is_remote host] { | |
20 | remote_download host ${srcdir}/${subdir}/langs1.f | |
21 | remote_download host ${srcdir}/${subdir}/langs2.cxx | |
22 | } | |
23 | ||
24 | ||
5b362f04 | 25 | if {[prepare_for_testing "failed to prepare" ${testfile} \ |
f8b41b00 TT |
26 | [list $srcfile $srcfile2 $srcfile3] {debug}]} { |
27 | return -1 | |
c906108c SS |
28 | } |
29 | ||
085dd6e6 JM |
30 | set oldtimeout $timeout |
31 | set timeout 10 | |
c906108c SS |
32 | |
33 | ||
34 | ||
35 | # Create and source the file that provides information about the compiler | |
36 | # used to compile the test case. | |
4c93b1db | 37 | if [get_compiler_info] { |
ae59b1da | 38 | return -1 |
c906108c SS |
39 | } |
40 | ||
a20714ff | 41 | gdb_test_multiple "b -qualified langs0" "break on nonexistent function in langs.exp" { |
9b50c11b | 42 | -re "Function \"langs0\" not defined\..*Make breakpoint pending on future shared library load.*y or .n.. $" { |
18fe2033 JJ |
43 | |
44 | gdb_test "n" "" "break on nonexistent function in langs.exp" | |
45 | } | |
46 | -re "Breakpoint .* (deferred).*$gdb_prompt $" { | |
47 | pass "break on nonexistent function in langs.exp" | |
48 | } | |
49 | } | |
c906108c | 50 | |
b6304613 SM |
51 | # TODO: Since there variables are now constants, we can cleanup the test, |
52 | # remove some dead code. | |
53 | set isfixed 0 | |
54 | set foo_func foo__Fi | |
55 | set do_func langs0__2do | |
085dd6e6 | 56 | |
c906108c SS |
57 | if [runto csub] then { |
58 | ||
085dd6e6 JM |
59 | if { !$isfixed } { set lang c } |
60 | gdb_test "show language" "currently $lang\".*" \ | |
c906108c | 61 | "show language at csub in langs.exp" |
b6304613 | 62 | |
085dd6e6 | 63 | 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 | 64 | |
085dd6e6 | 65 | if { !$isfixed } { set lang c\\+\\+; set ext cxx } |
c906108c | 66 | if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" } |
085dd6e6 | 67 | gdb_test "up" ".* in (foo|$foo_func).* at langs2\\.$ext.*return csub \\(.*" \ |
c906108c | 68 | "up to foo in langs.exp" |
085dd6e6 | 69 | gdb_test "show language" "currently $lang.*" \ |
c906108c SS |
70 | "show language at foo in langs.exp" |
71 | ||
72 | if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" } | |
085dd6e6 | 73 | gdb_test "up" ".* in cppsub_ .* at langs2\\.$ext.*return foo \\(.*" \ |
c906108c | 74 | "up to cppsub_ in langs.exp" |
085dd6e6 | 75 | gdb_test "show language" "currently $lang.*" \ |
c906108c SS |
76 | "show language at cppsub_ in langs.exp" |
77 | ||
085dd6e6 | 78 | if { !$isfixed } { set lang fortran } |
c906108c | 79 | if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" } |
085dd6e6 | 80 | gdb_test "up" ".* in fsub.* at langs1\\.f.*" \ |
c906108c | 81 | "up to fsub in langs.exp" |
085dd6e6 | 82 | gdb_test "show language" "currently $lang.*" \ |
c906108c SS |
83 | "show language at fsub in langs.exp" |
84 | ||
085dd6e6 JM |
85 | if { !$isfixed } { set lang c } |
86 | gdb_test "up" ".* in $do_func .* at .*langs0\\.c.*return fsub.*" \ | |
c906108c | 87 | "up to langs0__2do in langs.exp" |
085dd6e6 | 88 | gdb_test "show language" "currently $lang\".*" \ |
c906108c SS |
89 | "show language at langs0__2do in langs.exp" |
90 | ||
91 | gdb_test "up" ".* in main .* at .*langs0\\.c.*if \\(langs0__2do \\(.*" \ | |
92 | "up to main in langs.exp" | |
085dd6e6 | 93 | gdb_test "show language" "currently $lang\".*" \ |
c906108c SS |
94 | "show language at main in langs.exp" |
95 | ||
96 | if [target_info exists gdb,noresults] { return } | |
97 | ||
fda326dd | 98 | gdb_continue_to_end "langs.exp" |
c906108c SS |
99 | } |
100 | ||
f125c9a4 JB |
101 | gdb_exit |
102 | gdb_start | |
103 | gdb_reinitialize_dir $srcdir/$subdir | |
104 | gdb_load $binfile | |
105 | ||
106 | # Try exercising the "minimal" language a bit... | |
107 | ||
108 | if [runto csub] then { | |
109 | gdb_test "set lang minimal" \ | |
110 | "Warning: the current language does not match this frame." \ | |
111 | "set lang to minimal" | |
112 | ||
113 | gdb_test "print x" " = 5000" "print parameter value" | |
114 | } | |
115 | ||
085dd6e6 | 116 | set timeout $oldtimeout |
c906108c | 117 | return 0 |