* gdb.base/nodebug.exp: Don't try to do an inferior function
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / nodebug.exp
CommitLineData
29f25f6f 1# Test that things still (sort of) work when compiled without -g.
29f25f6f
JK
2
3if $tracelevel then {
4 strace $tracelevel
5}
6
7set prms_id 0
8set bug_id 0
9
782445c7 10set testfile nodebug
6420594b 11set srcfile ${testfile}.c
782445c7 12set binfile ${objdir}/${subdir}/${testfile}
787f6220 13if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable ""] != "" } {
782445c7
FF
14 perror "Couldn't compile ${srcfile}"
15 return -1
16}
29f25f6f 17
6420594b
SG
18# Create and source the file that provides information about the compiler
19# used to compile the test case.
787f6220
BM
20if [get_compiler_info ${binfile}] {
21 return -1;
50f04a5a
MS
22}
23
6420594b
SG
24source ${binfile}.ci
25
787f6220
BM
26gdb_exit
27gdb_start
782445c7
FF
28gdb_reinitialize_dir $srcdir/$subdir
29gdb_load $binfile
782445c7
FF
30
31if [runto inner] then {
32
33 # Expect to find global/local symbols in each of text/data/bss.
34
35 # The exact format for some of this output is not necessarily
36 # ideal, particularly interpreting "p top" requires a fair bit of
37 # savvy about gdb's workings and the meaning of the "{}"
38 # construct. So the details maybe could be tweaked. But the
39 # basic purpose should be maintained, which is (a) users should be
40 # able to interact with these variables with some care (they have
41 # to know how to interpret them according to their real type,
42 # since gdb doesn't know the type), but (b) users should be able
43 # to detect that gdb does not know the type, rather than just
44 # being told they are ints or functions returning int like old
45 # versions of gdb used to do.
46
47 # On alpha (and other ecoff systems) the native compilers put
48 # out debugging info for non-aggregate return values of functions
49 # even without -g, which should be accepted.
50 # Irix5, even though it is ELF, counts as "ecoff" because it
51 # encapsulates ecoff debugging info in a .mdebug section.
787f6220
BM
52 # Irix6 gcc omits no debug info at all for static functions and
53 # variables, so all tests involving statics fail.
782445c7 54
787f6220 55 if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix5*" "mips-sgi-irix6*" }
782445c7
FF
56 gdb_test "p top" \
57 "{(<(text variable|function), no debug info>|short \\(\\))} \[0-9a-fx]* <top>"
787f6220 58 if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix5*" "mips-sgi-irix6*" }
782445c7
FF
59 gdb_test "whatis top" \
60 "(<(text variable|function), no debug info>|short \\(\\))"
787f6220 61 if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix6*" }
782445c7
FF
62 gdb_test "ptype top" "(short|int) \\((|<non-float parameter>|<non-float parameter>, <non-float parameter>)\\)"
63
64 if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix5*" }
787f6220 65 setup_xfail "mips-sgi-irix6*"
782445c7
FF
66 gdb_test "p middle" \
67 "{(<(text variable|function), no debug info>|short \\(\\))} \[0-9a-fx]* <middle>"
68 if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix5*" }
787f6220 69 setup_xfail "mips-sgi-irix6*"
782445c7
FF
70 gdb_test "whatis middle" \
71 "(<(text variable|function), no debug info>|short \\(\\))"
787f6220 72 setup_xfail "mips-sgi-irix6*"
782445c7
FF
73 gdb_test "ptype middle" "(short|int) \\((|<non-float parameter>|<non-float parameter>, <non-float parameter>)\\)"
74
75 gdb_test "p dataglobal" "= 3"
76 gdb_test "whatis dataglobal" \
77 "<(data variable|variable), no debug info>"
78 gdb_test "ptype dataglobal" "<(data variable|variable), no debug info>"
79
80 # The only symbol xcoff puts out for statics is for the TOC entry.
81 # Possible, but hairy, for gdb to deal. Right now it doesn't, it
82 # doesn't know the variables exist at all.
83 setup_xfail "rs6000*-*-aix*"
84 setup_xfail "powerpc*-*-aix*"
85 if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
787f6220 86 if {$gcc_compiled} then { setup_xfail "mips-sgi-irix6*" }
782445c7
FF
87 gdb_test "p datalocal" "= 4"
88 setup_xfail "rs6000*-*-aix*"
89 setup_xfail "powerpc*-*-aix*"
90 if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
787f6220 91 if {$gcc_compiled} then { setup_xfail "mips-sgi-irix6*" }
782445c7
FF
92 gdb_test "whatis datalocal" "<(data variable|variable), no debug info>"
93 setup_xfail "rs6000*-*-aix*"
94 setup_xfail "powerpc*-*-aix*"
95 if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
787f6220 96 if {$gcc_compiled} then { setup_xfail "mips-sgi-irix6*" }
782445c7
FF
97 gdb_test "ptype datalocal" "<(data variable|variable), no debug info>"
98
99 gdb_test "p bssglobal" "= 0"
100 gdb_test "whatis bssglobal" "<(data variable|variable), no debug info>"
101 gdb_test "ptype bssglobal" "<(data variable|variable), no debug info>"
102
103 setup_xfail "rs6000*-*-aix*"
104 setup_xfail "powerpc*-*-aix*"
105 if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
787f6220 106 if {$gcc_compiled} then { setup_xfail "mips-sgi-irix6*" }
782445c7
FF
107 gdb_test "p bsslocal" "= 0"
108 setup_xfail "rs6000*-*-aix*"
109 setup_xfail "powerpc*-*-aix*"
110 if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
787f6220 111 if {$gcc_compiled} then { setup_xfail "mips-sgi-irix6*" }
782445c7
FF
112 gdb_test "whatis bsslocal" "<(data variable|variable), no debug info>"
113 setup_xfail "rs6000*-*-aix*"
114 setup_xfail "powerpc*-*-aix*"
115 if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
787f6220 116 if {$gcc_compiled} then { setup_xfail "mips-sgi-irix6*" }
782445c7
FF
117 gdb_test "ptype bsslocal" "<(data variable|variable), no debug info>"
118
787f6220 119 if {$gcc_compiled} then { setup_xfail "mips-sgi-irix6*" }
50f04a5a 120 gdb_test "backtrace 10" "#0.*inner.*#1.*middle.*#2.*top.*#3.*main.*" \
782445c7
FF
121 "backtrace from inner in nodebug.exp"
122 # Or if that doesn't work, at least hope for the external symbols
123 # Commented out because if we aren't going to xfail the above test
124 # ever, why bother with a weaker test?
50f04a5a 125 #gdb_test "backtrace 10" "#0.*inner.*#1.*#2.*top.*#3.*main.*" \
5c6f833b 126 # "backtrace from inner in nodebug.exp for externals"
782445c7
FF
127
128 # This test is not as obscure as it might look. `p getenv ("TERM")'
129 # is a real-world example, at least on many systems.
787f6220 130 if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" "mips-sgi-irix6*" }
782445c7
FF
131 gdb_test {p/c array_index("abcdef",2)} " = 99 'c'"
132
133 # Now, try that we can give names of file-local symbols which happen
134 # to be unique, and have it still work
787f6220 135 if {$gcc_compiled} then { setup_xfail "mips-sgi-irix6*" }
782445c7 136 if [runto middle] then {
50f04a5a 137 gdb_test "backtrace 10" "#0.*middle.*#1.*top.*#2.*main.*" \
782445c7 138 "backtrace from middle in nodebug.exp"
29f25f6f
JK
139 }
140}
This page took 0.118275 seconds and 4 git commands to generate.