1 # Copyright (C) 1992, 1993, 1994, 1995 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 # This file was written by Fred Fish. (fnf@cygnus.com)
29 # are we on a target board
35 set binfile "coremaker"
36 set srcfile $binfile.c
38 if ![file exists $objdir/$subdir/$binfile] then {
39 perror "$objdir/$subdir/$binfile does not exist."
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.
48 # Some systems append "core" to the name of the program; others append
49 # the name of the program to "core".
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"
59 warning "can't generate a core file - core tests suppressed - check ulimit -c"
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).
78 send_user "Spawning $GDB -nw $GDBFLAGS -core=$objdir/$subdir/corefile\n"
81 # The RS/6000 gdb doesn't know how to extract the file name and
82 # terminating signal from the core file, so all these tests are
85 setup_xfail "rs6000-*-*"
86 set oldtimeout $timeout
87 set timeout [expr "$timeout + 60"]
88 eval "spawn $GDB -nw $GDBFLAGS -core=$objdir/$subdir/corefile"
90 -re "Core was generated by .*coremaker.*\r
92 $prompt $" { pass "args: -core=corefile" }
93 -re ".*$prompt $" { fail "args: -core=corefile" }
94 timeout { fail "(timeout) starting with -core" }
99 # Test that startup with both an executable file and -core argument.
100 # See previous comments above, they are still applicable.
105 send_user "Spawning $GDB -nw $GDBFLAGS $objdir/$subdir/$binfile -core=$objdir/$subdir/corefile\n"
109 setup_xfail "rs6000-*-*"
110 # This fails in p3, but not in devo.
111 spawn $GDB -nw $GDBFLAGS $objdir/$subdir/$binfile -core=$objdir/$subdir/corefile
113 -re "Core was generated by .*coremaker.*\r
115 $prompt $" { pass "args: execfile -core=corefile" }
116 -re ".*$prompt $" { fail "args: execfile -core=corefile" }
117 timeout { fail "(timeout) starting with -core" }
119 set timeout $oldtimeout
122 # Now restart normally.
126 gdb_reinitialize_dir $srcdir/$subdir
127 gdb_load $objdir/$subdir/$binfile
129 # Test basic corefile recognition via core-file command.
131 setup_xfail "rs6000-*-*"
132 send "core-file $objdir/$subdir/corefile\n"
134 -re "Core was generated by .*coremaker.*\r
136 $prompt $" { pass "core-file command" }
137 -re ".*$prompt $" { fail "core-file command" }
138 timeout { fail "(timeout) core-file command" }
141 # Somehow we better test the ability to read the registers out of the core
142 # file correctly. I don't think the other tests do this.
144 # Haven't investigated this xfail
145 setup_xfail "m68k-*-hpux*" "i*86-*-linux*"
146 gdb_test "bt" "abort.*func2.*func1.*main.*" "backtrace in corefile.exp"
148 # test reinit_frame_cache
150 gdb_load $objdir/$subdir/$binfile
152 gdb_test "up" "#\[0-9\]* *\[0-9xa-fH'\]* in .* \\(\\)" "up in corefile.exp"
154 gdb_test "core" "No core file now."