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

Subversion Repositories or1k

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
#   Copyright 1999 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 2 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, write to the Free Software
15
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16
 
17
# Please email any bugs, comments, and/or additions to this file to:
18
# bug-gdb@prep.ai.mit.edu
19
 
20
if $tracelevel then {
21
    strace $tracelevel
22
}
23
 
24
set prms_id 0
25
set bug_id 0
26
 
27
 
28
# test only on a remote target board
29
if {! [is_remote target]} {
30
    return
31
}
32
 
33
 
34
set testfile "remote"
35
set srcfile ${testfile}.c
36
set binfile ${objdir}/${subdir}/${testfile}
37
 
38
gdb_start
39
 
40
set result [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}]
41
if {$result != "" } then {
42
    gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
43
}
44
 
45
 
46
#
47
# Part ONE: Check the down load commands
48
#
49
 
50
gdb_test "show download-write-size" \
51
        "The write size used when downloading a program is 512." \
52
        "download limit default"
53
 
54
gdb_test "set download-write-size" "Argument required.*"
55
 
56
gdb_test "set download-write-size 0" ""
57
gdb_test "show download-write-size" \
58
        "The write size used when downloading a program is unlimited." \
59
        "set download limit - unlimited"
60
 
61
gdb_test "show remote memory-write-packet-size" \
62
        "The memory-write-packet-size is 0. Packets are limited to \[0-9\]+ bytes." \
63
        "write-packet default"
64
 
65
gdb_test "set remote memory-write-packet-size" \
66
        "Argument required .integer, `fixed' or `limited'.\." \
67
        "set write-packet - NULL"
68
 
69
gdb_test "set remote memory-write-packet-size 16" ""
70
gdb_test "show remote memory-write-packet-size" \
71
        "The memory-write-packet-size is 16. Packets are limited to 16 bytes." \
72
        "set write-packet - small"
73
 
74
gdb_test "set remote memory-write-packet-size 1" ""
75
gdb_test "show remote memory-write-packet-size" \
76
        "The memory-write-packet-size is 1. Packets are limited to 16 bytes." \
77
        "set write-packet - very-small"
78
 
79
#
80
# Part TWO: Check the download behavour
81
#
82
 
83
proc gdb_load_timed {executable downloadsize class writesize} {
84
    global test gdb_prompt
85
    set test "timed download `[file tail $executable]' - $downloadsize, $class, $writesize"
86
 
87
    if {$writesize != ""} then {
88
        gdb_test "set remote memory-write-packet-size $writesize" \
89
                "" "$test - set packet size"
90
    }
91
 
92
    if {$downloadsize != ""} then {
93
        gdb_test "set download-write-size $downloadsize" \
94
                "" "$test - set download size"
95
    }
96
 
97
    if {$downloadsize != ""} then {
98
        send_gdb "set remote memory-write-packet-size $class\n"
99
        gdb_expect 5 {
100
            -re ".*Change the packet size.*$" {
101
                send_gdb "y\n"
102
                gdb_expect 5 {
103
                    -re ".*$gdb_prompt $" {
104
                        pass "$test - set write size class"
105
                    }
106
                    timeout {
107
                        fail "$test - set write size class"
108
                        return
109
                    }
110
                }
111
            }
112
            -re ".*$gdb_prompt $" { }
113
            timeout {
114
                fail "$test - set write size class"
115
                return
116
            }
117
        }
118
    }
119
 
120
    set load_begin_time [clock clicks]
121
    set result [gdb_load $executable]
122
    set load_end_time [clock clicks]
123
    if {$result < 0} then { fail "$test - loading executable"; return }
124
    verbose "$test - time [expr ($load_end_time - $load_begin_time) / 1000] ms"
125
    pass $test
126
}
127
 
128
gdb_load_timed $binfile {} "" {}
129
 
130
# Typically about 400-1 bytes can be downloaded
131
gdb_load_timed $binfile 0 "limit" 398
132
gdb_load_timed $binfile 0 "limit" 400
133
 
134
# Absolute max is 16384
135
gdb_load_timed $binfile 0 "fixed" 0
136
gdb_load_timed $binfile 0 "fixed" 16385
137
 
138
# fall back to the default
139
gdb_load_timed $binfile 0 "limit" 0
140
 
141
 
142
#
143
# Part THREE: Check the upload behavour
144
#
145
 
146
# Carefully check memory around each of the most common packet edge
147
# conditions
148
 
149
gdb_test "x/8ub random_data" \
150
        ":\[ \t\]+60\[ \t\]+74\[ \t\]+216\[ \t\]+38\[ \t\]+149\[ \t\]+49\[ \t\]+207\[ \t\]+44"
151
 
152
gdb_test "x/8ub random_data + 400 - 4" \
153
        ":\[ \t\]+185\[ \t\]+255\[ \t\]+50\[ \t\]+140\[ \t\]+237\[ \t\]+172\[ \t\]+143\[ \t\]+93"
154
 
155
gdb_test "x/8ub random_data + 16384 - 4" \
156
        ":\[ \t\]+178\[ \t\]+180\[ \t\]+135\[ \t\]+93\[ \t\]+70\[ \t\]+62\[ \t\]+205\[ \t\]+76"
157
 
158
 
159
# Read a chunk just larger than the packet size (reduce the packet
160
# size to make life easier)
161
gdb_test "set remote memory-read-packet-size 16" \
162
        ""
163
gdb_test "show remote memory-read-packet-size" \
164
        "The memory-read-packet-size is 16. Packets are limited to 16 bytes."
165
gdb_test "x/17ub random_data" \
166
        ":\[ \t\]+60\[ \t\]+74\[ \t\]+216\[ \t\]+38\[ \t\]+149\[ \t\]+49\[ \t\]+207\[ \t\]+44.*:\[ \t\]+124\[ \t\]+38\[ \t\]+93\[ \t\]+125\[ \t\]+232\[ \t\]+67\[ \t\]+228\[ \t\]+56.*:\[ \t\]+161"
167
 
168
gdb_exit

powered by: WebSVN 2.1.0

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