OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gdb/] [gdb-6.8/] [gdb-6.8.openrisc-2.1/] [gdb/] [testsuite/] [gdb.arch/] [alpha-step.exp] - Blame information for rev 24

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 24 jeremybenn
# Copyright 2005, 2007, 2008 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
if $tracelevel {
17
    strace $tracelevel
18
}
19
 
20
set prms_id 0
21
set bug_id 0
22
 
23
if ![istarget "alpha*-*-*"] then {
24
    verbose "Skipping alpha step tests."
25
    return
26
}
27
 
28
set testfile "alpha-step"
29
set srcfile ${testfile}.c
30
set binfile ${objdir}/${subdir}/${testfile}
31
 
32
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {}] != "" } {
33
    unsupported "Testcase compile failed."
34
    return -1
35
}
36
 
37
gdb_exit
38
gdb_start
39
gdb_reinitialize_dir $srcdir/$subdir
40
gdb_load ${binfile}
41
 
42
proc test_stepi {function } {
43
    # Restart the program from scratch. If GDB got confused during one
44
    # of the previous tests, this makes sure that it doesn't affect
45
    # this series of tests.
46
    if ![runto_main] then {
47
        fail "Can't run to main"
48
        return 0
49
    }
50
 
51
    # Insert a breakpoint on the FP branch instruction inside FUNCTION.
52
    # Since the function has been hand written, we know this instruction
53
    # is a "fb$function" located at FUNCTION+4.
54
    gdb_test "break *$function+4" \
55
             "Breakpoint .* at .*" \
56
             "breakpoint on fb$function instruction"
57
 
58
    gdb_test "continue" \
59
             "Breakpoint .*, 0x\[0-9a-fA-F\]+ in $function\(\).*" \
60
             "continue to fb$function instruction (first call)"
61
 
62
    # Extra check to make sure we stopped on the FP branch instruction.
63
 
64
    gdb_test "x /i \$pc" \
65
             "0x\[0-9a-fA-F\]+ <.*>:\[ \t\]+fb$function.*" \
66
             "Check breakpoint on fb$function instruction (first call)"
67
 
68
    # Step test, followed by the check that we landed on the expected
69
    # instruction (the testcase should be written in such a way that
70
    # the branch is taken on the first call to this function.
71
 
72
    gdb_test "stepi" \
73
             "0x\[0-9a-fA-F\]+.*" \
74
             "stepi on fb$function (first call)"
75
 
76
    gdb_test "x /i \$pc" \
77
             "0x\[0-9a-fA-F\]+ <.*>:\[ \t\]+ret.*" \
78
             "Check stepi over fb$function stopped on ret"
79
 
80
    # Continue again. FUNCTION should be called a second time, this time
81
    # with an argument such that the FP branch will not be taken.
82
 
83
    gdb_test "continue" \
84
             "Breakpoint .*, 0x\[0-9a-fA-F\]+ in $function\(\).*" \
85
             "continue to fb$function instruction (second call)"
86
 
87
    # Extra check to make sure we stopped on the FP branch instruction.
88
 
89
    gdb_test "x /i \$pc" \
90
             "0x\[0-9a-fA-F\]+ <.*>:\[ \t\]+fb$function.*" \
91
             "Check breakpoint on fb$function instruction (second call)"
92
 
93
    # Step test, branch should not be taken.
94
 
95
    gdb_test "stepi" \
96
             "0x\[0-9a-fA-F\]+.*" \
97
             "stepi on fb$function (branch not taken)"
98
 
99
    # Extra check to verify that we landed on the instruction we expected.
100
 
101
    gdb_test "x /i \$pc" \
102
             "0x\[0-9a-fA-F\]+ <.*>:\[ \t\]+fneg.*" \
103
             "Check stepi over fb$function stopped on fneg instruction"
104
 
105
}
106
 
107
test_stepi "gt"
108
test_stepi "ge"
109
test_stepi "lt"
110
test_stepi "le"
111
test_stepi "eq"
112
test_stepi "ne"
113
 

powered by: WebSVN 2.1.0

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