1995-03-14 21:25:19 +00:00
|
|
|
# Copyright (C) 1988, 1990, 1991, 1992, 1994 Free Software Foundation, Inc.
|
1994-06-07 01:57:15 +00:00
|
|
|
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
1995-11-01 23:02:09 +00:00
|
|
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
1994-06-07 01:57:15 +00:00
|
|
|
|
|
|
|
# Please email any bugs, comments, and/or additions to this file to:
|
|
|
|
# bug-gdb@prep.ai.mit.edu
|
|
|
|
|
|
|
|
# This file was written by Rob Savoye. (rob@cygnus.com)
|
|
|
|
|
|
|
|
if $tracelevel then {
|
|
|
|
strace $tracelevel
|
|
|
|
}
|
|
|
|
|
1995-04-01 00:17:12 +00:00
|
|
|
global usestubs
|
|
|
|
|
1994-06-07 01:57:15 +00:00
|
|
|
#
|
|
|
|
# test running programs
|
|
|
|
#
|
|
|
|
set prms_id 0
|
|
|
|
set bug_id 0
|
|
|
|
|
From Rob Savoye (rob@poseidon.cygnus.com)
* Makefile.in, configure.in, gdb.base/{Makefile.in, configure.in},
gdb.c++/{Makefile.in, configure.in}, gdb.chill/{Makefile.in, configure.in},
gdb.disasm/{Makefile.in, configure.in}, gdb.stabs/{Makefile.in, configure.in},
gdb.threads/{Makefile.in, configure.in}: Major reworking for autoconfig.
* aclocal.m4, configure, gdb.base/configure, gdb.c++/configure,
gdb.disasm/configure, gdb.stabs/configure, gdb.stabs/default.mt : New files.
* config/unix-gdb.exp: Make GDB global.
* gdb.base/{a1-selftest.exp, a2-run.exp,bitfields.exp, break.exp, callfuncs.exp,
commands.exp, corefile.exp, crossload.exp, exprs.exp, funcargs.exp, interrupt.exp,
langs.exp, list.exp, mips_pro.exp, nodebug.exp, opaque.exp, printcmds.exp,
ptype.exp, recurse.exp, regs.exp, return.exp, scope.exp, setvar.exp, sigall.exp,
signals.exp, term.exp, twice.exp, watchpoint.exp, whatis.exp},
gdb.c++/{classes.exp, callfuncs.exp, inherit.exp, misc.exp, templates.exp,
virtfunc.exp}, gdb.chill/{callch.exp, chillvars.exp, misc.exp, pr-4975.exp,
pr-5016.exp, pr-5020.exp, pr-5022.exp, pr-5646.exp, pr-5984.exp, pr-6292.exp,
pr-6632.exp, pr-8134.exp, pr-8136.exp, result.exp, string.exp, tuples.exp},
gdb.disasm/{hppa.exp, sh3.exp}, gdb.stabs/weird.exp: Change continues
to returns as necessary, arrange for test to compile own testcase executable.
* lib/gdb.exp: Changes for testsuite to compile own test cases.
From Fred Fish (fnf@cygnus.com)
* gdb.c++/classes.exp (test_pointers_to_class_members): Add
clear_xfail at end of test which might not call either pass or fail.
* gdb.base/a1-selftest.exp: Add i*86-*-linuxaout xfail for
"backtrace through signal handler".
1995-11-25 19:55:29 +00:00
|
|
|
set testfile "break"
|
|
|
|
set srcfile ${srcdir}/${subdir}/${testfile}.c
|
|
|
|
set binfile ${objdir}/${subdir}/${testfile}
|
|
|
|
if { [compile "${srcfile} -g -o ${binfile}"] != "" } {
|
|
|
|
perror "Couldn't compile ${srcfile}"
|
|
|
|
return -1
|
1994-06-07 01:57:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
gdb_exit
|
|
|
|
gdb_start
|
|
|
|
gdb_reinitialize_dir $srcdir/$subdir
|
From Rob Savoye (rob@poseidon.cygnus.com)
* Makefile.in, configure.in, gdb.base/{Makefile.in, configure.in},
gdb.c++/{Makefile.in, configure.in}, gdb.chill/{Makefile.in, configure.in},
gdb.disasm/{Makefile.in, configure.in}, gdb.stabs/{Makefile.in, configure.in},
gdb.threads/{Makefile.in, configure.in}: Major reworking for autoconfig.
* aclocal.m4, configure, gdb.base/configure, gdb.c++/configure,
gdb.disasm/configure, gdb.stabs/configure, gdb.stabs/default.mt : New files.
* config/unix-gdb.exp: Make GDB global.
* gdb.base/{a1-selftest.exp, a2-run.exp,bitfields.exp, break.exp, callfuncs.exp,
commands.exp, corefile.exp, crossload.exp, exprs.exp, funcargs.exp, interrupt.exp,
langs.exp, list.exp, mips_pro.exp, nodebug.exp, opaque.exp, printcmds.exp,
ptype.exp, recurse.exp, regs.exp, return.exp, scope.exp, setvar.exp, sigall.exp,
signals.exp, term.exp, twice.exp, watchpoint.exp, whatis.exp},
gdb.c++/{classes.exp, callfuncs.exp, inherit.exp, misc.exp, templates.exp,
virtfunc.exp}, gdb.chill/{callch.exp, chillvars.exp, misc.exp, pr-4975.exp,
pr-5016.exp, pr-5020.exp, pr-5022.exp, pr-5646.exp, pr-5984.exp, pr-6292.exp,
pr-6632.exp, pr-8134.exp, pr-8136.exp, result.exp, string.exp, tuples.exp},
gdb.disasm/{hppa.exp, sh3.exp}, gdb.stabs/weird.exp: Change continues
to returns as necessary, arrange for test to compile own testcase executable.
* lib/gdb.exp: Changes for testsuite to compile own test cases.
From Fred Fish (fnf@cygnus.com)
* gdb.c++/classes.exp (test_pointers_to_class_members): Add
clear_xfail at end of test which might not call either pass or fail.
* gdb.base/a1-selftest.exp: Add i*86-*-linuxaout xfail for
"backtrace through signal handler".
1995-11-25 19:55:29 +00:00
|
|
|
gdb_load ${binfile}
|
1994-06-07 01:57:15 +00:00
|
|
|
|
1995-04-01 00:17:12 +00:00
|
|
|
if $usestubs {
|
|
|
|
send "step\n"
|
|
|
|
# if use stubs step out of the breakpoint() function.
|
|
|
|
expect {
|
|
|
|
-re "main.* at .*$prompt $" {}
|
|
|
|
timeout { fail "single step at breakpoint() (timeout)" ; return 0 }
|
|
|
|
}
|
|
|
|
}
|
1994-06-07 01:57:15 +00:00
|
|
|
#
|
|
|
|
# test simple breakpoint setting commands
|
|
|
|
#
|
|
|
|
|
1995-11-01 23:02:09 +00:00
|
|
|
# Test deleting all breakpoints when there are none installed.
|
|
|
|
# Between 4.15 and 4.16 a change made gdb stop prompting when
|
|
|
|
# there are no user breakpoints installed.
|
|
|
|
# Note that gdb-init.exp provides a "delete_breakpoints" proc
|
|
|
|
# for general use elsewhere.
|
|
|
|
|
1994-06-07 01:57:15 +00:00
|
|
|
send "delete breakpoints\n"
|
|
|
|
expect {
|
|
|
|
-re "Delete all breakpoints.*y or n. $"\
|
|
|
|
{ send "y\n"
|
|
|
|
expect {
|
1995-11-04 18:42:30 +00:00
|
|
|
-re ".*$prompt $" {
|
From Rob Savoye (rob@poseidon.cygnus.com)
* Makefile.in, configure.in, gdb.base/{Makefile.in, configure.in},
gdb.c++/{Makefile.in, configure.in}, gdb.chill/{Makefile.in, configure.in},
gdb.disasm/{Makefile.in, configure.in}, gdb.stabs/{Makefile.in, configure.in},
gdb.threads/{Makefile.in, configure.in}: Major reworking for autoconfig.
* aclocal.m4, configure, gdb.base/configure, gdb.c++/configure,
gdb.disasm/configure, gdb.stabs/configure, gdb.stabs/default.mt : New files.
* config/unix-gdb.exp: Make GDB global.
* gdb.base/{a1-selftest.exp, a2-run.exp,bitfields.exp, break.exp, callfuncs.exp,
commands.exp, corefile.exp, crossload.exp, exprs.exp, funcargs.exp, interrupt.exp,
langs.exp, list.exp, mips_pro.exp, nodebug.exp, opaque.exp, printcmds.exp,
ptype.exp, recurse.exp, regs.exp, return.exp, scope.exp, setvar.exp, sigall.exp,
signals.exp, term.exp, twice.exp, watchpoint.exp, whatis.exp},
gdb.c++/{classes.exp, callfuncs.exp, inherit.exp, misc.exp, templates.exp,
virtfunc.exp}, gdb.chill/{callch.exp, chillvars.exp, misc.exp, pr-4975.exp,
pr-5016.exp, pr-5020.exp, pr-5022.exp, pr-5646.exp, pr-5984.exp, pr-6292.exp,
pr-6632.exp, pr-8134.exp, pr-8136.exp, result.exp, string.exp, tuples.exp},
gdb.disasm/{hppa.exp, sh3.exp}, gdb.stabs/weird.exp: Change continues
to returns as necessary, arrange for test to compile own testcase executable.
* lib/gdb.exp: Changes for testsuite to compile own test cases.
From Fred Fish (fnf@cygnus.com)
* gdb.c++/classes.exp (test_pointers_to_class_members): Add
clear_xfail at end of test which might not call either pass or fail.
* gdb.base/a1-selftest.exp: Add i*86-*-linuxaout xfail for
"backtrace through signal handler".
1995-11-25 19:55:29 +00:00
|
|
|
setup_xfail "i*86-*-sysv4*" "sparc-sun-sunos4*" "alpha-dec-osf2*"
|
1995-11-04 18:42:30 +00:00
|
|
|
fail "Delete all breakpoints when none"
|
|
|
|
}
|
1995-11-01 23:02:09 +00:00
|
|
|
timeout { fail "Delete all breakpoints when none (timeout)" }
|
1994-06-07 01:57:15 +00:00
|
|
|
}
|
|
|
|
}
|
1995-11-01 23:02:09 +00:00
|
|
|
-re ".*$prompt $" { pass "Delete all breakpoints when none" }
|
|
|
|
timeout { fail "Delete all breakpoints when none" }
|
1994-06-07 01:57:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# test break at function
|
|
|
|
#
|
1995-03-14 21:25:19 +00:00
|
|
|
gdb_test "break main" \
|
|
|
|
"Breakpoint.*at.* file .*$srcfile, line.*" \
|
|
|
|
"breakpoint function"
|
1994-06-07 01:57:15 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# test break at function in file
|
|
|
|
#
|
1995-03-14 21:25:19 +00:00
|
|
|
gdb_test "break $srcfile:factorial" \
|
|
|
|
"Breakpoint.*at.* file .*$srcfile, line.*" \
|
|
|
|
"breakpoint function in file"
|
1994-06-07 01:57:15 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# test break at line number
|
|
|
|
#
|
1995-03-24 22:06:00 +00:00
|
|
|
gdb_test "break 64" \
|
|
|
|
"Breakpoint.*at.* file .*$srcfile, line 64\\." \
|
1995-03-14 21:25:19 +00:00
|
|
|
"breakpoint line number"
|
1994-06-07 01:57:15 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# test duplicate breakpoint
|
|
|
|
#
|
1995-03-24 22:06:00 +00:00
|
|
|
gdb_test "break 64" \
|
|
|
|
"Note: breakpoint \[0-9\]+ also set at pc.*Breakpoint \[0-9\]+ at.* file .*$srcfile, line 64\\." \
|
1995-03-14 21:25:19 +00:00
|
|
|
"breakpoint duplicate"
|
1994-06-07 01:57:15 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# test break at line number in file
|
|
|
|
#
|
1995-03-24 22:06:00 +00:00
|
|
|
gdb_test "break $srcfile:70" \
|
|
|
|
"Breakpoint.*at.* file .*$srcfile, line 70\\." \
|
1995-03-14 21:25:19 +00:00
|
|
|
"breakpoint line number in file"
|
1994-06-07 01:57:15 +00:00
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# check to see what breakpoints are set
|
|
|
|
#
|
1995-11-01 23:02:09 +00:00
|
|
|
if $usestubs then {
|
|
|
|
set main_line 57
|
|
|
|
} else {
|
|
|
|
set main_line 60
|
|
|
|
}
|
|
|
|
|
1995-03-14 21:25:19 +00:00
|
|
|
gdb_test "info break" \
|
|
|
|
"Num Type\[ \]+Disp Enb Address\[ \]+What.*
|
1995-11-01 23:02:09 +00:00
|
|
|
\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$main_line.*
|
1995-03-24 22:06:00 +00:00
|
|
|
\[0-9\]+\[\t \]+breakpoint keep y.* in factorial at .*$srcfile:76.*
|
|
|
|
\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:64.*
|
|
|
|
\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:64.*
|
|
|
|
\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:70" \
|
1995-03-14 21:25:19 +00:00
|
|
|
"breakpoint info"
|
1994-06-07 01:57:15 +00:00
|
|
|
|
|
|
|
|
|
|
|
# FIXME: The rest of this test doesn't work with anything that can't
|
|
|
|
# handle arguments.
|
|
|
|
if [istarget "mips-idt-*"] then {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
#
|
1995-03-24 22:06:00 +00:00
|
|
|
# run until the breakpoint at main is hit. For non-stubs-using targets.
|
1994-06-07 01:57:15 +00:00
|
|
|
#
|
1995-03-24 22:06:00 +00:00
|
|
|
if !$usestubs then {
|
|
|
|
if [istarget "*-*-vxworks*"] then {
|
1994-06-07 01:57:15 +00:00
|
|
|
send "run vxmain \"2\"\n"
|
|
|
|
set timeout 120
|
1995-03-24 22:06:00 +00:00
|
|
|
} else {
|
1995-03-16 00:06:51 +00:00
|
|
|
send "run\n"
|
1995-03-24 22:06:00 +00:00
|
|
|
}
|
|
|
|
expect {
|
1995-11-01 23:02:09 +00:00
|
|
|
-re "The program .* has been started already.*y or n. $" {
|
|
|
|
send "y\n"
|
|
|
|
exp_continue
|
|
|
|
}
|
1995-03-24 22:06:00 +00:00
|
|
|
-re "Starting program.*Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$srcfile:60.*60\[\t \]+if .argc.* \{.*$prompt $"\
|
1994-06-07 01:57:15 +00:00
|
|
|
{ pass "run until function breakpoint" }
|
|
|
|
-re ".*$prompt $" { fail "run until function breakpoint" }
|
|
|
|
timeout { fail "(timeout) run until function breakpoint" }
|
1995-03-24 22:06:00 +00:00
|
|
|
}
|
1994-06-07 01:57:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# run until the breakpoint at a line number
|
|
|
|
#
|
1995-03-24 22:06:00 +00:00
|
|
|
gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:64.*64\[\t \]+printf.*factorial.*" \
|
1995-03-16 00:06:51 +00:00
|
|
|
"run until breakpoint set at a line number"
|
1994-06-07 01:57:15 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# Run until the breakpoint set in a function in a file
|
|
|
|
#
|
1995-03-16 00:06:51 +00:00
|
|
|
for {set i 6} {$i >= 1} {incr i -1} {
|
1995-03-24 22:06:00 +00:00
|
|
|
gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, factorial \\(value=$i\\) at .*$srcfile:76.*76\[\t \]+if .value > 1. \{" \
|
1995-03-16 00:06:51 +00:00
|
|
|
"run until file:function($i) breakpoint"
|
1994-06-07 01:57:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# run until the file:function breakpoint at a line number in a file
|
|
|
|
#
|
1995-03-24 22:06:00 +00:00
|
|
|
gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:70.*70\[\t \]+return 0;" \
|
1995-03-16 00:06:51 +00:00
|
|
|
"run until file:linenum breakpoint"
|
1994-06-07 01:57:15 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# delete all breakpoints so we can start over, course this can be a test too
|
|
|
|
#
|
|
|
|
send "delete breakpoints\n"
|
|
|
|
expect {
|
|
|
|
-re "Delete all breakpoints.*y or n.*$" {
|
|
|
|
send "y\n"
|
|
|
|
expect {
|
|
|
|
-re ".*$prompt $" {
|
|
|
|
send "info breakpoints\n"
|
|
|
|
expect {
|
|
|
|
-re "No breakpoints or watchpoints..*$prompt $" {
|
|
|
|
pass "Deleted all breakpoints"
|
|
|
|
}
|
|
|
|
-re ".*$prompt $" { fail "Deleted all breakpoints" }
|
|
|
|
timeout { fail "Deleted all breakpoints" }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
timeout { fail "Deleted all breakpoints" }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
-re ".*$prompt $" { fail "Deleted all breakpoints" }
|
|
|
|
timeout { fail "Deleted all breakpoints" }
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# test temporary breakpoint at function
|
|
|
|
#
|
|
|
|
|
1995-03-25 00:41:54 +00:00
|
|
|
gdb_test "tbreak main" "Breakpoint.*at.* file .*$srcfile, line.*" "Temporary breakpoint function"
|
1994-06-07 01:57:15 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# test break at function in file
|
|
|
|
#
|
|
|
|
|
1995-03-25 00:41:54 +00:00
|
|
|
gdb_test "tbreak $srcfile:factorial" "Breakpoint.*at.* file .*$srcfile, line.*" \
|
|
|
|
"Temporary breakpoint function in file"
|
1994-06-07 01:57:15 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# test break at line number
|
|
|
|
#
|
1995-03-24 22:06:00 +00:00
|
|
|
send "tbreak 64\n"
|
1994-06-07 01:57:15 +00:00
|
|
|
expect {
|
1995-03-24 22:06:00 +00:00
|
|
|
-re "Breakpoint.*at.* file .*$srcfile, line 64.*$prompt $" { pass "Temporary breakpoint line number" }
|
1994-06-07 01:57:15 +00:00
|
|
|
-re ".*$prompt $" { pass "Temporary breakpoint line number" }
|
|
|
|
timeout { fail "(timeout) breakpoint line number" }
|
|
|
|
}
|
|
|
|
|
1995-03-25 00:41:54 +00:00
|
|
|
gdb_test "tbreak 60" "Breakpoint.*at.* file .*$srcfile, line 60.*" "Temporary breakpoint line number"
|
1994-06-07 01:57:15 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# test break at line number in file
|
|
|
|
#
|
1995-03-24 22:06:00 +00:00
|
|
|
send "tbreak $srcfile:70\n"
|
1994-06-07 01:57:15 +00:00
|
|
|
expect {
|
1995-03-24 22:06:00 +00:00
|
|
|
-re "Breakpoint.*at.* file .*$srcfile, line 70.*$prompt $" { pass "Temporary breakpoint line number in file" }
|
1994-06-07 01:57:15 +00:00
|
|
|
-re ".*$prompt $" { pass "Temporary breakpoint line number in file" }
|
|
|
|
timeout { fail "(timeout) breakpoint line number in file" }
|
|
|
|
}
|
|
|
|
|
1995-03-25 00:41:54 +00:00
|
|
|
gdb_test "tbreak $srcfile:66" "Breakpoint.*at.* file .*$srcfile, line 66.*" "Temporary breakpoint line number in file"
|
1994-06-07 01:57:15 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# check to see what breakpoints are set (temporary this time)
|
|
|
|
#
|
|
|
|
send "info break\n"
|
|
|
|
expect {
|
|
|
|
-re "Num Type.*Disp Enb Address.*What.*
|
1995-11-01 23:02:09 +00:00
|
|
|
\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:$main_line.*
|
1995-03-24 22:06:00 +00:00
|
|
|
\[0-9\]+\[\t \]+breakpoint del.*y.*in factorial at .*$srcfile:76.*
|
|
|
|
\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:64.*
|
|
|
|
\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:70.*$prompt $" {
|
1994-06-07 01:57:15 +00:00
|
|
|
pass "Temporary breakpoint info"
|
|
|
|
}
|
|
|
|
-re ".*$prompt $" { fail "Temporary breakpoint info" }
|
|
|
|
timeout { fail "(timeout) Temporary breakpoint info" }
|
|
|
|
}
|
|
|
|
|
|
|
|
proc test_clear_command {} {
|
1995-03-14 21:25:19 +00:00
|
|
|
gdb_test "break main" "Breakpoint.*at.*"
|
|
|
|
gdb_test "break main" "Breakpoint.*at.*"
|
1994-06-07 01:57:15 +00:00
|
|
|
|
|
|
|
# We don't test that it deletes the correct breakpoints. We do at
|
|
|
|
# least test that it deletes more than one breakpoint.
|
1995-03-14 21:25:19 +00:00
|
|
|
gdb_test "clear main" {Deleted breakpoints [0-9]+ [0-9]+.*}
|
1994-06-07 01:57:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# Test "next" over recursive function call.
|
|
|
|
#
|
|
|
|
|
|
|
|
proc test_next_with_recursion {} {
|
|
|
|
global prompt
|
|
|
|
global decimal
|
|
|
|
|
|
|
|
# FIXME: should be using runto
|
|
|
|
send "kill\n"
|
|
|
|
expect {
|
|
|
|
-re ".*Kill the program being debugged.*y or n. $" {
|
|
|
|
send "y\n"
|
|
|
|
exp_continue
|
|
|
|
}
|
|
|
|
-re ".*$prompt $" {}
|
|
|
|
timeout { fail "killing inferior" ; return }
|
|
|
|
}
|
|
|
|
|
|
|
|
delete_breakpoints
|
|
|
|
|
1995-03-25 00:41:54 +00:00
|
|
|
gdb_test "break factorial" "Breakpoint $decimal at .*" "break at factorial"
|
1994-06-07 01:57:15 +00:00
|
|
|
|
|
|
|
# Run until we call factorial with 6
|
|
|
|
|
1995-03-22 04:52:25 +00:00
|
|
|
if [istarget "*-*-vxworks*"] then {
|
1994-06-07 01:57:15 +00:00
|
|
|
send "run vxmain \"6\"\n"
|
|
|
|
} else {
|
1995-04-01 00:17:12 +00:00
|
|
|
gdb_run_cmd
|
1994-06-07 01:57:15 +00:00
|
|
|
}
|
|
|
|
expect {
|
1995-04-01 00:17:12 +00:00
|
|
|
-re "Break.* factorial .value=6. .*$prompt $" {}
|
1994-06-07 01:57:15 +00:00
|
|
|
timeout { fail "run to factorial(6)" ; return }
|
|
|
|
}
|
|
|
|
|
|
|
|
# Continue until we call factorial recursively with 5.
|
|
|
|
|
|
|
|
send "continue\n"
|
|
|
|
expect {
|
|
|
|
-re "Continuing.*Break.* factorial .value=5. .*$prompt $" {}
|
|
|
|
timeout { fail "continue to factorial(5)" ; return }
|
|
|
|
}
|
|
|
|
|
|
|
|
# Do a backtrace just to confirm how many levels deep we are.
|
|
|
|
|
|
|
|
set result [gdb_test "backtrace" \
|
1995-03-14 21:25:19 +00:00
|
|
|
"#0\[ \t\]+ factorial .value=5..*" \
|
1994-06-07 01:57:15 +00:00
|
|
|
"backtrace from factorial(5)"]
|
|
|
|
if $result!=0 then { return }
|
|
|
|
|
|
|
|
# Now a "next" should position us at the recursive call, which
|
|
|
|
# we will be performing with 4.
|
|
|
|
|
|
|
|
send "next\n"
|
|
|
|
expect {
|
|
|
|
-re ".* factorial .value - 1.;.*$prompt $" {}
|
|
|
|
timeout { fail "next to recursive call (timeout)" ; return }
|
|
|
|
}
|
|
|
|
|
|
|
|
# Disable the breakpoint at the entry to factorial by deleting them all.
|
|
|
|
# The "next" should run until we return to the next line from this
|
|
|
|
# recursive call to factorial with 4.
|
|
|
|
# Buggy versions of gdb will stop instead at the innermost frame on
|
|
|
|
# the line where we are trying to "next" to.
|
|
|
|
|
|
|
|
delete_breakpoints
|
|
|
|
|
1995-03-25 06:01:20 +00:00
|
|
|
gdb_test next "\[0-9\]*\[\t \]+return \\(value\\);.*" \
|
|
|
|
"next over recursive call"
|
1994-06-07 01:57:15 +00:00
|
|
|
|
|
|
|
# OK, we should be back in the same stack frame we started from.
|
|
|
|
# Do a backtrace just to confirm.
|
|
|
|
|
|
|
|
set result [gdb_test "backtrace" \
|
1995-03-14 21:25:19 +00:00
|
|
|
"#0\[ \t\]+ factorial .value=120.*\r\n#1\[ \t\]+ \[0-9a-fx\]+ in factorial .value=6..*" \
|
1994-06-07 01:57:15 +00:00
|
|
|
"backtrace from factorial(5)"]
|
|
|
|
if $result!=0 then { return }
|
|
|
|
|
|
|
|
# Continue until we exit. Should not stop again.
|
1995-11-01 23:02:09 +00:00
|
|
|
# Don't bother to check the output of the program, that may be
|
|
|
|
# extremely tough for some remote systems.
|
|
|
|
gdb_test "continue"\
|
|
|
|
"Continuing.\[\r\n0-9\]+Program exited normally\\."\
|
1994-06-07 01:57:15 +00:00
|
|
|
"continue until exit in recursive next test"
|
|
|
|
}
|
|
|
|
|
|
|
|
test_clear_command
|
|
|
|
test_next_with_recursion
|
|
|
|
|
|
|
|
# Reset the default arguments for VxWorks
|
1995-03-22 04:52:25 +00:00
|
|
|
if [istarget "*-*-vxworks*"] then {
|
1994-06-07 01:57:15 +00:00
|
|
|
set timeout 10
|
|
|
|
send "set args main\n"
|
|
|
|
expect -re ".*$prompt $" {}
|
|
|
|
}
|