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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-7.1/] [gdb/] [testsuite/] [gdb.reverse/] [consecutive-reverse.exp] - Blame information for rev 252

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 reverse.
18
 
19
if ![target_info exists gdb,can_reverse] {
20
    return
21
}
22
 
23
set testfile "consecutive-reverse"
24
set srcfile ${testfile}.c
25
 
26
if { [prepare_for_testing $testfile.exp $testfile $srcfile] } {
27
    return -1
28
}
29
 
30
runto main
31
 
32
if [target_info exists gdb,use_precord] {
33
    # Activate process record/replay
34
    gdb_test "record" "" "Turn on process record"
35
    # FIXME: command ought to acknowledge, so we can test if it succeeded.
36
}
37
 
38
gdb_breakpoint foo
39
gdb_test "continue" "Breakpoint $decimal, foo .*" \
40
        "continue to breakpoint in foo"
41
 
42
set foo1_addr 0
43
set foo2_addr 0
44
set stop_addr 0
45
 
46
send_gdb "x /2i \$pc\n"
47
gdb_expect {
48
    global hex
49
    global foo1_addr
50
    global foo2_addr
51
    global gdb_prompt
52
 
53
    -re "=> ($hex).*\[\r\n\]+   ($hex).*$gdb_prompt $" {
54
        set foo1_addr $expect_out(1,string)
55
        set foo2_addr $expect_out(2,string)
56
        pass "get breakpoint address for foo"
57
    }
58
    -re ".*$gdb_prompt $" {
59
        fail "get breakpoint address for foo"
60
        return 0;
61
    }
62
    timeout {
63
        fail "get breakpoint address for foo (timeout)"
64
        return 0;
65
    }
66
}
67
 
68
gdb_test "break \*$foo2_addr" "Breakpoint $decimal at $foo2_addr: file .*" \
69
        "set bp, 2nd instr"
70
 
71
set testmsg "stopped at bp, 2nd instr"
72
gdb_test_multiple "step" $testmsg {
73
    -re "Breakpoint $decimal, ($hex) in foo.*$gdb_prompt $" {
74
        set stop_addr $expect_out(1,string)
75
        if [eval expr "$foo2_addr == $stop_addr"] then {
76
            pass "stopped at bp, 2nd instr"
77
        } else {
78
            fail "stopped at bp, 2nd instr (wrong address)"
79
        }
80
    }
81
}
82
 
83
###
84
###
85
###
86
 
87
# Set reverse execution direction
88
# FIXME: command needs to acknowledge, so we can test if it succeeded.
89
 
90
gdb_test "set exec-dir reverse" "" "set reverse execution"
91
 
92
# Now step backward and hope to hit the first breakpoint.
93
 
94
set test_msg "stopped at bp in reverse, 1st instr"
95
gdb_test_multiple "step" "$test_msg" {
96
    -re "Breakpoint $decimal, ($hex) in foo.*$gdb_prompt $" {
97
        set stop_addr $expect_out(1,string)
98
        if [eval expr "$foo1_addr == $stop_addr"] then {
99
            pass "$test_msg"
100
        } else {
101
            fail "$test_msg (wrong address)"
102
        }
103
    }
104
    -re "Breakpoint $decimal, foo.*$gdb_prompt $" {
105
        send_gdb "print \$pc == $foo1_addr\n"
106
        gdb_expect {
107
            -re "$decimal = 1\[\r\n\]+$gdb_prompt $" {
108
                pass "$test_msg"
109
            }
110
            -re "$decimal = 0\[\r\n\]+$gdb_prompt $" {
111
                fail "$test_msg (wrong address)"
112
            }
113
        }
114
    }
115
    -re ".*$gdb_prompt $" {
116
        fail "$test_msg"
117
    }
118
}

powered by: WebSVN 2.1.0

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