]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.base/nodebug.exp
Major revision to testsuites for cross-testing and DOS testing support.
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / nodebug.exp
1 # Test that things still (sort of) work when compiled without -g.
2
3 if $tracelevel then {
4 strace $tracelevel
5 }
6
7 set prms_id 0
8 set bug_id 0
9
10 set testfile nodebug
11 set srcfile ${testfile}.c
12 set binfile ${objdir}/${subdir}/${testfile}
13 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable ""] != "" } {
14 perror "Couldn't compile ${srcfile}"
15 return -1
16 }
17
18 # Create and source the file that provides information about the compiler
19 # used to compile the test case.
20 if [get_compiler_info ${binfile}] {
21 return -1;
22 }
23
24 source ${binfile}.ci
25
26 gdb_exit
27 gdb_start
28 gdb_reinitialize_dir $srcdir/$subdir
29 gdb_load $binfile
30
31 if [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.
52 # Irix6 gcc omits no debug info at all for static functions and
53 # variables, so all tests involving statics fail.
54
55 if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix5*" "mips-sgi-irix6*" }
56 gdb_test "p top" \
57 "{(<(text variable|function), no debug info>|short \\(\\))} \[0-9a-fx]* <top>"
58 if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix5*" "mips-sgi-irix6*" }
59 gdb_test "whatis top" \
60 "(<(text variable|function), no debug info>|short \\(\\))"
61 if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix6*" }
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*" }
65 setup_xfail "mips-sgi-irix6*"
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*" }
69 setup_xfail "mips-sgi-irix6*"
70 gdb_test "whatis middle" \
71 "(<(text variable|function), no debug info>|short \\(\\))"
72 setup_xfail "mips-sgi-irix6*"
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*" }
86 if {$gcc_compiled} then { setup_xfail "mips-sgi-irix6*" }
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*" }
91 if {$gcc_compiled} then { setup_xfail "mips-sgi-irix6*" }
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*" }
96 if {$gcc_compiled} then { setup_xfail "mips-sgi-irix6*" }
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*" }
106 if {$gcc_compiled} then { setup_xfail "mips-sgi-irix6*" }
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*" }
111 if {$gcc_compiled} then { setup_xfail "mips-sgi-irix6*" }
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*" }
116 if {$gcc_compiled} then { setup_xfail "mips-sgi-irix6*" }
117 gdb_test "ptype bsslocal" "<(data variable|variable), no debug info>"
118
119 if {$gcc_compiled} then { setup_xfail "mips-sgi-irix6*" }
120 gdb_test "backtrace 10" "#0.*inner.*#1.*middle.*#2.*top.*#3.*main.*" \
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?
125 #gdb_test "backtrace 10" "#0.*inner.*#1.*#2.*top.*#3.*main.*" \
126 # "backtrace from inner in nodebug.exp for externals"
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.
130 if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" "mips-sgi-irix6*" }
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
135 if {$gcc_compiled} then { setup_xfail "mips-sgi-irix6*" }
136 if [runto middle] then {
137 gdb_test "backtrace 10" "#0.*middle.*#1.*top.*#2.*main.*" \
138 "backtrace from middle in nodebug.exp"
139 }
140 }