1 # Copyright 2000, 2004, 2007, 2008 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 3 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, see <http://www.gnu.org/licenses/>.
16 # Please email any bugs, comments, and/or additions to this file to:
28 # re-use the program from the "return2" test.
29 set testfile "return2"
30 set srcfile ${testfile}.c
31 set binfile ${objdir}/${subdir}/${testfile}
32 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
37 proc finish_1 { type } {
40 gdb_test "break ${type}_func" "Breakpoint \[0123456789\].*" \
41 "set break on ${type}_func"
42 gdb_test "continue" "Breakpoint.* ${type}_func.*" \
43 "continue to ${type}_func"
46 -re ".*Value returned is .* = 49 '1'\r\n$gdb_prompt $" {
47 if { $type == "char" } {
48 pass "finish from char_func"
50 fail "finish from ${type}_func"
53 -re ".*Value returned is .* = \[0123456789\]* '1'\r\n$gdb_prompt $" {
54 if { $type == "char" } {
55 pass "finish from char_func (non-ASCII char set?)"
57 fail "finish from ${type}_func"
60 -re ".*Value returned is .* = 1\r\n$gdb_prompt $" {
61 pass "finish from ${type}_func"
63 -re ".*$gdb_prompt $" {
64 fail "finish from ${type}_func"
67 fail "finish from ${type}_func (timeout)"
72 proc finish_void { } {
75 gdb_test "break void_func" "Breakpoint \[0123456789\].*" \
76 "set break on void_func"
77 gdb_test "continue" "Breakpoint.* void_func.*" \
78 "continue to void_func"
80 # Some architectures will have one or more instructions after the
81 # call instruction which still is part of the call sequence, so we
82 # must be prepared for a "finish" to show us the void_func call
83 # again as well as the statement after.
85 -re ".*void_checkpoint.*$gdb_prompt $" {
86 pass "finish from void_func"
88 -re "0x\[0-9a-fA-F\]+ in main.*call to void_func.*$gdb_prompt $" {
89 pass "finish from void_func"
91 -re ".*$gdb_prompt $" {
92 fail "finish from void_func"
95 fail "finish from void_func (timeout)"
100 proc finish_tests { } {
103 if { ! [ runto_main ] } then {
118 # Start with a fresh gdb.
122 gdb_reinitialize_dir $srcdir/$subdir