Automatic date update in version.in
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / finish.exp
CommitLineData
618f726f 1# Copyright 2000-2016 Free Software Foundation, Inc.
efb66345
MS
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
e22f8b7c 5# the Free Software Foundation; either version 3 of the License, or
efb66345 6# (at your option) any later version.
e22f8b7c 7#
efb66345
MS
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.
e22f8b7c 12#
efb66345 13# You should have received a copy of the GNU General Public License
e22f8b7c 14# along with this program. If not, see <http://www.gnu.org/licenses/>.
efb66345 15
efb66345
MS
16# This file was written by Michael Snyder (msnyder@redhat.com)
17
efb66345
MS
18
19# re-use the program from the "return2" test.
aa81e255
JK
20if { [prepare_for_testing finish.exp finish return2.c] } {
21 return -1
efb66345
MS
22}
23
24proc finish_1 { type } {
25 global gdb_prompt
26
27 gdb_test "break ${type}_func" "Breakpoint \[0123456789\].*" \
28 "set break on ${type}_func"
29 gdb_test "continue" "Breakpoint.* ${type}_func.*" \
30 "continue to ${type}_func"
a76e022a 31 gdb_test_multiple "finish" "finish from ${type}_func" {
315f8b0e 32 -re ".*Value returned is .* = 49 '1'\r\n$gdb_prompt $" {
efb66345
MS
33 if { $type == "char" } {
34 pass "finish from char_func"
35 } else {
315f8b0e
MS
36 fail "finish from ${type}_func"
37 }
38 }
39 -re ".*Value returned is .* = \[0123456789\]* '1'\r\n$gdb_prompt $" {
40 if { $type == "char" } {
41 pass "finish from char_func (non-ASCII char set?)"
42 } else {
43 fail "finish from ${type}_func"
efb66345
MS
44 }
45 }
46 -re ".*Value returned is .* = 1\r\n$gdb_prompt $" {
47 pass "finish from ${type}_func"
48 }
efb66345
MS
49 }
50}
51
52proc finish_void { } {
53 global gdb_prompt
54
55 gdb_test "break void_func" "Breakpoint \[0123456789\].*" \
56 "set break on void_func"
57 gdb_test "continue" "Breakpoint.* void_func.*" \
58 "continue to void_func"
6b0b0a9e
KB
59 # Some architectures will have one or more instructions after the
60 # call instruction which still is part of the call sequence, so we
61 # must be prepared for a "finish" to show us the void_func call
62 # again as well as the statement after.
a76e022a 63 gdb_test_multiple "finish" "finish from void_func" {
efb66345
MS
64 -re ".*void_checkpoint.*$gdb_prompt $" {
65 pass "finish from void_func"
66 }
f6dc23a9 67 -re "0x\[0-9a-fA-F\]+ in main.*call to void_func.*$gdb_prompt $" {
6b0b0a9e
KB
68 pass "finish from void_func"
69 }
efb66345
MS
70 }
71}
72
5943254b
JB
73# A function that tests that the given ABBREV is a working abbreviation
74# of the "finish" command.
75
76proc finish_abbreviation { abbrev } {
77
78 if { ! [ runto "int_func" ] } then {
79 fail "running to int_func"
80 return -1
81 }
82
83 gdb_test "$abbrev" \
84 "Value returned is .* = 1" \
85 "Testing the \"$abbrev\" abbreviation for \"finish\""
86}
87
efb66345
MS
88proc finish_tests { } {
89 global gdb_prompt
90
3ad13771 91 if { ! [ runto_main ] } then {
b60f0898
JB
92 untested finish.exp
93 return -1
efb66345
MS
94 }
95
96 finish_void
97 finish_1 "char"
98 finish_1 "short"
99 finish_1 "int"
100 finish_1 "long"
101 finish_1 "long_long"
d426f7b4
MS
102 if ![target_info exists gdb,skip_float_tests] {
103 finish_1 "float"
104 finish_1 "double"
105 }
5943254b 106 finish_abbreviation "fin"
efb66345
MS
107}
108
97f2ed50 109set prev_timeout $timeout
efb66345
MS
110set timeout 30
111finish_tests
97f2ed50 112set timeout $prev_timeout
This page took 1.601098 seconds and 4 git commands to generate.