| # Copyright 2006 |
| # Free Software Foundation, Inc. |
| |
| # 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 |
| # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| |
| # Please email any bugs, comments, and/or additions to this file to: |
| # bug-gdb@prep.ai.mit.edu |
| |
| |
| if $tracelevel then { |
| strace $tracelevel |
| } |
| |
| |
| set timeout 10 |
| |
| set prms_id 0 |
| set bug_id 0 |
| |
| set testfile "recurse" |
| set binfile ${objdir}/${subdir}/${testfile} |
| set srcfile ${srcdir}/${subdir}/${testfile}.c |
| |
| if { [gdb_compile "${srcfile}" "${binfile}" executable debug] != "" } { |
| gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." |
| } |
| |
| # Start with a fresh gdb |
| |
| gdb_exit |
| gdb_start |
| gdb_reinitialize_dir $srcdir/$subdir |
| gdb_file_cmd "${binfile}" |
| |
| gdb_test "break recurse" "Breakpoint 1 at.*" "Set breakpoint on recurse" |
| |
| gdb_test "run" "Starting program: $binfile *\r\n\Reading symbols for shared libraries \(\[.+\]\)+ done.*Breakpoint 1, recurse.*" "continue to breakpoint in recurse()" |
| |
| gdb_test "disp/x \$pc" ".*pc =.*" "display the pc value" |
| gdb_test "disp/x \$fp" ".*fp =.*" "display the fp value" |
| gdb_test "disp/x \$sp" ".*sp =.*" "display the sp value" |
| |
| gdb_test "disass recurse" "Dump of assembler code f.*" "disassemble recruse" |
| |
| set count 0 |
| while {$count < 150 } { |
| gdb_test "stepi" ".*pc =.*" "stepi number $count" |
| gdb_test "bt" ".*a=10. at \[\^ \]*#$decimal *$hex *in main.*" "backtrace number $count" |
| incr count |
| } |
| |
| gdb_exit |
| return 0 |