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

Subversion Repositories or1k

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
# Copyright 1992, 1994, 1995, 1996, 1997, 1999, 2000
2
# Free Software Foundation, Inc.
3
 
4
# This program is free software; you can redistribute it and/or modify
5
# it under the terms of the GNU General Public License as published by
6
# the Free Software Foundation; either version 2 of the License, or
7
# (at your option) any later version.
8
#
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
# GNU General Public License for more details.
13
#
14
# You should have received a copy of the GNU General Public License
15
# along with this program; if not, write to the Free Software
16
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
 
18
# Please email any bugs, comments, and/or additions to this file to:
19
# bug-gdb@prep.ai.mit.edu
20
 
21
# This file was written by Jeff Law. (law@cs.utah.edu)
22
 
23
if $tracelevel then {
24
    strace $tracelevel
25
}
26
 
27
set prms_id 0
28
set bug_id 0
29
 
30
set testfile "recurse"
31
set srcfile ${testfile}.c
32
set binfile ${objdir}/${subdir}/${testfile}
33
if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
34
     gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
35
}
36
 
37
# Start with a fresh gdb.
38
 
39
gdb_exit
40
gdb_start
41
gdb_reinitialize_dir $srcdir/$subdir
42
gdb_load ${binfile}
43
 
44
proc recurse_tests {} {
45
 
46
    # Disable hardware watchpoints if necessary.
47
    if [target_info exists gdb,no_hardware_watchpoints] {
48
        gdb_test "set can-use-hw-watchpoints 0" "" ""
49
    }
50
 
51
    if [runto recurse] then {
52
        # First we need to step over the assignment of b, so it has a known
53
        # value.
54
        gdb_test "next" "if \\(a == 1\\)" "next over b = 0 in first instance"
55
        gdb_test "watch b" ".*\[Ww\]atchpoint \[0-9]*: b" \
56
            "set first instance watchpoint"
57
 
58
        # Continue until initial set of b.
59
        if [gdb_test "continue" \
60
            "Continuing.*\[Ww\]atchpoint.*: b.*Old value = 0.*New value = 10.*" \
61
            "continue to first instance watchpoint, first time"] then {
62
            gdb_suppress_tests;
63
        }
64
 
65
        # Continue inward for a few iterations
66
        gdb_test "continue" "Breakpoint.* recurse \\(a=9\\).*" \
67
            "continue to recurse (a = 9)"
68
        gdb_test "continue" "Breakpoint.* recurse \\(a=8\\).*" \
69
            "continue to recurse (a = 8)"
70
        gdb_test "continue" "Breakpoint.* recurse \\(a=7\\).*" \
71
            "continue to recurse (a = 7)"
72
        gdb_test "continue" "Breakpoint.* recurse \\(a=6\\).*" \
73
            "continue to recurse (a = 6)"
74
        gdb_test "continue" "Breakpoint.* recurse \\(a=5\\).*" \
75
            "continue to recurse (a = 5)"
76
 
77
        # Put a watchpoint on another instance of b
78
        # First we need to step over the assignment of b, so it has a known
79
        # value.
80
        gdb_test "next" "if \\(a == 1\\)" "next over b = 0 in second instance"
81
        gdb_test "watch b" ".*\[Ww\]atchpoint \[0-9]*: b" \
82
            "set second instance watchpoint"
83
 
84
        # Continue until initial set of b (second instance).
85
        if [gdb_test "continue" \
86
            "Continuing.*\[Ww\]atchpoint.*: b.*Old value = 0.*New value = 5.*"\
87
            "continue to second instance watchpoint, first time"] then {
88
        gdb_suppress_tests;
89
        }
90
 
91
        # Continue inward for a few iterations
92
        gdb_test "continue" "Breakpoint.* recurse \\(a=4\\).*" \
93
            "continue to recurse (a = 4)"
94
        gdb_test "continue" "Breakpoint.* recurse \\(a=3\\).*" \
95
            "continue to recurse (a = 3)"
96
        gdb_test "continue" "Breakpoint.* recurse \\(a=2\\).*" \
97
            "continue to recurse (a = 2)"
98
        gdb_test "continue" "Breakpoint.* recurse \\(a=1\\).*" \
99
            "continue to recurse (a = 1)"
100
 
101
        # Continue until second set of b (second instance).
102
        if [gdb_test "continue" \
103
            "Continuing.*\[Ww\]atchpoint.*: b.*Old value = 5.*New value = 120.*return.*" \
104
            "continue to second instance watchpoint, second time"] then {
105
            gdb_suppress_tests;
106
        }
107
 
108
        # Continue again.  We should have a watchpoint go out of scope now
109
        if [gdb_test "continue" \
110
            "Continuing.*\[Ww\]atchpoint.*deleted.*recurse \\(a=6\\) .*" \
111
            "second instance watchpoint deleted when leaving scope"] then {
112
            gdb_suppress_tests;
113
        }
114
 
115
        # Continue until second set of b (first instance).
116
        # 24320 is allowed as the final value for b as that's the value
117
        # b would have on systems with 16bit integers.
118
        #
119
        # We could fix the test program to deal with this too.
120
        if [gdb_test "continue" \
121
            "Continuing.*\[Ww\]atchpoint.*b.*Old value = 10.*New value = \(3628800|24320\).*return.*" \
122
            "continue to first instance watchpoint, second time"] then {
123
            gdb_suppress_tests
124
        }
125
 
126
        # Continue again.  We should have a watchpoint go out of scope now
127
        if [gdb_test "continue" \
128
            "Continuing.*\[Ww\]atchpoint.*deleted.*main \\(\\) .*" \
129
            "first instance watchpoint deleted when leaving scope"] then {
130
            gdb_suppress_tests;
131
        }
132
    }
133
    gdb_stop_suppressing_tests;
134
}
135
 
136
# Preserve the old timeout, and set a new one that should be
137
# sufficient to avoid timing out during this test.
138
set oldtimeout $timeout
139
set timeout [expr "$timeout + 60"]
140
verbose "Timeout is now $timeout seconds" 2
141
 
142
recurse_tests
143
 
144
# Restore the preserved old timeout value.
145
set timeout $oldtimeout
146
verbose "Timeout is now $timeout seconds" 2
147
 

powered by: WebSVN 2.1.0

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