import gdb-1999-11-08 snapshot
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / remote.exp
1 # Copyright (C) 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
129
130 gdb_load_timed $binfile {} "" {}
131
132 # Typically about 400 bytes can be downloaded
133 gdb_load_timed $binfile 0 "limit" 399
134 gdb_load_timed $binfile 0 "limit" 401
135
136 # fall back to the default
137 gdb_load_timed $binfile 0 "limit" 0
138
139 # Absolute max is 16384
140 gdb_load_timed $binfile 0 "fixed" 0
141 gdb_load_timed $binfile 0 "fixed" 16385
142
143 gdb_exit
This page took 0.034652 seconds and 4 git commands to generate.