1 # Copyright
1997, 1999, 2004, 2005 Free Software Foundation
, Inc.
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.
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.
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.
17 # Please email
any bugs
, comments
, and
/or additions to this file to
:
18 # bug
-gdb@prep.ai.mit.edu
20 # Test that things still
(sort of
) work when compiled without
-g.
30 set srcfile $srcdir
/$subdir
/$testfile.c
31 set binfile $objdir
/$subdir
/$testfile
33 if [get_compiler_info $
{binfile
}] {
37 if [test_compiler_info
"xlc-*"] {
38 # By default
, IBM
'x xlc compiler doesn't add static variables into the symtab.
39 # Use
"-qstatsym" to do so.
40 set exec_opts additional_flags
=-qstatsym
45 if { [gdb_compile $srcfile $binfile executable $exec_opts
] != "" } {
46 untested
"Couldn't compile $srcfile."
50 # Start with a fresh gdb.
54 gdb_reinitialize_dir $srcdir
/$subdir
57 if [runto inner
] then {
59 # Expect to find global
/local symbols in each of
text/data
/bss.
61 # The exact format
for some of this output is not necessarily
62 # ideal
, particularly interpreting
"p top" requires a fair bit of
63 # savvy about gdb
's workings and the meaning of the "{}"
64 # construct. So the details maybe could be tweaked. But the
65 # basic purpose should be maintained, which is (a) users should be
66 # able to interact with these variables with some care (they have
67 # to know how to interpret them according to their real type,
68 # since gdb doesn't know the type
), but
(b
) users should be able
69 # to detect that gdb does not know the type
, rather than just
70 # being told they are ints or functions returning
int like old
71 # versions of gdb used to
do.
73 #
On alpha
(and other ecoff systems
) the native compilers put
74 # out debugging
info for non
-aggregate return values of functions
75 # even without
-g
, which should be accepted.
76 # Irix5
, even though it is ELF
, counts as
"ecoff" because it
77 # encapsulates ecoff debugging
info in a .mdebug section.
78 # Irix6 gcc emits no debug
info at all
for static functions and
79 # variables
, so all tests involving statics fail.
81 if {![test_compiler_info
"gcc-*"]} then { setup_xfail "mips-sgi-irix5*" "mips-sgi-irix6*" }
83 "\{(<(text variable|function), no debug info>|short \\(int\\)|short \\(\\))\} \[0-9a-fx]* <top(\\(int\\)|)>"
84 if {![test_compiler_info
"gcc-*"]} then { setup_xfail "mips-sgi-irix5*" "mips-sgi-irix6*" }
85 gdb_test
"whatis top" \
86 "(<(text variable|function), no debug info>|short \\(int\\)|short \\(\\))"
87 if {![test_compiler_info
"gcc-*"]} then { setup_xfail "mips-sgi-irix6*" }
88 gdb_test
"ptype top" "(short|int) \\((|void|int|<non-float parameter>|<non-float parameter>, <non-float parameter>)\\)"
90 if {![test_compiler_info
"gcc-*"]} then { setup_xfail "mips-sgi-irix5*" }
91 setup_xfail
"mips-sgi-irix6*"
93 "\{(<(text variable|function), no debug info>|short \\(int\\)|short \\(\\))\} \[0-9a-fx]* <middle(\\(int\\)|)>"
94 if {![test_compiler_info
"gcc-*"]} then { setup_xfail "mips-sgi-irix5*" }
95 setup_xfail
"mips-sgi-irix6*"
96 gdb_test
"whatis middle" \
97 "(<(text variable|function), no debug info>|short \\(int\\)|short \\(\\))"
98 setup_xfail
"mips-sgi-irix6*"
99 gdb_test
"ptype middle" "(short|int) \\((|void|int|<non-float parameter>|<non-float parameter>, <non-float parameter>)\\)"
101 gdb_test
"p dataglobal" "= 3"
102 gdb_test
"whatis dataglobal" \
103 "<(data variable|variable), no debug info>|int"
104 gdb_test
"ptype dataglobal" "<(data variable|variable), no debug info>|int"
106 # The only symbol xcoff puts out
for statics is
for the TOC entry.
107 # Possible
, but hairy
, for gdb to deal. Right now it doesn
't, it
108 # doesn't know the variables exist at all.
109 setup_xfail
"rs6000*-*-aix*"
110 setup_xfail
"powerpc*-*-aix*"
111 if [test_compiler_info
"gcc-*"] {
112 setup_xfail
"mips-sgi-irix6*"
114 setup_xfail
"hppa*-*-hpux*"
117 gdb_test
"p datalocal" "= 4"
119 setup_xfail
"rs6000*-*-aix*"
120 setup_xfail
"powerpc*-*-aix*"
121 if [test_compiler_info
"gcc-*"] {
122 setup_xfail
"mips-sgi-irix6*"
124 setup_xfail
"hppa*-*-hpux*"
127 gdb_test
"whatis datalocal" "<(data variable|variable), no debug info>"
129 setup_xfail
"rs6000*-*-aix*"
130 setup_xfail
"powerpc*-*-aix*"
131 if [test_compiler_info
"gcc-*"] {
132 setup_xfail
"mips-sgi-irix6*"
134 setup_xfail
"hppa*-*-hpux*"
137 gdb_test
"ptype datalocal" "<(data variable|variable), no debug info>"
138 gdb_test
"p bssglobal" "= 0"
139 gdb_test
"whatis bssglobal" "<(data variable|variable), no debug info>|int"
140 gdb_test
"ptype bssglobal" "<(data variable|variable), no debug info>|int"
142 setup_xfail
"rs6000*-*-aix*"
143 setup_xfail
"powerpc*-*-aix*"
144 if [test_compiler_info
"gcc-*"] {
145 setup_xfail
"mips-sgi-irix6*"
147 setup_xfail
"hppa*-*-hpux*"
150 gdb_test
"p bsslocal" "= 0"
152 setup_xfail
"rs6000*-*-aix*"
153 setup_xfail
"powerpc*-*-aix*"
154 if [test_compiler_info
"gcc-*"] {
155 setup_xfail
"mips-sgi-irix6*"
157 setup_xfail
"hppa*-*-hpux*"
160 gdb_test
"whatis bsslocal" "<(data variable|variable), no debug info>"
162 setup_xfail
"rs6000*-*-aix*"
163 setup_xfail
"powerpc*-*-aix*"
164 if [test_compiler_info
"gcc-*"] {
165 setup_xfail
"mips-sgi-irix6*"
167 setup_xfail
"hppa*-*-hpux*"
169 gdb_test
"ptype bsslocal" "<(data variable|variable), no debug info>"
171 if [test_compiler_info
"gcc-*"] {
172 setup_xfail
"mips-sgi-irix6*"
175 gdb_test
"backtrace 10" "#0.*inner.*#1.*middle.*#2.*top.*#3.*main.*" \
176 "backtrace from inner in nodebug.exp"
177 # Or
if that doesn
't work, at least hope for the external symbols
178 # Commented out because if we aren't going to xfail the above test
179 # ever
, why bother with a weaker test?
180 #gdb_test
"backtrace 10" "#0.*inner.*#1.*#2.*top.*#3.*main.*" \
181 #
"backtrace from inner in nodebug.exp for externals"
183 # This test is not as
obscure as it might look. `p getenv
("TERM")'
184 # is a real
-world example
, at least
on many systems.
185 if { ! [test_compiler_info
"gcc-*"]} {
186 setup_xfail
"mips-sgi-irix6*"
188 if [target_info
exists gdb
,cannot_call_functions
] {
189 setup_xfail
"*-*-*" 2416
190 fail
"p/c array_index(\"abcdef\",2)"
193 #
On HP
-UX
, a support function
(__d_plt_call
) necessary to
194 # implement an inferior
call is normally only available when
195 # the inferior was compiled with
-g. Thus
, we expect this
196 # testpoint to fail
on HP
-UX.
197 if { [istarget
"hppa*-hpux*"] } {
198 send_gdb
"p/c array_index(\"abcdef\",2)\n"
200 -re
".*Suggest linking executable with -g.*$gdb_prompt $" { pass "p/c array_index(\"abcdef\",2)" }
201 -re
".*Cannot find __wdb_call_dummy in.*end.o.*" { pass "p/c array_index(\"abcdef\",2)" }
202 -re
".*99 'c'.*" { pass "p/c array_index(\"abcdef\",2)" }
203 timeout
{ fail
"(timeout) p/c array_index" }
206 # We need to up this because this can be really slow
on some boards.
207 #
(malloc
() is called as part of the test
).
209 gdb_test
{p
/c array_index
("abcdef",2)} " = 99 'c'"
213 # Now
, try that we can give names of file
-local symbols which happen
214 # to be unique
, and have it still work
215 if [test_compiler_info
"gcc-*"] {
216 setup_xfail
"mips-sgi-irix6*"
218 if [runto middle
] then {
219 gdb_test
"backtrace 10" "#0.*middle.*#1.*top.*#2.*main.*" \
220 "backtrace from middle in nodebug.exp"