Commit | Line | Data |
---|---|---|
0fb0cc75 | 1 | # Copyright 2002, 2004, 2007, 2008, 2009 Free Software Foundation, Inc. |
dd7dfd64 MS |
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 | |
e22f8b7c | 5 | # the Free Software Foundation; either version 3 of the License, or |
dd7dfd64 | 6 | # (at your option) any later version. |
e22f8b7c | 7 | # |
dd7dfd64 MS |
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. | |
e22f8b7c | 12 | # |
dd7dfd64 | 13 | # You should have received a copy of the GNU General Public License |
e22f8b7c | 14 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
dd7dfd64 | 15 | |
dd7dfd64 MS |
16 | # This file was written by Michael Snyder (msnyder@redhat.com) |
17 | # This is a test for the gdb command "dump". | |
18 | ||
19 | if $tracelevel then { | |
20 | strace $tracelevel | |
21 | } | |
22 | ||
23 | set prms_id 0 | |
24 | set bug_id 0 | |
25 | ||
26 | set testfile "dump" | |
27 | ||
28 | set srcfile ${testfile}.c | |
29 | set binfile ${objdir}/${subdir}/${testfile} | |
f6347e16 | 30 | set options {debug} |
dd7dfd64 | 31 | |
f31dfe3b | 32 | set is64bitonly "no" |
1ab80e5b | 33 | set endian "auto" |
f31dfe3b | 34 | |
f6347e16 RH |
35 | if [istarget "alpha*-*-*"] then { |
36 | # SREC etc cannot handle 64-bit addresses. Force the test | |
37 | # program into the low 31 bits of the address space. | |
38 | lappend options "additional_flags=-Wl,-taso" | |
39 | } | |
40 | ||
8f07f25a | 41 | if {[istarget "ia64*-*-*"] || [istarget "hppa64-*-*"]} then { |
f31dfe3b JJ |
42 | set is64bitonly "yes" |
43 | } | |
44 | ||
1fac167a UW |
45 | if {[istarget "spu*-*-*"]} then { |
46 | # The internal address format used for the combined Cell/B.E. | |
47 | # debugger requires 64-bit. | |
48 | set is64bitonly "yes" | |
49 | } | |
50 | ||
f6347e16 | 51 | if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable ${options}] != "" } { |
b60f0898 JB |
52 | untested dump.exp |
53 | return -1 | |
dd7dfd64 MS |
54 | } |
55 | ||
56 | # Start with a fresh gdb. | |
57 | ||
58 | gdb_exit | |
59 | gdb_start | |
60 | gdb_reinitialize_dir $srcdir/$subdir | |
c0ac0ec7 JK |
61 | |
62 | gdb_test "dump mem /dev/null 0x10 0x20" "Cannot access memory at address 0x10" \ | |
63 | "inaccessible memory is reported" | |
64 | ||
dd7dfd64 MS |
65 | gdb_load ${binfile} |
66 | ||
67 | # Clean up any stale output files from previous test runs | |
68 | ||
69 | remote_exec build "rm -f intarr1.bin intarr1b.bin intarr1.ihex intarr1.srec intarr1.tekhex intarr2.bin intarr2b.bin intarr2.ihex intarr2.srec intarr2.tekhex intstr1.bin intstr1b.bin intstr1.ihex intstr1.srec intstr1.tekhex intstr2.bin intstr2b.bin intstr2.ihex intstr2.srec intstr2.tekhex intarr3.srec" | |
70 | ||
71 | # Test help (FIXME:) | |
72 | ||
73 | # Run target program until data structs are initialized. | |
74 | ||
75 | if { ! [ runto checkpoint1 ] } then { | |
b60f0898 JB |
76 | untested dump.exp |
77 | return -1 | |
dd7dfd64 MS |
78 | } |
79 | ||
1ab80e5b MR |
80 | # Get the endianness for the later use with endianless formats. |
81 | ||
82 | send_gdb "show endian\n" | |
83 | gdb_expect { | |
84 | -re ".* (big|little) endian.*$gdb_prompt $" { | |
85 | set endian $expect_out(1,string) | |
86 | pass "endianness: $endian" | |
87 | } | |
88 | default { | |
89 | fail "(timeout) getting target endianness" | |
90 | } | |
91 | } | |
92 | ||
dd7dfd64 MS |
93 | # Now generate some dump files. |
94 | ||
95 | proc make_dump_file { command msg } { | |
96 | global gdb_prompt | |
97 | ||
98 | send_gdb "${command}\n" | |
99 | gdb_expect { | |
100 | -re ".*\[Ee\]rror.*$gdb_prompt $" { fail $msg } | |
101 | -re ".*\[Ww\]arning.*$gdb_prompt $" { fail $msg } | |
102 | -re ".*\[Uu\]ndefined .*$gdb_prompt $" { fail $msg } | |
103 | -re ".*$gdb_prompt $" { pass $msg } | |
104 | timeout { fail "$msg (timeout)" } | |
105 | } | |
106 | } | |
107 | ||
108 | make_dump_file "dump val intarr1.bin intarray" \ | |
109 | "dump array as value, default" | |
110 | ||
111 | make_dump_file "dump val intstr1.bin intstruct" \ | |
112 | "dump struct as value, default" | |
113 | ||
114 | make_dump_file "dump bin val intarr1b.bin intarray" \ | |
115 | "dump array as value, binary" | |
116 | ||
117 | make_dump_file "dump bin val intstr1b.bin intstruct" \ | |
118 | "dump struct as value, binary" | |
119 | ||
120 | make_dump_file "dump srec val intarr1.srec intarray" \ | |
121 | "dump array as value, srec" | |
122 | ||
123 | make_dump_file "dump srec val intstr1.srec intstruct" \ | |
124 | "dump struct as value, srec" | |
125 | ||
126 | make_dump_file "dump ihex val intarr1.ihex intarray" \ | |
127 | "dump array as value, intel hex" | |
128 | ||
129 | make_dump_file "dump ihex val intstr1.ihex intstruct" \ | |
130 | "dump struct as value, intel hex" | |
131 | ||
132 | make_dump_file "dump tekhex val intarr1.tekhex intarray" \ | |
133 | "dump array as value, tekhex" | |
134 | ||
135 | make_dump_file "dump tekhex val intstr1.tekhex intstruct" \ | |
136 | "dump struct as value, tekhex" | |
137 | ||
8d394f98 | 138 | proc capture_value { expression args } { |
dd7dfd64 MS |
139 | global gdb_prompt |
140 | global expect_out | |
141 | ||
142 | set output_string "" | |
8d394f98 AC |
143 | if {[llength $args] > 0} { |
144 | # Convert $args into a simple string. | |
145 | set test "[join $args]; capture $expression" | |
146 | } { | |
147 | set test "capture $expression" | |
148 | } | |
149 | gdb_test_multiple "print ${expression}" "$test" { | |
150 | -re "\\$\[0-9\]+ = (\[^\r\n\]+).*$gdb_prompt $" { | |
151 | set output_string "$expect_out(1,string)" | |
152 | pass "$test" | |
dd7dfd64 | 153 | } |
8d394f98 AC |
154 | -re "(Cannot access memory at address \[^\r\n\]+).*$gdb_prompt $" { |
155 | # Even a failed value is valid | |
156 | set output_string "$expect_out(1,string)" | |
157 | pass "$test" | |
dd7dfd64 MS |
158 | } |
159 | } | |
160 | return $output_string | |
161 | } | |
162 | ||
163 | set array_start [capture_value "/x &intarray\[0\]"] | |
164 | set array_end [capture_value "/x &intarray\[32\]"] | |
165 | set struct_start [capture_value "/x &intstruct"] | |
166 | set struct_end [capture_value "/x &intstruct + 1"] | |
167 | ||
168 | set array_val [capture_value "intarray"] | |
169 | set struct_val [capture_value "intstruct"] | |
170 | ||
171 | make_dump_file "dump mem intarr2.bin $array_start $array_end" \ | |
172 | "dump array as memory, default" | |
173 | ||
174 | make_dump_file "dump mem intstr2.bin $struct_start $struct_end" \ | |
175 | "dump struct as memory, default" | |
176 | ||
177 | make_dump_file "dump bin mem intarr2b.bin $array_start $array_end" \ | |
178 | "dump array as memory, binary" | |
179 | ||
180 | make_dump_file "dump bin mem intstr2b.bin $struct_start $struct_end" \ | |
181 | "dump struct as memory, binary" | |
182 | ||
183 | make_dump_file "dump srec mem intarr2.srec $array_start $array_end" \ | |
184 | "dump array as memory, srec" | |
185 | ||
186 | make_dump_file "dump srec mem intstr2.srec $struct_start $struct_end" \ | |
187 | "dump struct as memory, srec" | |
188 | ||
189 | make_dump_file "dump ihex mem intarr2.ihex $array_start $array_end" \ | |
190 | "dump array as memory, ihex" | |
191 | ||
192 | make_dump_file "dump ihex mem intstr2.ihex $struct_start $struct_end" \ | |
193 | "dump struct as memory, ihex" | |
194 | ||
195 | make_dump_file "dump tekhex mem intarr2.tekhex $array_start $array_end" \ | |
196 | "dump array as memory, tekhex" | |
197 | ||
198 | make_dump_file "dump tekhex mem intstr2.tekhex $struct_start $struct_end" \ | |
199 | "dump struct as memory, tekhex" | |
200 | ||
201 | # test complex expressions | |
202 | make_dump_file \ | |
203 | "dump srec mem intarr3.srec &intarray \(char *\) &intarray + sizeof intarray" \ | |
204 | "dump array as mem, srec, expressions" | |
205 | ||
206 | ||
207 | # Now start a fresh gdb session, and reload the saved value files. | |
208 | ||
209 | gdb_exit | |
210 | gdb_start | |
211 | gdb_file_cmd ${binfile} | |
212 | ||
1ab80e5b MR |
213 | # Now fix the endianness at the correct state. |
214 | ||
215 | send_gdb "set endian $endian\n" | |
216 | gdb_expect { | |
217 | -re ".* (big|little) endian.*$gdb_prompt $" { | |
218 | pass "setting $endian endianness" | |
219 | } | |
220 | default { | |
221 | fail "(timeout) setting $endian endianness" | |
222 | } | |
223 | } | |
224 | ||
dd7dfd64 MS |
225 | # Reload saved values one by one, and compare. |
226 | ||
8d394f98 AC |
227 | if { ![string compare $array_val \ |
228 | [capture_value "intarray" "file binfile"]] } then { | |
dd7dfd64 MS |
229 | fail "start with intarray un-initialized" |
230 | } else { | |
231 | pass "start with intarray un-initialized" | |
232 | } | |
233 | ||
8d394f98 AC |
234 | if { ![string compare $struct_val \ |
235 | [capture_value "intstruct" "file binfile"]] } then { | |
dd7dfd64 MS |
236 | fail "start with intstruct un-initialized" |
237 | } else { | |
238 | pass "start with intstruct un-initialized" | |
239 | } | |
240 | ||
241 | proc test_reload_saved_value { filename msg oldval newval } { | |
242 | global gdb_prompt | |
243 | ||
244 | gdb_file_cmd $filename | |
8d394f98 AC |
245 | if { ![string compare $oldval \ |
246 | [capture_value $newval "$msg"]] } then { | |
247 | pass "$msg; value restored ok" | |
dd7dfd64 | 248 | } else { |
8d394f98 | 249 | fail "$msg; value restored ok" |
dd7dfd64 MS |
250 | } |
251 | } | |
252 | ||
253 | proc test_restore_saved_value { restore_args msg oldval newval } { | |
254 | global gdb_prompt | |
255 | ||
256 | gdb_test "restore $restore_args" \ | |
8d394f98 AC |
257 | "Restoring .*" \ |
258 | "$msg; file restored ok" | |
259 | if { ![string compare $oldval \ | |
260 | [capture_value $newval "$msg"]] } then { | |
261 | pass "$msg; value restored ok" | |
dd7dfd64 | 262 | } else { |
8d394f98 | 263 | fail "$msg; value restored ok" |
dd7dfd64 MS |
264 | } |
265 | } | |
266 | ||
f31dfe3b JJ |
267 | # srec format can not be loaded for 64-bit-only platforms |
268 | if ![string compare $is64bitonly "no"] then { | |
269 | test_reload_saved_value "intarr1.srec" "reload array as value, srec" \ | |
dd7dfd64 | 270 | $array_val "intarray" |
f31dfe3b | 271 | test_reload_saved_value "intstr1.srec" "reload struct as value, srec" \ |
dd7dfd64 | 272 | $struct_val "intstruct" |
f31dfe3b | 273 | test_reload_saved_value "intarr2.srec" "reload array as memory, srec" \ |
dd7dfd64 | 274 | $array_val "intarray" |
f31dfe3b | 275 | test_reload_saved_value "intstr2.srec" "reload struct as memory, srec" \ |
dd7dfd64 | 276 | $struct_val "intstruct" |
f31dfe3b JJ |
277 | } |
278 | ||
279 | # ihex format can not be loaded for 64-bit-only platforms | |
280 | if ![string compare $is64bitonly "no"] then { | |
dd7dfd64 | 281 | |
f31dfe3b | 282 | test_reload_saved_value "intarr1.ihex" "reload array as value, intel hex" \ |
dd7dfd64 | 283 | $array_val "intarray" |
f31dfe3b | 284 | test_reload_saved_value "intstr1.ihex" "reload struct as value, intel hex" \ |
dd7dfd64 | 285 | $struct_val "intstruct" |
f31dfe3b | 286 | test_reload_saved_value "intarr2.ihex" "reload array as memory, intel hex" \ |
dd7dfd64 | 287 | $array_val "intarray" |
f31dfe3b | 288 | test_reload_saved_value "intstr2.ihex" "reload struct as memory, intel hex" \ |
dd7dfd64 | 289 | $struct_val "intstruct" |
f31dfe3b | 290 | } |
dd7dfd64 | 291 | |
f31dfe3b JJ |
292 | # tekhex format can not be loaded for 64-bit-only platforms |
293 | if ![string compare $is64bitonly "no"] then { | |
294 | test_reload_saved_value "intarr1.tekhex" "reload array as value, tekhex" \ | |
dd7dfd64 | 295 | $array_val "intarray" |
f31dfe3b | 296 | test_reload_saved_value "intstr1.tekhex" "reload struct as value, tekhex" \ |
dd7dfd64 | 297 | $struct_val "intstruct" |
f31dfe3b | 298 | test_reload_saved_value "intarr2.tekhex" "reload array as memory, tekhex" \ |
dd7dfd64 | 299 | $array_val "intarray" |
f31dfe3b | 300 | test_reload_saved_value "intstr2.tekhex" "reload struct as memory, tekhex" \ |
dd7dfd64 | 301 | $struct_val "intstruct" |
f31dfe3b | 302 | } |
dd7dfd64 MS |
303 | |
304 | # Start a fresh gdb session | |
305 | ||
306 | gdb_exit | |
307 | gdb_start | |
308 | gdb_reinitialize_dir $srcdir/$subdir | |
309 | gdb_load ${binfile} | |
310 | ||
311 | # Run to main. | |
3ad13771 | 312 | if { ! [ runto_main ] } then { |
b60f0898 JB |
313 | untested dump.exp |
314 | return -1 | |
dd7dfd64 MS |
315 | } |
316 | ||
8d394f98 AC |
317 | if { ![string compare $array_val \ |
318 | [capture_value "intarray" "load binfile"]] } then { | |
dd7dfd64 MS |
319 | fail "start with intarray un-initialized, runto main" |
320 | } else { | |
321 | pass "start with intarray un-initialized, runto main" | |
322 | } | |
323 | ||
8d394f98 AC |
324 | if { ![string compare $struct_val \ |
325 | [capture_value "intstruct" "load binfile"]] } then { | |
dd7dfd64 MS |
326 | fail "start with intstruct un-initialized, runto main" |
327 | } else { | |
328 | pass "start with intstruct un-initialized, runto main" | |
329 | } | |
330 | ||
f31dfe3b JJ |
331 | if ![string compare $is64bitonly "no"] then { |
332 | test_restore_saved_value "intarr1.srec" "array as value, srec" \ | |
dd7dfd64 MS |
333 | $array_val "intarray" |
334 | ||
f31dfe3b | 335 | test_restore_saved_value "intstr1.srec" "struct as value, srec" \ |
dd7dfd64 MS |
336 | $struct_val "intstruct" |
337 | ||
f31dfe3b | 338 | gdb_test "print zero_all ()" "void" "zero all" |
dd7dfd64 | 339 | |
f31dfe3b | 340 | test_restore_saved_value "intarr2.srec" "array as memory, srec" \ |
dd7dfd64 MS |
341 | $array_val "intarray" |
342 | ||
f31dfe3b | 343 | test_restore_saved_value "intstr2.srec" "struct as memory, srec" \ |
dd7dfd64 MS |
344 | $struct_val "intstruct" |
345 | ||
f31dfe3b | 346 | gdb_test "print zero_all ()" "" |
dd7dfd64 | 347 | |
f31dfe3b | 348 | test_restore_saved_value "intarr1.ihex" "array as value, ihex" \ |
dd7dfd64 MS |
349 | $array_val "intarray" |
350 | ||
f31dfe3b | 351 | test_restore_saved_value "intstr1.ihex" "struct as value, ihex" \ |
dd7dfd64 MS |
352 | $struct_val "intstruct" |
353 | ||
f31dfe3b | 354 | gdb_test "print zero_all ()" "" |
dd7dfd64 | 355 | |
f31dfe3b | 356 | test_restore_saved_value "intarr2.ihex" "array as memory, ihex" \ |
dd7dfd64 MS |
357 | $array_val "intarray" |
358 | ||
f31dfe3b | 359 | test_restore_saved_value "intstr2.ihex" "struct as memory, ihex" \ |
dd7dfd64 MS |
360 | $struct_val "intstruct" |
361 | ||
f31dfe3b | 362 | gdb_test "print zero_all ()" "" |
dd7dfd64 | 363 | |
f31dfe3b | 364 | test_restore_saved_value "intarr1.tekhex" "array as value, tekhex" \ |
dd7dfd64 MS |
365 | $array_val "intarray" |
366 | ||
f31dfe3b | 367 | test_restore_saved_value "intstr1.tekhex" "struct as value, tekhex" \ |
dd7dfd64 MS |
368 | $struct_val "intstruct" |
369 | ||
f31dfe3b | 370 | gdb_test "print zero_all ()" "" |
dd7dfd64 | 371 | |
f31dfe3b | 372 | test_restore_saved_value "intarr2.tekhex" "array as memory, tekhex" \ |
dd7dfd64 MS |
373 | $array_val "intarray" |
374 | ||
f31dfe3b | 375 | test_restore_saved_value "intstr2.tekhex" "struct as memory, tekhex" \ |
dd7dfd64 | 376 | $struct_val "intstruct" |
f31dfe3b | 377 | } |
dd7dfd64 MS |
378 | |
379 | gdb_test "print zero_all ()" "" | |
380 | ||
381 | test_restore_saved_value "intarr1.bin binary $array_start" \ | |
382 | "array as value, binary" \ | |
383 | $array_val "intarray" | |
384 | ||
385 | test_restore_saved_value "intstr1.bin binary $struct_start" \ | |
386 | "struct as value, binary" \ | |
387 | $struct_val "intstruct" | |
388 | ||
389 | gdb_test "print zero_all ()" "" | |
390 | ||
391 | test_restore_saved_value "intarr2.bin binary $array_start" \ | |
392 | "array as memory, binary" \ | |
393 | $array_val "intarray" | |
394 | ||
395 | test_restore_saved_value "intstr2.bin binary $struct_start" \ | |
396 | "struct as memory, binary" \ | |
397 | $struct_val "intstruct" | |
398 | ||
399 | # test restore with offset. | |
400 | ||
401 | set array2_start [capture_value "/x &intarray2\[0\]"] | |
402 | set struct2_start [capture_value "/x &intstruct2"] | |
403 | set array2_offset \ | |
2db536a1 | 404 | [capture_value "(char *) &intarray2 - (char *) &intarray"] |
dd7dfd64 | 405 | set struct2_offset \ |
2db536a1 | 406 | [capture_value "(char *) &intstruct2 - (char *) &intstruct"] |
dd7dfd64 MS |
407 | |
408 | gdb_test "print zero_all ()" "" | |
409 | ||
f31dfe3b JJ |
410 | |
411 | if ![string compare $is64bitonly "no"] then { | |
412 | test_restore_saved_value "intarr1.srec $array2_offset" \ | |
dd7dfd64 MS |
413 | "array copy, srec" \ |
414 | $array_val "intarray2" | |
415 | ||
f31dfe3b | 416 | test_restore_saved_value "intstr1.srec $struct2_offset" \ |
dd7dfd64 MS |
417 | "struct copy, srec" \ |
418 | $struct_val "intstruct2" | |
419 | ||
f31dfe3b | 420 | gdb_test "print zero_all ()" "" |
dd7dfd64 | 421 | |
f31dfe3b | 422 | test_restore_saved_value "intarr1.ihex $array2_offset" \ |
dd7dfd64 MS |
423 | "array copy, ihex" \ |
424 | $array_val "intarray2" | |
425 | ||
f31dfe3b | 426 | test_restore_saved_value "intstr1.ihex $struct2_offset" \ |
dd7dfd64 MS |
427 | "struct copy, ihex" \ |
428 | $struct_val "intstruct2" | |
429 | ||
f31dfe3b | 430 | gdb_test "print zero_all ()" "" |
dd7dfd64 | 431 | |
f31dfe3b | 432 | test_restore_saved_value "intarr1.tekhex $array2_offset" \ |
dd7dfd64 MS |
433 | "array copy, tekhex" \ |
434 | $array_val "intarray2" | |
435 | ||
f31dfe3b | 436 | test_restore_saved_value "intstr1.tekhex $struct2_offset" \ |
dd7dfd64 MS |
437 | "struct copy, tekhex" \ |
438 | $struct_val "intstruct2" | |
f31dfe3b | 439 | } |
dd7dfd64 MS |
440 | |
441 | gdb_test "print zero_all ()" "" | |
442 | ||
443 | test_restore_saved_value "intarr1.bin binary $array2_start" \ | |
444 | "array copy, binary" \ | |
445 | $array_val "intarray2" | |
446 | ||
447 | test_restore_saved_value "intstr1.bin binary $struct2_start" \ | |
448 | "struct copy, binary" \ | |
449 | $struct_val "intstruct2" | |
450 | ||
451 | # | |
452 | # test restore with start/stop addresses. | |
453 | # | |
454 | # For this purpose, we will restore just the third element of the array, | |
455 | # and check to see that adjacent elements are not modified. | |
456 | # | |
457 | # We will need the address and offset of the third and fourth elements. | |
458 | # | |
459 | ||
460 | set element3_start [capture_value "/x &intarray\[3\]"] | |
461 | set element4_start [capture_value "/x &intarray\[4\]"] | |
462 | set element3_offset \ | |
463 | [capture_value "/x (char *) &intarray\[3\] - (char *) &intarray\[0\]"] | |
464 | set element4_offset \ | |
465 | [capture_value "/x (char *) &intarray\[4\] - (char *) &intarray\[0\]"] | |
466 | ||
f31dfe3b JJ |
467 | if ![string compare $is64bitonly "no"] then { |
468 | gdb_test "print zero_all ()" "" | |
dd7dfd64 | 469 | |
f31dfe3b | 470 | test_restore_saved_value "intarr1.srec 0 $element3_start $element4_start" \ |
8d394f98 | 471 | "array partial, srec" 4 "intarray\[3\]" |
dd7dfd64 | 472 | |
f31dfe3b JJ |
473 | gdb_test "print intarray\[2\] == 0" " = 1" "element 2 not changed - 1" |
474 | gdb_test "print intarray\[4\] == 0" " = 1" "element 4 not changed - 1" | |
dd7dfd64 | 475 | |
f31dfe3b | 476 | gdb_test "print zero_all ()" "" |
dd7dfd64 | 477 | |
f31dfe3b | 478 | test_restore_saved_value "intarr1.ihex 0 $element3_start $element4_start" \ |
8d394f98 | 479 | "array partial, ihex" 4 "intarray\[3\]" |
dd7dfd64 | 480 | |
f31dfe3b JJ |
481 | gdb_test "print intarray\[2\] == 0" " = 1" "element 2 not changed - 2" |
482 | gdb_test "print intarray\[4\] == 0" " = 1" "element 4 not changed - 2" | |
dd7dfd64 | 483 | |
f31dfe3b | 484 | gdb_test "print zero_all ()" "" |
dd7dfd64 | 485 | |
f31dfe3b | 486 | test_restore_saved_value "intarr1.tekhex 0 $element3_start $element4_start" \ |
8d394f98 | 487 | "array partial, tekhex" 4 "intarray\[3\]" |
dd7dfd64 | 488 | |
f31dfe3b JJ |
489 | gdb_test "print intarray\[2\] == 0" " = 1" "element 2 not changed - 3" |
490 | gdb_test "print intarray\[4\] == 0" " = 1" "element 4 not changed - 3" | |
491 | } | |
dd7dfd64 MS |
492 | |
493 | gdb_test "print zero_all ()" "" | |
494 | ||
495 | test_restore_saved_value \ | |
496 | "intarr1.bin binary $array_start $element3_offset $element4_offset" \ | |
8d394f98 | 497 | "array partial, binary" 4 "intarray\[3\]" |
dd7dfd64 MS |
498 | |
499 | gdb_test "print intarray\[2\] == 0" " = 1" "element 2 not changed - 4" | |
500 | gdb_test "print intarray\[4\] == 0" " = 1" "element 4 not changed - 4" | |
501 | ||
f31dfe3b JJ |
502 | if ![string compare $is64bitonly "no"] then { |
503 | gdb_test "print zero_all ()" "" "" | |
dd7dfd64 | 504 | |
f31dfe3b JJ |
505 | # restore with expressions |
506 | test_restore_saved_value \ | |
dd7dfd64 | 507 | "intarr3.srec ${array2_start}-${array_start} &intarray\[3\] &intarray\[4\]" \ |
8d394f98 | 508 | "array partial with expressions" 4 "intarray2\[3\]" |
dd7dfd64 | 509 | |
f31dfe3b JJ |
510 | gdb_test "print intarray2\[2\] == 0" " = 1" "element 2 not changed, == 4" |
511 | gdb_test "print intarray2\[4\] == 0" " = 1" "element 4 not changed, == 4" | |
512 | } | |
dd7dfd64 MS |
513 | |
514 | # clean up files | |
515 | ||
516 | remote_exec build "rm -f intarr1.bin intarr1b.bin intarr1.ihex intarr1.srec intarr1.tekhex intarr2.bin intarr2b.bin intarr2.ihex intarr2.srec intarr2.tekhex intstr1.bin intstr1b.bin intstr1.ihex intstr1.srec intstr1.tekhex intstr2.bin intstr2b.bin intstr2.ihex intstr2.srec intstr2.tekhex intarr3.srec" |