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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gdb-7.1/] [gdb/] [testsuite/] [gdb.reverse/] [consecutive-precsave.exp] - Blame information for rev 833

Go to most recent revision | 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 stepping over
17
# consecutive instructions in a process record logfile.
18
 
19
# This test suitable only for process record-replay
20
if ![target_info exists gdb,use_precord] {
21
    return
22
}
23
 
24
set testfile "consecutive-reverse"
25
set srcfile ${testfile}.c
26
 
27
if { [prepare_for_testing $testfile.exp $testfile $srcfile] } {
28
    return -1
29
}
30
 
31
runto main
32
 
33
if [target_info exists gdb,use_precord] {
34
    # Activate process record/replay
35
    gdb_test "record" "" "Turn on process record"
36
    # FIXME: command ought to acknowledge, so we can test if it succeeded.
37
}
38
 
39
set end_location  [gdb_get_line_number "end of main"  ]
40
gdb_test "break $end_location" \
41
    "Breakpoint $decimal at .*/$srcfile, line $end_location\." \
42
    "BP at end of main"
43
 
44
gdb_test "continue" "Breakpoint .* end of main .*" "run to end of main"
45
 
46
gdb_test "record save consecutive.precsave" \
47
    "Saved core file consecutive.precsave with execution log\."  \
48
    "save process recfile"
49
 
50
gdb_test "kill" "" "Kill process, prepare to debug log file" \
51
    "Kill the program being debugged\\? \\(y or n\\) " "y"
52
 
53
gdb_test "record restore consecutive.precsave" \
54
    "Program terminated with signal .*" \
55
    "reload precord save file"
56
 
57
gdb_breakpoint foo
58
gdb_test "continue" "Breakpoint $decimal, foo .*" \
59
        "continue to breakpoint in foo"
60
 
61
set foo1_addr 0
62
set foo2_addr 0
63
set stop_addr 0
64
 
65
send_gdb "x /2i \$pc\n"
66
gdb_expect {
67
    global hex
68
    global foo1_addr
69
    global foo2_addr
70
    global gdb_prompt
71
 
72
    -re "=> ($hex).*\[\r\n\]+   ($hex).*$gdb_prompt $" {
73
        set foo1_addr $expect_out(1,string)
74
        set foo2_addr $expect_out(2,string)
75
        pass "get breakpoint address for foo"
76
    }
77
    -re ".*$gdb_prompt $" {
78
        fail "get breakpoint address for foo"
79
        return 0;
80
    }
81
    timeout {
82
        fail "get breakpoint address for foo (timeout)"
83
        return 0;
84
    }
85
}
86
 
87
gdb_test "break \*$foo2_addr" "Breakpoint $decimal at $foo2_addr: file .*" \
88
        "set bp, 2nd instr"
89
 
90
set testmsg "stopped at bp, 2nd instr"
91
gdb_test_multiple "step" $testmsg {
92
    -re "Breakpoint $decimal, ($hex) in foo.*$gdb_prompt $" {
93
        set stop_addr $expect_out(1,string)
94
        if [eval expr "$foo2_addr == $stop_addr"] then {
95
            pass "stopped at bp, 2nd instr"
96
        } else {
97
            fail "stopped at bp, 2nd instr (wrong address)"
98
        }
99
    }
100
}
101
 
102
###
103
###
104
###
105
 
106
# Set reverse execution direction
107
# FIXME: command needs to acknowledge, so we can test if it succeeded.
108
 
109
gdb_test "set exec-dir reverse" "" "set reverse execution"
110
 
111
# Now step backward and hope to hit the first breakpoint.
112
 
113
set test_msg "stopped at bp in reverse, 1st instr"
114
gdb_test_multiple "step" "$test_msg" {
115
    -re "Breakpoint $decimal, ($hex) in foo.*$gdb_prompt $" {
116
        set stop_addr $expect_out(1,string)
117
        if [eval expr "$foo1_addr == $stop_addr"] then {
118
            pass "$test_msg"
119
        } else {
120
            fail "$test_msg (wrong address)"
121
        }
122
    }
123
    -re "Breakpoint $decimal, foo.*$gdb_prompt $" {
124
        send_gdb "print \$pc == $foo1_addr\n"
125
        gdb_expect {
126
            -re "$decimal = 1\[\r\n\]+$gdb_prompt $" {
127
                pass "$test_msg"
128
            }
129
            -re "$decimal = 0\[\r\n\]+$gdb_prompt $" {
130
                fail "$test_msg (wrong address)"
131
            }
132
        }
133
    }
134
    -re ".*$gdb_prompt $" {
135
        fail "$test_msg"
136
    }
137
}

powered by: WebSVN 2.1.0

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