OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gdb-7.1/] [gdb/] [testsuite/] [gdb.base/] [finish.exp] - Blame information for rev 842

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 227 jeremybenn
# Copyright 2000, 2004, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
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 3 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, see .
15
 
16
# This file was written by Michael Snyder (msnyder@redhat.com)
17
 
18
if $tracelevel then {
19
        strace $tracelevel
20
}
21
 
22
set prms_id 0
23
set bug_id 0
24
 
25
# re-use the program from the "return2" test.
26
if { [prepare_for_testing finish.exp finish return2.c] } {
27
    return -1
28
}
29
 
30
proc finish_1 { type } {
31
    global gdb_prompt
32
 
33
    gdb_test "break ${type}_func" "Breakpoint \[0123456789\].*" \
34
            "set break on ${type}_func"
35
    gdb_test "continue" "Breakpoint.* ${type}_func.*" \
36
            "continue to ${type}_func"
37
    send_gdb "finish\n"
38
    gdb_expect {
39
        -re ".*Value returned is .* = 49 '1'\r\n$gdb_prompt $" {
40
            if { $type == "char" } {
41
                pass "finish from char_func"
42
            } else {
43
                fail "finish from ${type}_func"
44
            }
45
        }
46
        -re ".*Value returned is .* = \[0123456789\]* '1'\r\n$gdb_prompt $" {
47
            if { $type == "char" } {
48
                pass "finish from char_func (non-ASCII char set?)"
49
            } else {
50
                fail "finish from ${type}_func"
51
            }
52
        }
53
        -re ".*Value returned is .* = 1\r\n$gdb_prompt $" {
54
            pass "finish from ${type}_func"
55
        }
56
        -re ".*$gdb_prompt $" {
57
            fail "finish from ${type}_func"
58
        }
59
        timeout {
60
            fail "finish from ${type}_func (timeout)"
61
        }
62
    }
63
}
64
 
65
proc finish_void { } {
66
    global gdb_prompt
67
 
68
    gdb_test "break void_func" "Breakpoint \[0123456789\].*" \
69
            "set break on void_func"
70
    gdb_test "continue" "Breakpoint.* void_func.*" \
71
            "continue to void_func"
72
    send_gdb "finish\n"
73
    # Some architectures will have one or more instructions after the
74
    # call instruction which still is part of the call sequence, so we
75
    # must be prepared for a "finish" to show us the void_func call
76
    # again as well as the statement after.
77
    gdb_expect {
78
        -re ".*void_checkpoint.*$gdb_prompt $" {
79
            pass "finish from void_func"
80
        }
81
        -re "0x\[0-9a-fA-F\]+ in main.*call to void_func.*$gdb_prompt $" {
82
            pass "finish from void_func"
83
        }
84
        -re ".*$gdb_prompt $" {
85
            fail "finish from void_func"
86
        }
87
        timeout {
88
            fail "finish from void_func (timeout)"
89
        }
90
    }
91
}
92
 
93
# A function that tests that the given ABBREV is a working abbreviation
94
# of the "finish" command.
95
 
96
proc finish_abbreviation { abbrev } {
97
 
98
    if { ! [ runto "int_func" ] } then {
99
        fail "running to int_func"
100
        return -1
101
    }
102
 
103
    gdb_test "$abbrev" \
104
             "Value returned is .* = 1" \
105
             "Testing the \"$abbrev\" abbreviation for \"finish\""
106
}
107
 
108
proc finish_tests { } {
109
    global gdb_prompt
110
 
111
    if { ! [ runto_main ] } then {
112
        untested finish.exp
113
        return -1
114
    }
115
 
116
    finish_void
117
    finish_1 "char"
118
    finish_1 "short"
119
    finish_1 "int"
120
    finish_1 "long"
121
    finish_1 "long_long"
122
    finish_1 "float"
123
    finish_1 "double"
124
    finish_abbreviation "fin"
125
}
126
 
127
set prev_timeout $timeout
128
set timeout 30
129
finish_tests
130
set timeout $prev_timeout

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.