import gdb-1999-11-08 snapshot
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / remote.exp
CommitLineData
5c44784c
JM
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
20if $tracelevel then {
21 strace $tracelevel
22}
23
24set prms_id 0
25set bug_id 0
26
27
28# test only on a remote target board
29if {! [is_remote target]} {
30 return
31}
32
33
34set testfile "remote"
35set srcfile ${testfile}.c
36set binfile ${objdir}/${subdir}/${testfile}
37
11cf8741
JM
38gdb_start
39
40set result [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}]
41if {$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
50gdb_test "show download-write-size" \
51 "The write size used when downloading a program is 512." \
52 "download limit default"
53
54gdb_test "set download-write-size" "Argument required.*"
55
56gdb_test "set download-write-size 0" ""
57gdb_test "show download-write-size" \
58 "The write size used when downloading a program is unlimited." \
59 "set download limit - unlimited"
60
61gdb_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
65gdb_test "set remote memory-write-packet-size" \
66 "Argument required .integer, `fixed' or `limited'.\." \
67 "set write-packet - NULL"
5c44784c 68
11cf8741
JM
69gdb_test "set remote memory-write-packet-size 16" ""
70gdb_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
74gdb_test "set remote memory-write-packet-size 1" ""
75gdb_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
83proc gdb_load_timed {executable downloadsize class writesize} {
5c44784c 84 global test gdb_prompt
11cf8741 85 set test "timed download `[file tail $executable]' - $downloadsize, $class, $writesize"
5c44784c
JM
86
87 if {$writesize != ""} then {
11cf8741
JM
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"
5c44784c 99 gdb_expect 5 {
11cf8741
JM
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 }
5c44784c 112 -re ".*$gdb_prompt $" { }
11cf8741
JM
113 timeout {
114 fail "$test - set write size class"
115 return
116 }
5c44784c
JM
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
11cf8741 130gdb_load_timed $binfile {} "" {}
5c44784c 131
11cf8741
JM
132# Typically about 400 bytes can be downloaded
133gdb_load_timed $binfile 0 "limit" 399
134gdb_load_timed $binfile 0 "limit" 401
5c44784c 135
11cf8741
JM
136# fall back to the default
137gdb_load_timed $binfile 0 "limit" 0
5c44784c 138
11cf8741
JM
139# Absolute max is 16384
140gdb_load_timed $binfile 0 "fixed" 0
141gdb_load_timed $binfile 0 "fixed" 16385
5c44784c
JM
142
143gdb_exit
This page took 0.029665 seconds and 4 git commands to generate.