change delegation for to_read_description
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / nodebug.exp
CommitLineData
ecd75fc8 1# Copyright 1997-2014 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
SS
16# Test that things still (sort of) work when compiled without -g.
17
c906108c 18
822bd149 19standard_testfile .c
c906108c 20
4c93b1db 21if [get_compiler_info] {
ae59b1da 22 return -1
c906108c
SS
23}
24
ed6df200
PG
25if [test_compiler_info "xlc-*"] {
26 # By default, IBM'x xlc compiler doesn't add static variables into the symtab.
27 # Use "-qstatsym" to do so.
28 set exec_opts additional_flags=-qstatsym
29} else {
30 set exec_opts ""
31}
32
822bd149 33if { [gdb_compile $srcdir/$subdir/$srcfile $binfile executable $exec_opts] != "" } {
ed6df200
PG
34 untested "Couldn't compile $srcfile."
35 return -1
36}
37
38# Start with a fresh gdb.
39
822bd149 40clean_restart $binfile
c906108c
SS
41
42if [runto inner] then {
43
44 # Expect to find global/local symbols in each of text/data/bss.
45
46 # The exact format for some of this output is not necessarily
47 # ideal, particularly interpreting "p top" requires a fair bit of
48 # savvy about gdb's workings and the meaning of the "{}"
49 # construct. So the details maybe could be tweaked. But the
50 # basic purpose should be maintained, which is (a) users should be
51 # able to interact with these variables with some care (they have
52 # to know how to interpret them according to their real type,
53 # since gdb doesn't know the type), but (b) users should be able
54 # to detect that gdb does not know the type, rather than just
55 # being told they are ints or functions returning int like old
56 # versions of gdb used to do.
57
58 # On alpha (and other ecoff systems) the native compilers put
59 # out debugging info for non-aggregate return values of functions
60 # even without -g, which should be accepted.
61 # Irix5, even though it is ELF, counts as "ecoff" because it
62 # encapsulates ecoff debugging info in a .mdebug section.
b2ce2854 63 # Irix6 gcc emits no debug info at all for static functions and
c906108c
SS
64 # variables, so all tests involving statics fail.
65
ed6df200 66 if {![test_compiler_info "gcc-*"]} then { setup_xfail "mips-sgi-irix5*" "mips-sgi-irix6*" }
c906108c 67 gdb_test "p top" \
efd11a33 68 "\{(<(text variable|function), no debug info>|short \\(int\\)|short \\(\\))\} \[0-9a-fx]* <\\.?top(\\(int\\)|)>"
ed6df200 69 if {![test_compiler_info "gcc-*"]} then { setup_xfail "mips-sgi-irix5*" "mips-sgi-irix6*" }
c906108c 70 gdb_test "whatis top" \
085dd6e6 71 "(<(text variable|function), no debug info>|short \\(int\\)|short \\(\\))"
ed6df200 72 if {![test_compiler_info "gcc-*"]} then { setup_xfail "mips-sgi-irix6*" }
085dd6e6 73 gdb_test "ptype top" "(short|int) \\((|void|int|<non-float parameter>|<non-float parameter>, <non-float parameter>)\\)"
c906108c 74
ed6df200 75 if {![test_compiler_info "gcc-*"]} then { setup_xfail "mips-sgi-irix5*" }
c906108c
SS
76 setup_xfail "mips-sgi-irix6*"
77 gdb_test "p middle" \
efd11a33 78 "\{(<(text variable|function), no debug info>|short \\(int\\)|short \\(\\))\} \[0-9a-fx]* <\\.?middle(\\(int\\)|)>"
ed6df200 79 if {![test_compiler_info "gcc-*"]} then { setup_xfail "mips-sgi-irix5*" }
c906108c
SS
80 setup_xfail "mips-sgi-irix6*"
81 gdb_test "whatis middle" \
085dd6e6 82 "(<(text variable|function), no debug info>|short \\(int\\)|short \\(\\))"
c906108c 83 setup_xfail "mips-sgi-irix6*"
085dd6e6 84 gdb_test "ptype middle" "(short|int) \\((|void|int|<non-float parameter>|<non-float parameter>, <non-float parameter>)\\)"
c906108c
SS
85
86 gdb_test "p dataglobal" "= 3"
87 gdb_test "whatis dataglobal" \
085dd6e6
JM
88 "<(data variable|variable), no debug info>|int"
89 gdb_test "ptype dataglobal" "<(data variable|variable), no debug info>|int"
c906108c
SS
90
91 # The only symbol xcoff puts out for statics is for the TOC entry.
92 # Possible, but hairy, for gdb to deal. Right now it doesn't, it
93 # doesn't know the variables exist at all.
94 setup_xfail "rs6000*-*-aix*"
95 setup_xfail "powerpc*-*-aix*"
ed6df200
PG
96 if [test_compiler_info "gcc-*"] {
97 setup_xfail "mips-sgi-irix6*"
98 } else {
99 setup_xfail "hppa*-*-hpux*"
100 }
101
c906108c 102 gdb_test "p datalocal" "= 4"
ed6df200 103
c906108c
SS
104 setup_xfail "rs6000*-*-aix*"
105 setup_xfail "powerpc*-*-aix*"
ed6df200
PG
106 if [test_compiler_info "gcc-*"] {
107 setup_xfail "mips-sgi-irix6*"
108 } else {
109 setup_xfail "hppa*-*-hpux*"
110 }
111
c906108c 112 gdb_test "whatis datalocal" "<(data variable|variable), no debug info>"
ed6df200 113
c906108c
SS
114 setup_xfail "rs6000*-*-aix*"
115 setup_xfail "powerpc*-*-aix*"
ed6df200
PG
116 if [test_compiler_info "gcc-*"] {
117 setup_xfail "mips-sgi-irix6*"
118 } else {
119 setup_xfail "hppa*-*-hpux*"
120 }
121
c906108c 122 gdb_test "ptype datalocal" "<(data variable|variable), no debug info>"
c906108c 123 gdb_test "p bssglobal" "= 0"
085dd6e6
JM
124 gdb_test "whatis bssglobal" "<(data variable|variable), no debug info>|int"
125 gdb_test "ptype bssglobal" "<(data variable|variable), no debug info>|int"
c906108c
SS
126
127 setup_xfail "rs6000*-*-aix*"
128 setup_xfail "powerpc*-*-aix*"
ed6df200
PG
129 if [test_compiler_info "gcc-*"] {
130 setup_xfail "mips-sgi-irix6*"
131 } else {
132 setup_xfail "hppa*-*-hpux*"
133 }
134
c906108c 135 gdb_test "p bsslocal" "= 0"
ed6df200 136
c906108c
SS
137 setup_xfail "rs6000*-*-aix*"
138 setup_xfail "powerpc*-*-aix*"
ed6df200
PG
139 if [test_compiler_info "gcc-*"] {
140 setup_xfail "mips-sgi-irix6*"
141 } else {
142 setup_xfail "hppa*-*-hpux*"
143 }
144
c906108c 145 gdb_test "whatis bsslocal" "<(data variable|variable), no debug info>"
ed6df200 146
c906108c
SS
147 setup_xfail "rs6000*-*-aix*"
148 setup_xfail "powerpc*-*-aix*"
ed6df200
PG
149 if [test_compiler_info "gcc-*"] {
150 setup_xfail "mips-sgi-irix6*"
151 } else {
152 setup_xfail "hppa*-*-hpux*"
153 }
c906108c
SS
154 gdb_test "ptype bsslocal" "<(data variable|variable), no debug info>"
155
ed6df200
PG
156 if [test_compiler_info "gcc-*"] {
157 setup_xfail "mips-sgi-irix6*"
158 }
159
c906108c
SS
160 gdb_test "backtrace 10" "#0.*inner.*#1.*middle.*#2.*top.*#3.*main.*" \
161 "backtrace from inner in nodebug.exp"
162 # Or if that doesn't work, at least hope for the external symbols
163 # Commented out because if we aren't going to xfail the above test
164 # ever, why bother with a weaker test?
165 #gdb_test "backtrace 10" "#0.*inner.*#1.*#2.*top.*#3.*main.*" \
166 # "backtrace from inner in nodebug.exp for externals"
167
168 # This test is not as obscure as it might look. `p getenv ("TERM")'
169 # is a real-world example, at least on many systems.
ed6df200
PG
170 if { ! [test_compiler_info "gcc-*"]} {
171 setup_xfail "mips-sgi-irix6*"
172 }
c906108c
SS
173 if [target_info exists gdb,cannot_call_functions] {
174 setup_xfail "*-*-*" 2416
175 fail "p/c array_index(\"abcdef\",2)"
176 } else {
085dd6e6
JM
177 #
178 # On HP-UX, a support function (__d_plt_call) necessary to
179 # implement an inferior call is normally only available when
180 # the inferior was compiled with -g. Thus, we expect this
181 # testpoint to fail on HP-UX.
182 if { [istarget "hppa*-hpux*"] } {
65731a6b
MS
183 gdb_test_multiple "p/c array_index(\"abcdef\",2)" \
184 "p/c array_index(\"abcdef\",2)" {
185 -re ".*Suggest linking executable with -g.*$gdb_prompt $" {
186 pass "p/c array_index(\"abcdef\",2)"
187 }
188 -re ".*Cannot find __wdb_call_dummy in.*end.o.*" {
189 pass "p/c array_index(\"abcdef\",2)"
190 }
191 -re ".*99 'c'.*" {
192 pass "p/c array_index(\"abcdef\",2)"
193 }
085dd6e6
JM
194 }
195 } else {
9846de1b
JM
196 # We need to up this because this can be really slow on some boards.
197 # (malloc() is called as part of the test).
97f2ed50
DJ
198 set prev_timeout $timeout
199 set timeout 60
085dd6e6 200 gdb_test {p/c array_index("abcdef",2)} " = 99 'c'"
97f2ed50 201 set timeout $prev_timeout
085dd6e6 202 }
c906108c
SS
203 }
204
205 # Now, try that we can give names of file-local symbols which happen
206 # to be unique, and have it still work
ed6df200
PG
207 if [test_compiler_info "gcc-*"] {
208 setup_xfail "mips-sgi-irix6*"
209 }
c906108c
SS
210 if [runto middle] then {
211 gdb_test "backtrace 10" "#0.*middle.*#1.*top.*#2.*main.*" \
212 "backtrace from middle in nodebug.exp"
213 }
214}
This page took 1.632678 seconds and 4 git commands to generate.