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

Subversion Repositories openrisc

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 227 jeremybenn
# Copyright 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 is part of the GDB testsuite.  It tests 'until' and
17
# 'advance' in reverse debugging.
18
 
19
if ![target_info exists gdb,can_reverse] {
20
    return
21
}
22
 
23
set testfile "until-reverse"
24
set srcfile ${testfile}.c
25
set srcfile1 ur1.c
26
 
27
if { [prepare_for_testing $testfile.exp $testfile {until-reverse.c ur1.c} ] } {
28
    return -1
29
}
30
 
31
set bp_location1  [gdb_get_line_number "set breakpoint 1 here"]
32
set bp_location7  [gdb_get_line_number "set breakpoint 7 here"]
33
set bp_location9  [gdb_get_line_number "set breakpoint 9 here" "$srcfile1"]
34
set bp_location19 [gdb_get_line_number "set breakpoint 19 here"]
35
set bp_location20 [gdb_get_line_number "set breakpoint 20 here"]
36
set bp_location21 [gdb_get_line_number "set breakpoint 21 here"]
37
 
38
runto main
39
 
40
if [target_info exists gdb,use_precord] {
41
    # Activate process record/replay
42
    gdb_test "record" "" "Turn on process record"
43
    # FIXME: command ought to acknowledge, so we can test if it succeeded.
44
}
45
 
46
# Verify that plain vanilla "until " works.
47
#
48
gdb_test "until $bp_location1" \
49
    "main .* at .*:$bp_location1.*" \
50
    "until line number"
51
 
52
# Advance up to factorial, outer invocation
53
#
54
gdb_test "advance factorial" \
55
    "factorial .value=6..*$srcfile:$bp_location7.*" \
56
    "advance to factorial"
57
 
58
# At this point, 'until' should continue the inferior up to when all the
59
# inner invocations of factorial() are completed and we are back at this
60
# frame.
61
#
62
gdb_test "until $bp_location19" \
63
    "factorial .value=720.*${srcfile}:$bp_location19.*" \
64
    "until factorial, recursive function"
65
 
66
# Finish out to main scope
67
#
68
gdb_test "finish" \
69
    " in main .*$srcfile:$bp_location1.*" \
70
    "finish to main"
71
 
72
# Advance to a function called by main (marker2)
73
#
74
gdb_test "advance marker2" \
75
    "marker2 .a=43.*$srcfile1:$bp_location9.*" \
76
    "advance to marker2"
77
 
78
# Now issue an until with another function, not called by the current
79
# frame, as argument. This should not work, i.e. the program should
80
# stop at main, the caller, where we put the 'guard' breakpoint.
81
#
82
set test_msg "until func, not called by current frame"
83
gdb_test_multiple "until marker3" "$test_msg" {
84
    -re "main .*at .*${srcfile}:$bp_location20.*$gdb_prompt $" {
85
        pass "$test_msg"
86
    }
87
    -re "main .*at .*${srcfile}:$bp_location21.*$gdb_prompt $" {
88
        pass "$test_msg"
89
    }
90
}
91
 
92
###
93
###
94
###
95
 
96
# Set reverse execution direction
97
# FIXME: command needs to acknowledge, so we can test if it succeeded.
98
 
99
gdb_test "set exec-dir reverse" "" "set reverse execution"
100
 
101
#
102
# We should now be at main, after the return from marker2.
103
# "Advance" backward into marker2.
104
#
105
 
106
gdb_test "advance marker2" \
107
    "marker2 .a=43.*$srcfile1:$bp_location9.*" \
108
    "reverse-advance to marker2"
109
 
110
# Finish out to main scope (backward)
111
 
112
gdb_test "finish" \
113
    " in main .*$srcfile:$bp_location20.*" \
114
    "reverse-finish from marker2"
115
 
116
# Advance backward to last line of factorial (outer invocation)
117
 
118
gdb_test "advance $bp_location19" \
119
    "factorial .value=720.*${srcfile}:$bp_location19.*" \
120
    "reverse-advance to final return of factorial"
121
 
122
# Now do "until" across the recursive calls,
123
# ending up in the same frame where we are now.
124
 
125
gdb_test "until $bp_location7" \
126
    "factorial .value=6..*$srcfile:$bp_location7.*" \
127
    "reverse-until to entry of factorial"

powered by: WebSVN 2.1.0

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