]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.base/corefile.exp
* gdb.base/callfuncs.exp: Add xfails for the powerpc.
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / corefile.exp
1 # Copyright (C) 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
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
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
7 #
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.
12 #
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. */
16
17 # Please email any bugs, comments, and/or additions to this file to:
18 # bug-gdb@prep.ai.mit.edu
19
20 # This file was written by Fred Fish. (fnf@cygnus.com)
21
22 if $tracelevel then {
23 strace $tracelevel
24 }
25
26 set prms_id 0
27 set bug_id 0
28
29 # are we on a target board
30 if ![isnative] then {
31 return
32 }
33
34
35 set binfile "coremaker"
36 set srcfile $binfile.c
37
38 if ![file exists $objdir/$subdir/$binfile] then {
39 perror "$objdir/$subdir/$binfile does not exist."
40 return 0
41 }
42
43 if ![file exists $objdir/$subdir/corefile] then {
44 # Create a core file named "corefile" rather than just "core", to
45 # avoid problems with sys admin types that like to regularly prune all
46 # files named "core" from the system.
47 #
48 # Some systems append "core" to the name of the program; others append
49 # the name of the program to "core".
50
51 catch "system \"cd $objdir/$subdir; ./$binfile\""
52 if [file exists $objdir/$subdir/core] then {
53 catch "exec mv $objdir/$subdir/core $objdir/$subdir/corefile"
54 } elseif [file exists $objdir/$subdir/core.$binfile] {
55 catch "exec mv $objdir/$subdir/core.$binfile $objdir/$subdir/corefile"
56 } elseif [file exists $objdir/$subdir/$binfile.core] {
57 catch "exec mv $objdir/$subdir/$binfile.core $objdir/$subdir/corefile"
58 } else {
59 warning "can't generate a core file - core tests suppressed - check ulimit -c"
60 return 0
61 }
62 }
63
64 #
65 # Test that we can simply startup with a "-core=corefile" command line arg
66 # and recognize that the core file is a valid, usable core file.
67 # To do this, we must shutdown the currently running gdb and restart
68 # with the -core args. We can't use gdb_start because it looks for
69 # the first gdb prompt, and the message we are looking for occurs
70 # before the first prompt. Also, we can't include GDBFLAGS because
71 # if it is empty, this confuses gdb with an empty argument that it
72 # grumbles about (said grumbling currently being ignored in gdb_start).
73 # **FIXME**
74 #
75
76 gdb_exit
77 if $verbose>1 then {
78 send_user "Spawning $GDB -nw $GDBFLAGS -core=$objdir/$subdir/corefile\n"
79 }
80
81 # The RS/6000 and powerpc gdb doesn't know how to extract the file name and
82 # terminating signal from the core file, so all these tests are
83 # expected to fail.
84
85 setup_xfail "rs6000-*-*"
86 setup_xfail "powerpc-*-*"
87 set oldtimeout $timeout
88 set timeout [expr "$timeout + 60"]
89 eval "spawn $GDB -nw $GDBFLAGS -core=$objdir/$subdir/corefile"
90 expect {
91 -re "Core was generated by .*coremaker.*\r
92 \#0 .*\(\).*\r
93 $prompt $" { pass "args: -core=corefile" }
94 -re ".*$prompt $" { fail "args: -core=corefile" }
95 timeout { fail "(timeout) starting with -core" }
96 }
97
98
99 #
100 # Test that startup with both an executable file and -core argument.
101 # See previous comments above, they are still applicable.
102 #
103
104 gdb_exit
105 if $verbose>1 then {
106 send_user "Spawning $GDB -nw $GDBFLAGS $objdir/$subdir/$binfile -core=$objdir/$subdir/corefile\n"
107 }
108
109
110 setup_xfail "rs6000-*-*"
111 setup_xfail "powerpc-*-*"
112 # This fails in p3, but not in devo.
113 spawn $GDB -nw $GDBFLAGS $objdir/$subdir/$binfile -core=$objdir/$subdir/corefile
114 expect {
115 -re "Core was generated by .*coremaker.*\r
116 \#0 .*\(\).*\r
117 $prompt $" { pass "args: execfile -core=corefile" }
118 -re ".*$prompt $" { fail "args: execfile -core=corefile" }
119 timeout { fail "(timeout) starting with -core" }
120 }
121 set timeout $oldtimeout
122
123
124 # Now restart normally.
125
126 gdb_exit
127 gdb_start
128 gdb_reinitialize_dir $srcdir/$subdir
129 gdb_load $objdir/$subdir/$binfile
130
131 # Test basic corefile recognition via core-file command.
132
133 setup_xfail "rs6000-*-*"
134 setup_xfail "powerpc-*-*"
135 send "core-file $objdir/$subdir/corefile\n"
136 expect {
137 -re "Core was generated by .*coremaker.*\r
138 \#0 .*\(\).*\r
139 $prompt $" { pass "core-file command" }
140 -re ".*$prompt $" { fail "core-file command" }
141 timeout { fail "(timeout) core-file command" }
142 }
143
144 # Somehow we better test the ability to read the registers out of the core
145 # file correctly. I don't think the other tests do this.
146
147 # Haven't investigated this xfail
148 setup_xfail "m68k-*-hpux*" "i*86-*-linux*" "i*86-*-sysv4*"
149 gdb_test "bt" "abort.*func2.*func1.*main.*" "backtrace in corefile.exp"
150
151 # test reinit_frame_cache
152
153 gdb_load $objdir/$subdir/$binfile
154 setup_xfail "*-*-*"
155 gdb_test "up" "#\[0-9\]* *\[0-9xa-fH'\]* in .* \\(\\)" "up in corefile.exp"
156
157 gdb_test "core" "No core file now."