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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.0/] [gdb/] [testsuite/] [gdb.base/] [recurse.exp] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 106 markom
# Copyright (C) 1992, 1996, 1997 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 2 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, write to the Free Software
15
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16
 
17
# Please email any bugs, comments, and/or additions to this file to:
18
# bug-gdb@prep.ai.mit.edu
19
 
20
# This file was written by Jeff Law. (law@cs.utah.edu)
21
 
22
if $tracelevel then {
23
    strace $tracelevel
24
}
25
 
26
set prms_id 0
27
set bug_id 0
28
 
29
set testfile "recurse"
30
set srcfile ${testfile}.c
31
set binfile ${objdir}/${subdir}/${testfile}
32
if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
33
     gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
34
}
35
 
36
# Start with a fresh gdb.
37
 
38
gdb_exit
39
gdb_start
40
gdb_reinitialize_dir $srcdir/$subdir
41
gdb_load ${binfile}
42
 
43
proc recurse_tests {} {
44
 
45
    if [runto recurse] then {
46
        # First we need to step over the assignment of b, so it has a known
47
        # value.
48
        gdb_test "next" "if \\(a == 1\\)" "next over b = 0 in first instance"
49
        gdb_test "watch b" ".*\[Ww\]atchpoint \[0-9]*: b" \
50
            "set first instance watchpoint"
51
 
52
        # Continue until initial set of b.
53
        if [gdb_test "continue" \
54
            "Continuing.*\[Ww\]atchpoint.*: b.*Old value = 0.*New value = 10.*" \
55
            "continue to first instance watchpoint, first time"] then {
56
            gdb_suppress_tests;
57
        }
58
 
59
        # Continue inward for a few iterations
60
        gdb_test "continue" "Breakpoint.* recurse \\(a=9\\).*" \
61
            "continue to recurse (a = 9)"
62
        gdb_test "continue" "Breakpoint.* recurse \\(a=8\\).*" \
63
            "continue to recurse (a = 8)"
64
        gdb_test "continue" "Breakpoint.* recurse \\(a=7\\).*" \
65
            "continue to recurse (a = 7)"
66
        gdb_test "continue" "Breakpoint.* recurse \\(a=6\\).*" \
67
            "continue to recurse (a = 6)"
68
        gdb_test "continue" "Breakpoint.* recurse \\(a=5\\).*" \
69
            "continue to recurse (a = 5)"
70
 
71
        # Put a watchpoint on another instance of b
72
        # First we need to step over the assignment of b, so it has a known
73
        # value.
74
        gdb_test "next" "if \\(a == 1\\)" "next over b = 0 in second instance"
75
        gdb_test "watch b" ".*\[Ww\]atchpoint \[0-9]*: b" \
76
            "set second instance watchpoint"
77
 
78
        # Continue until initial set of b (second instance).
79
        if [gdb_test "continue" \
80
            "Continuing.*\[Ww\]atchpoint.*: b.*Old value = 0.*New value = 5.*"\
81
            "continue to second instance watchpoint, first time"] then {
82
        gdb_suppress_tests;
83
        }
84
 
85
        # Continue inward for a few iterations
86
        gdb_test "continue" "Breakpoint.* recurse \\(a=4\\).*" \
87
            "continue to recurse (a = 4)"
88
        gdb_test "continue" "Breakpoint.* recurse \\(a=3\\).*" \
89
            "continue to recurse (a = 3)"
90
        gdb_test "continue" "Breakpoint.* recurse \\(a=2\\).*" \
91
            "continue to recurse (a = 2)"
92
        gdb_test "continue" "Breakpoint.* recurse \\(a=1\\).*" \
93
            "continue to recurse (a = 1)"
94
 
95
        # Continue until second set of b (second instance).
96
        if [gdb_test "continue" \
97
            "Continuing.*\[Ww\]atchpoint.*: b.*Old value = 5.*New value = 120.*return.*" \
98
            "continue to second instance watchpoint, second time"] then {
99
            gdb_suppress_tests;
100
        }
101
 
102
        # Continue again.  We should have a watchpoint go out of scope now
103
        if [gdb_test "continue" \
104
            "Continuing.*\[Ww\]atchpoint.*deleted.*recurse \\(a=6\\) .*" \
105
            "second instance watchpoint deleted when leaving scope"] then {
106
            gdb_suppress_tests;
107
        }
108
 
109
        # Continue until second set of b (first instance).
110
        # 24320 is allowed as the final value for b as that's the value
111
        # b would have on systems with 16bit integers.
112
        #
113
        # We could fix the test program to deal with this too.
114
        if [gdb_test "continue" \
115
            "Continuing.*\[Ww\]atchpoint.*b.*Old value = 10.*New value = \(3628800|24320\).*return.*" \
116
            "continue to first instance watchpoint, second time"] then {
117
            gdb_suppress_tests
118
        }
119
 
120
        # Continue again.  We should have a watchpoint go out of scope now
121
        if [gdb_test "continue" \
122
            "Continuing.*\[Ww\]atchpoint.*deleted.*main \\(\\) .*" \
123
            "first instance watchpoint deleted when leaving scope"] then {
124
            gdb_suppress_tests;
125
        }
126
    }
127
    gdb_stop_suppressing_tests;
128
}
129
 
130
# Only enabled for some targets merely because it has not been tested
131
# elsewhere.
132
if {[istarget "sparc*-*-sunos4*"] || [istarget "hppa*-*-bsd*"] || [istarget "hppa*-*-hpux*"] || [istarget "sparclet-*-*"] || [istarget "m32r-*-elf"] || [istarget "mn10200-*-*"] || [istarget "mn10300-*-*"]} then {
133
 
134
    # Preserve the old timeout, and set a new one that should be
135
    # sufficient to avoid timing out during this test.
136
    set oldtimeout $timeout
137
    set timeout [expr "$timeout + 60"]
138
    verbose "Timeout is now $timeout seconds" 2
139
 
140
    recurse_tests
141
 
142
    # Restore the preserved old timeout value.
143
    set timeout $oldtimeout
144
    verbose "Timeout is now $timeout seconds" 2
145
}

powered by: WebSVN 2.1.0

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