1 # Test that things still (sort of) work when compiled without -g.
10 set binfile $objdir/$subdir/nodebug
12 if ![file exists $binfile] then {
13 perror "$binfile does not exist."
16 gdb_reinitialize_dir $srcdir/$subdir
19 if [runto inner] then {
21 # Expect to find global/local symbols in each of text/data/bss.
23 # The exact format for some of this output is not necessarily
24 # ideal, particularly interpreting "p top" requires a fair bit of
25 # savvy about gdb's workings and the meaning of the "{}"
26 # construct. So the details maybe could be tweaked. But the
27 # basic purpose should be maintained, which is (a) users should be
28 # able to interact with these variables with some care (they have
29 # to know how to interpret them according to their real type,
30 # since gdb doesn't know the type), but (b) users should be able
31 # to detect that gdb does not know the type, rather than just
32 # being told they are ints or functions returning int like old
33 # versions of gdb used to do.
35 # On alpha (and presumably other ecoff systems, even stabs in ecoff)
36 # GCC puts out stProc and related symbols which cause GDB to think
37 # it knows the type. GDB probably could be fixed to do better, but
38 # for now xfail these tests.
39 setup_xfail "alpha*-*-osf*" "mips*-*-irix4*" "*-*-ultrix*"
41 "{<(text variable|function), no debug info>} \[0-9a-fx]* <top>"
42 setup_xfail "alpha*-*-osf*" "mips*-*-irix4*" "*-*-ultrix*"
43 gdb_test "whatis top" "<(text variable|function), no debug info>"
44 setup_xfail "alpha*-*-osf*" "mips*-*-irix4*" "*-*-ultrix*"
45 gdb_test "ptype top" "int \\(\\)"
47 setup_xfail "alpha*-*-osf*" "mips*-*-irix4*" "*-*-ultrix*"
49 "{<(text variable|function), no debug info>} \[0-9a-fx]* <middle>"
50 setup_xfail "alpha*-*-osf*" "mips*-*-irix4*" "*-*-ultrix*"
51 gdb_test "whatis middle" "<(text variable|function), no debug info>"
52 setup_xfail "alpha*-*-osf*" "mips*-*-irix4*" "*-*-ultrix*"
53 gdb_test "ptype middle" "int \\(\\)"
55 gdb_test "p dataglobal" "= 3"
56 setup_xfail "alpha*-*-osf*" "mips*-*-irix4*" "*-*-ultrix*"
57 gdb_test "whatis dataglobal" \
58 "<(data variable|variable), no debug info>"
59 setup_xfail "alpha*-*-osf*" "mips*-*-irix4*" "*-*-ultrix*"
60 gdb_test "ptype dataglobal" "<(data variable|variable), no debug info>"
62 # The only symbol xcoff puts out for statics is for the TOC entry.
63 # Possible, but hairy, for gdb to deal. Right now it doesn't, it
64 # doesn't know the variables exist at all.
65 setup_xfail "rs6000*-*-aix*"
66 gdb_test "p datalocal" "= 4"
67 setup_xfail "rs6000*-*-aix*"
68 setup_xfail "alpha*-*-osf*" "mips*-*-irix4*" "*-*-ultrix*"
69 gdb_test "whatis datalocal" "<(data variable|variable), no debug info>"
70 setup_xfail "rs6000*-*-aix*"
71 setup_xfail "alpha*-*-osf*" "mips*-*-irix4*" "*-*-ultrix*"
72 gdb_test "ptype datalocal" "<(data variable|variable), no debug info>"
74 gdb_test "p bssglobal" "= 0"
75 setup_xfail "alpha*-*-osf*" "mips*-*-irix4*" "*-*-ultrix*"
76 gdb_test "whatis bssglobal" "<(data variable|variable), no debug info>"
77 setup_xfail "alpha*-*-osf*" "mips*-*-irix4*" "*-*-ultrix*"
78 gdb_test "ptype bssglobal" "<(data variable|variable), no debug info>"
80 setup_xfail "rs6000*-*-aix*"
81 gdb_test "p bsslocal" "= 0"
82 setup_xfail "rs6000*-*-aix*"
83 setup_xfail "alpha*-*-osf*" "mips*-*-irix4*" "*-*-ultrix*"
84 gdb_test "whatis bsslocal" "<(data variable|variable), no debug info>"
85 setup_xfail "rs6000*-*-aix*"
86 setup_xfail "alpha*-*-osf*" "mips*-*-irix4*" "*-*-ultrix*"
87 gdb_test "ptype bsslocal" "<(data variable|variable), no debug info>"
89 gdb_test "backtrace" "#0.*inner.*#1.*middle.*#2.*top.*#3.*main"
90 # Or if that doesn't work, at least hope for the external symbols
91 gdb_test "backtrace" "#0.*inner.*#1.*#2.*top.*#3.*main"
92 # Now, try that we can give names of file-local symbols which happen
93 # to be unique, and have it still work
94 if [runto middle] then {
95 gdb_test "backtrace" "#0.*middle.*#1.*top.*#2.*main"