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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-7.2/] [gdb/] [testsuite/] [gdb.base/] [finish.exp] - Blame information for rev 394

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 330 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
 
23
# re-use the program from the "return2" test.
24
if { [prepare_for_testing finish.exp finish return2.c] } {
25
    return -1
26
}
27
 
28
proc finish_1 { type } {
29
    global gdb_prompt
30
 
31
    gdb_test "break ${type}_func" "Breakpoint \[0123456789\].*" \
32
            "set break on ${type}_func"
33
    gdb_test "continue" "Breakpoint.* ${type}_func.*" \
34
            "continue to ${type}_func"
35
    gdb_test_multiple "finish" "finish from ${type}_func" {
36
        -re ".*Value returned is .* = 49 '1'\r\n$gdb_prompt $" {
37
            if { $type == "char" } {
38
                pass "finish from char_func"
39
            } else {
40
                fail "finish from ${type}_func"
41
            }
42
        }
43
        -re ".*Value returned is .* = \[0123456789\]* '1'\r\n$gdb_prompt $" {
44
            if { $type == "char" } {
45
                pass "finish from char_func (non-ASCII char set?)"
46
            } else {
47
                fail "finish from ${type}_func"
48
            }
49
        }
50
        -re ".*Value returned is .* = 1\r\n$gdb_prompt $" {
51
            pass "finish from ${type}_func"
52
        }
53
    }
54
}
55
 
56
proc finish_void { } {
57
    global gdb_prompt
58
 
59
    gdb_test "break void_func" "Breakpoint \[0123456789\].*" \
60
            "set break on void_func"
61
    gdb_test "continue" "Breakpoint.* void_func.*" \
62
            "continue to void_func"
63
    # Some architectures will have one or more instructions after the
64
    # call instruction which still is part of the call sequence, so we
65
    # must be prepared for a "finish" to show us the void_func call
66
    # again as well as the statement after.
67
    gdb_test_multiple "finish" "finish from void_func" {
68
        -re ".*void_checkpoint.*$gdb_prompt $" {
69
            pass "finish from void_func"
70
        }
71
        -re "0x\[0-9a-fA-F\]+ in main.*call to void_func.*$gdb_prompt $" {
72
            pass "finish from void_func"
73
        }
74
    }
75
}
76
 
77
# A function that tests that the given ABBREV is a working abbreviation
78
# of the "finish" command.
79
 
80
proc finish_abbreviation { abbrev } {
81
 
82
    if { ! [ runto "int_func" ] } then {
83
        fail "running to int_func"
84
        return -1
85
    }
86
 
87
    gdb_test "$abbrev" \
88
             "Value returned is .* = 1" \
89
             "Testing the \"$abbrev\" abbreviation for \"finish\""
90
}
91
 
92
proc finish_tests { } {
93
    global gdb_prompt
94
 
95
    if { ! [ runto_main ] } then {
96
        untested finish.exp
97
        return -1
98
    }
99
 
100
    finish_void
101
    finish_1 "char"
102
    finish_1 "short"
103
    finish_1 "int"
104
    finish_1 "long"
105
    finish_1 "long_long"
106
    finish_1 "float"
107
    finish_1 "double"
108
    finish_abbreviation "fin"
109
}
110
 
111
set prev_timeout $timeout
112
set timeout 30
113
finish_tests
114
set timeout $prev_timeout

powered by: WebSVN 2.1.0

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