* gdb.base/help.exp: Replace most of docstrings for "info signals"
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / corefile.exp
CommitLineData
26e4dcae 1# Copyright (C) 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
8f2d75fc
C
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., 675 Mass Ave, Cambridge, MA 02139, 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
22if $tracelevel then {
23 strace $tracelevel
24}
25
26set prms_id 0
27set bug_id 0
28
29# are we on a target board
30if ![isnative] then {
31 warning "corefile test case can't run on a target system"
32 return
33}
34
35
36set binfile "coremaker"
37set srcfile $binfile.c
38
39if ![file exists $objdir/$subdir/$binfile] then {
40 perror "$objdir/$subdir/$binfile does not exist."
41 return 0
42}
43
44if ![file exists $objdir/$subdir/corefile] then {
45 # Create a core file named "corefile" rather than just "core", to
46 # avoid problems with sys admin types that like to regularly prune all
47 # files named "core" from the system.
48 #
49 # Some systems append "core" to the name of the program; others append
50 # the name of the program to "core".
51
52 catch "system \"cd $objdir/$subdir; ./$binfile\""
53 if [file exists $objdir/$subdir/core] then {
54 catch "exec mv $objdir/$subdir/core $objdir/$subdir/corefile"
62433a30 55 } elseif [file exists $objdir/$subdir/core.$binfile] {
8f2d75fc 56 catch "exec mv $objdir/$subdir/core.$binfile $objdir/$subdir/corefile"
62433a30 57 } elseif [file exists $objdir/$subdir/$binfile.core] {
8f2d75fc
C
58 catch "exec mv $objdir/$subdir/$binfile.core $objdir/$subdir/corefile"
59 }
60}
61
62#
63# Test that we can simply startup with a "-core=corefile" command line arg
64# and recognize that the core file is a valid, usable core file.
65# To do this, we must shutdown the currently running gdb and restart
66# with the -core args. We can't use gdb_start because it looks for
67# the first gdb prompt, and the message we are looking for occurs
68# before the first prompt. Also, we can't include GDBFLAGS because
69# if it is empty, this confuses gdb with an empty argument that it
70# grumbles about (said grumbling currently being ignored in gdb_start).
71# **FIXME**
72#
73
74gdb_exit
75if $verbose>1 then {
26e4dcae 76 send_user "Spawning $GDB -nw $GDBFLAGS -core=$objdir/$subdir/corefile\n"
8f2d75fc
C
77}
78
79# The RS/6000 gdb doesn't know how to extract the file name and
80# terminating signal from the core file, so all these tests are
81# expected to fail.
82
83setup_xfail "rs6000-*-*"
84set oldtimeout $timeout
85set timeout [expr "$timeout + 60"]
26e4dcae 86eval "spawn $GDB -nw $GDBFLAGS -core=$objdir/$subdir/corefile"
8f2d75fc
C
87expect {
88 -re "Core was generated by .*coremaker.*\r
89\#0 .*\(\).*\r
90$prompt $" { pass "args: -core=corefile" }
91 -re ".*$prompt $" { fail "args: -core=corefile" }
92 timeout { fail "(timeout) starting with -core" }
93}
94
95
96#
97# Test that startup with both an executable file and -core argument.
98# See previous comments above, they are still applicable.
99#
100
101gdb_exit
102if $verbose>1 then {
26e4dcae 103 send_user "Spawning $GDB -nw $GDBFLAGS $objdir/$subdir/$binfile -core=$objdir/$subdir/corefile\n"
8f2d75fc
C
104}
105
106
107setup_xfail "rs6000-*-*"
108# This fails in p3, but not in devo.
26e4dcae 109spawn $GDB -nw $GDBFLAGS $objdir/$subdir/$binfile -core=$objdir/$subdir/corefile
8f2d75fc
C
110expect {
111 -re "Core was generated by .*coremaker.*\r
112\#0 .*\(\).*\r
113$prompt $" { pass "args: execfile -core=corefile" }
114 -re ".*$prompt $" { fail "args: execfile -core=corefile" }
115 timeout { fail "(timeout) starting with -core" }
116}
117set timeout $oldtimeout
118
119
120# Now restart normally.
121
122gdb_exit
123gdb_start
124gdb_reinitialize_dir $srcdir/$subdir
125gdb_load $objdir/$subdir/$binfile
126
127# Test basic corefile recognition via core-file command.
128
129setup_xfail "rs6000-*-*"
130send "core-file $objdir/$subdir/corefile\n"
131expect {
132 -re "Core was generated by .*coremaker.*\r
133\#0 .*\(\).*\r
134$prompt $" { pass "core-file command" }
135 -re ".*$prompt $" { fail "core-file command" }
136 timeout { fail "(timeout) core-file command" }
137}
138
62433a30
JK
139# test reinit_frame_cache
140
141gdb_load $objdir/$subdir/$binfile
142setup_xfail "*-*-*"
143gdb_test "up" "#\[0-9\]* *\[0-9xa-fH'\]* in .* \\(\\)"
144
8f2d75fc 145gdb_test "core" "No core file now."
This page took 0.047726 seconds and 4 git commands to generate.