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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gdb-7.1/] [gdb/] [testsuite/] [gdb.base/] [remote.exp] - Blame information for rev 227

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

Line No. Rev Author Line
1 227 jeremybenn
# Copyright 1999, 2001, 2004, 2007, 2008, 2009, 2010
2
# Free Software Foundation, Inc.
3
 
4
# This program is free software; you can redistribute it and/or modify
5
# it under the terms of the GNU General Public License as published by
6
# the Free Software Foundation; either version 3 of the License, or
7
# (at your option) any later version.
8
#
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
# GNU General Public License for more details.
13
#
14
# You should have received a copy of the GNU General Public License
15
# along with this program.  If not, see .
16
 
17
if $tracelevel then {
18
    strace $tracelevel
19
}
20
 
21
set prms_id 0
22
set bug_id 0
23
 
24
 
25
# test only on a remote target board
26
if {! [is_remote target]} {
27
    return
28
}
29
 
30
set testfile "remote"
31
set srcfile ${testfile}.c
32
set binfile ${objdir}/${subdir}/${testfile}
33
 
34
gdb_start
35
 
36
set result [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}]
37
if {$result != "" } then {
38
    untested remote.exp
39
    return -1
40
}
41
 
42
 
43
#
44
# Part ONE: Check the down load commands
45
#
46
 
47
gdb_test "show remote memory-write-packet-size" \
48
        "The memory-write-packet-size is 0. Packets are limited to \[0-9\]+ bytes." \
49
        "write-packet default"
50
 
51
gdb_test "set remote memory-write-packet-size" \
52
        "Argument required .integer, `fixed' or `limited'.\." \
53
        "set write-packet - NULL"
54
 
55
gdb_test "set remote memory-write-packet-size 20" ""
56
gdb_test "show remote memory-write-packet-size" \
57
        "The memory-write-packet-size is 20. Packets are limited to 20 bytes." \
58
        "set write-packet - small"
59
 
60
gdb_test "set remote memory-write-packet-size 1" ""
61
gdb_test "show remote memory-write-packet-size" \
62
        "The memory-write-packet-size is 1. Packets are limited to 20 bytes." \
63
        "set write-packet - very-small"
64
 
65
#
66
# Part TWO: Check the download behavour
67
#
68
 
69
proc gdb_load_timed {executable class writesize} {
70
    global test gdb_prompt
71
    set test "timed download `[file tail $executable]' - $class, $writesize"
72
 
73
    if {$writesize != ""} then {
74
        gdb_test "set remote memory-write-packet-size $writesize" \
75
                "" "$test - set packet size"
76
 
77
        send_gdb "set remote memory-write-packet-size $class\n"
78
        gdb_expect 5 {
79
            -re ".*Change the packet size.*$" {
80
                send_gdb "y\n"
81
                gdb_expect 5 {
82
                    -re ".*$gdb_prompt $" {
83
                        pass "$test - set write size class"
84
                    }
85
                    timeout {
86
                        fail "$test - set write size class"
87
                        return
88
                    }
89
                }
90
            }
91
            -re ".*$gdb_prompt $" { }
92
            timeout {
93
                fail "$test - set write size class"
94
                return
95
            }
96
        }
97
    }
98
 
99
    # Do not try to load using fixed sizes; we may overflow the remote target.
100
    if { $class == "fixed" } {
101
        return
102
    }
103
 
104
    set load_begin_time [clock clicks]
105
    set result [gdb_load $executable]
106
    set load_end_time [clock clicks]
107
    if { $result != 0 } then {
108
        fail "$test - loading executable"
109
        return
110
    }
111
    verbose "$test - time [expr ($load_end_time - $load_begin_time) / 1000] ms"
112
    pass $test
113
}
114
 
115
# Typically about 400-1 bytes can be downloaded
116
gdb_load_timed $binfile "limit" 398
117
gdb_load_timed $binfile "limit" 400
118
 
119
# Absolute max is 16384
120
gdb_load_timed $binfile "fixed" 0
121
gdb_load_timed $binfile "fixed" 16385
122
 
123
# fall back to the default
124
gdb_load_timed $binfile "limit" 0
125
 
126
# Get size of data uploaded
127
 
128
#
129
# Query GDB for the size of various types
130
#
131
 
132
# Get the size of random_data table (defaults to 48K).
133
set sizeof_random_data [get_sizeof "random_data" 48*1024]
134
 
135
#
136
# Part THREE: Check the upload behavour
137
#
138
if ![runto_main] then {
139
    fail "Cannot run to main"
140
}
141
 
142
# Carefully check memory around each of the most common packet edge
143
# conditions
144
 
145
gdb_test "x/8ub random_data" \
146
        ":\[ \t\]+60\[ \t\]+74\[ \t\]+216\[ \t\]+38\[ \t\]+149\[ \t\]+49\[ \t\]+207\[ \t\]+44"
147
 
148
gdb_test "x/8ub random_data + 400 - 4" \
149
        ":\[ \t\]+185\[ \t\]+255\[ \t\]+50\[ \t\]+140\[ \t\]+237\[ \t\]+172\[ \t\]+143\[ \t\]+93"
150
 
151
if {$sizeof_random_data > 16380 } then {
152
    gdb_test "x/8ub random_data + 16384 - 4" \
153
        ":\[ \t\]+178\[ \t\]+180\[ \t\]+135\[ \t\]+93\[ \t\]+70\[ \t\]+62\[ \t\]+205\[ \t\]+76"
154
}
155
 
156
# Read a chunk just larger than the packet size (reduce the packet
157
# size to make life easier)
158
gdb_test "set remote memory-read-packet-size 16" \
159
        ""
160
gdb_test "show remote memory-read-packet-size" \
161
        "The memory-read-packet-size is 16. Packets are limited to 20 bytes."
162
gdb_test "x/17ub random_data" \
163
        ":\[ \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"
164
 
165
gdb_exit

powered by: WebSVN 2.1.0

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