37 |
proc gdb_comm_delete_breakpoints {} { |
proc gdb_comm_delete_breakpoints {} { |
38 |
global gdb_prompt |
global gdb_prompt |
39 |
|
|
40 |
remote_send host "delete breakpoints\n"; |
remote_send host "delete breakpoints\n" |
41 |
remote_expect host 10 { |
remote_expect host 10 { |
42 |
-re "Delete all breakpoints.*y or n. $" { |
-re "Delete all breakpoints.*y or n. $" { |
43 |
remote_send host "y\n" |
remote_send host "y\n" |
52 |
-re ".*$gdb_prompt $" { perror "breakpoints not deleted" ; return -1} |
-re ".*$gdb_prompt $" { perror "breakpoints not deleted" ; return -1} |
53 |
timeout { perror "info breakpoints (timeout)" ; return -1} |
timeout { perror "info breakpoints (timeout)" ; return -1} |
54 |
} |
} |
55 |
return 0; |
return 0 |
56 |
} |
} |
57 |
|
|
58 |
# |
# |
70 |
# The "file" command loads up a new symbol file for gdb, deal with |
# The "file" command loads up a new symbol file for gdb, deal with |
71 |
# the various messages it might spew out. |
# the various messages it might spew out. |
72 |
if [is_remote host] { |
if [is_remote host] { |
73 |
set arg [remote_download host $arg a.out]; |
set arg [remote_download host $arg a.out] |
74 |
} |
} |
75 |
remote_send host "file $arg\n" |
remote_send host "file $arg\n" |
76 |
remote_expect host 60 { |
remote_expect host 60 { |
120 |
return -1 |
return -1 |
121 |
} |
} |
122 |
} |
} |
123 |
return 0; |
return 0 |
124 |
} |
} |
125 |
|
|
126 |
# Disconnect from the target and forget that we have an executable. Returns |
# Disconnect from the target and forget that we have an executable. Returns |
127 |
# -1 on failure, 0 on success. |
# -1 on failure, 0 on success. |
128 |
|
|
129 |
proc gdb_comm_go_idle { } { |
proc gdb_comm_go_idle { } { |
130 |
global gdb_prompt; |
global gdb_prompt |
131 |
|
|
132 |
if ![board_info host exists fileid] { |
if ![board_info host exists fileid] { |
133 |
return -1; |
return -1 |
134 |
} |
} |
135 |
|
|
136 |
remote_send host "target exec\n"; |
remote_send host "target exec\n" |
137 |
remote_expect host 10 { |
remote_expect host 10 { |
138 |
-re "Kill it.*y or n.*$" { |
-re "Kill it.*y or n.*$" { |
139 |
remote_send host "y\n" |
remote_send host "y\n" |
140 |
exp_continue; |
exp_continue |
141 |
} |
} |
142 |
-re "No exec.* file now.*$gdb_prompt $" { |
-re "No exec.* file now.*$gdb_prompt $" { |
143 |
return 0; |
return 0 |
144 |
} |
} |
145 |
default { |
default { |
146 |
remote_close host; |
remote_close host |
147 |
return -1; |
return -1 |
148 |
} |
} |
149 |
} |
} |
150 |
} |
} |
160 |
if ![board_info $dest exists gdb_prompt] then { |
if ![board_info $dest exists gdb_prompt] then { |
161 |
set gdb_prompt "\\(gdb\\)" |
set gdb_prompt "\\(gdb\\)" |
162 |
} else { |
} else { |
163 |
set gdb_prompt [board_info $dest gdb_prompt]; |
set gdb_prompt [board_info $dest gdb_prompt] |
164 |
} |
} |
165 |
# Similarly for GDB. Look in the object directory for gdb if we aren't |
# Similarly for GDB. Look in the object directory for gdb if we aren't |
166 |
# provided with one. |
# provided with one. |
171 |
} |
} |
172 |
} |
} |
173 |
if [board_info host exists gdb_opts] { |
if [board_info host exists gdb_opts] { |
174 |
set gdb_opts [board_info host gdb_opts]; |
set gdb_opts [board_info host gdb_opts] |
175 |
} else { |
} else { |
176 |
set gdb_opts "" |
set gdb_opts "" |
177 |
} |
} |
178 |
# Start up gdb (no startfiles, no windows) and wait for a prompt. |
# Start up gdb (no startfiles, no windows) and wait for a prompt. |
179 |
remote_spawn host "$GDB $gdb_opts -nw -nx"; |
remote_spawn host "$GDB $gdb_opts -nw -nx" |
180 |
remote_expect host 60 { |
remote_expect host 60 { |
181 |
-re ".*$gdb_prompt $" { } |
-re ".*$gdb_prompt $" { } |
182 |
} |
} |
183 |
remote_send host "set height 0\n"; |
remote_send host "set height 0\n" |
184 |
remote_expect host 10 { |
remote_expect host 10 { |
185 |
-re ".*$gdb_prompt $" {} |
-re ".*$gdb_prompt $" {} |
186 |
} |
} |
187 |
remote_send host "set width 0\n"; |
remote_send host "set width 0\n" |
188 |
remote_expect host 10 { |
remote_expect host 10 { |
189 |
-re ".*$gdb_prompt $" {} |
-re ".*$gdb_prompt $" {} |
190 |
} |
} |
211 |
# |
# |
212 |
|
|
213 |
proc quit_gdb { } { |
proc quit_gdb { } { |
214 |
global gdb_prompt; |
global gdb_prompt |
215 |
|
|
216 |
set spawn_id [board_info host fileid]; |
set spawn_id [board_info host fileid] |
217 |
|
|
218 |
if { $spawn_id != "" && $spawn_id > -1 } { |
if { $spawn_id != "" && $spawn_id > -1 } { |
219 |
if { [remote_send host "quit\n"] == "" } { |
if { [remote_send host "quit\n"] == "" } { |
220 |
remote_expect host 10 { |
remote_expect host 10 { |
221 |
-re ".*y or n.*$" { |
-re ".*y or n.*$" { |
222 |
remote_send host "y\n"; |
remote_send host "y\n" |
223 |
exp_continue; |
exp_continue |
224 |
} |
} |
225 |
-re ".*\[*\]\[*\]\[*\].*EXIT code" { } |
-re ".*\[*\]\[*\]\[*\].*EXIT code" { } |
226 |
default { } |
default { } |
228 |
} |
} |
229 |
} |
} |
230 |
if ![is_remote host] { |
if ![is_remote host] { |
231 |
remote_close host; |
remote_close host |
232 |
} |
} |
233 |
} |
} |
234 |
|
|
235 |
proc gdb_comm_leave { } { |
proc gdb_comm_leave { } { |
236 |
if [is_remote host] { |
if [is_remote host] { |
237 |
quit_gdb; |
quit_gdb |
238 |
} else { |
} else { |
239 |
gdb_comm_go_idle; |
gdb_comm_go_idle |
240 |
} |
} |
241 |
} |
} |
242 |
# |
# |
255 |
|
|
256 |
for { set x 0; } { $x < [llength $args] } { incr x } { |
for { set x 0; } { $x < [llength $args] } { incr x } { |
257 |
if { [lindex $args $x] != "" } { |
if { [lindex $args $x] != "" } { |
258 |
return [list "unsupported" "no support for [lindex $argnames $x] on this target"]; |
return [list "unsupported" "no support for [lindex $argnames $x] on this target"] |
259 |
} |
} |
260 |
} |
} |
261 |
# Make sure the file we're supposed to load really exists. |
# Make sure the file we're supposed to load really exists. |
262 |
if ![file exists $prog] then { |
if ![file exists $prog] then { |
263 |
perror "$prog does not exist." |
perror "$prog does not exist." |
264 |
return [list "untested" ""]; |
return [list "untested" ""] |
265 |
} |
} |
266 |
|
|
267 |
if { [is_remote host] || ![board_info host exists fileid] } { |
if { [is_remote host] || ![board_info host exists fileid] } { |
268 |
gdb_comm_start $dest; |
gdb_comm_start $dest |
269 |
} |
} |
270 |
|
|
271 |
# Remove all breakpoints, then tell the debugger that we have |
# Remove all breakpoints, then tell the debugger that we have |
272 |
# new exec file. |
# new exec file. |
273 |
if { [gdb_comm_delete_breakpoints] != 0 } { |
if { [gdb_comm_delete_breakpoints] != 0 } { |
274 |
gdb_comm_leave; |
gdb_comm_leave |
275 |
return [gdb_comm_reload $dest $prog $args]; |
return [gdb_comm_reload $dest $prog $args] |
276 |
} |
} |
277 |
if { [gdb_comm_file_cmd $prog] != 0 } { |
if { [gdb_comm_file_cmd $prog] != 0 } { |
278 |
gdb_comm_leave; |
gdb_comm_leave |
279 |
return [gdb_comm_reload $dest $prog $args]; |
return [gdb_comm_reload $dest $prog $args] |
280 |
} |
} |
281 |
if [board_info $dest exists gdb_sect_offset] { |
if [board_info $dest exists gdb_sect_offset] { |
282 |
set textoff [board_info $dest gdb_sect_offset]; |
set textoff [board_info $dest gdb_sect_offset] |
283 |
remote_send host "sect .text $textoff\n"; |
remote_send host "sect .text $textoff\n" |
284 |
remote_expect host 10 { |
remote_expect host 10 { |
285 |
-re "(0x\[0-9a-z]+) - 0x\[0-9a-z\]+ is \\.data" { |
-re "(0x\[0-9a-z]+) - 0x\[0-9a-z\]+ is \\.data" { |
286 |
set dataoff $expect_out(1,string); |
set dataoff $expect_out(1,string) |
287 |
exp_continue; |
exp_continue |
288 |
} |
} |
289 |
-re "(0x\[0-9a-z\]+) - 0x\[0-9a-z\]+ is \\.bss" { |
-re "(0x\[0-9a-z\]+) - 0x\[0-9a-z\]+ is \\.bss" { |
290 |
set bssoff $expect_out(1,string); |
set bssoff $expect_out(1,string) |
291 |
exp_continue; |
exp_continue |
292 |
} |
} |
293 |
-re "$gdb_prompt" { } |
-re "$gdb_prompt" { } |
294 |
} |
} |
295 |
set dataoff [format 0x%x [expr $dataoff + $textoff]]; |
set dataoff [format 0x%x [expr $dataoff + $textoff]] |
296 |
set bssoff [format 0x%x [expr $bssoff + $textoff]]; |
set bssoff [format 0x%x [expr $bssoff + $textoff]] |
297 |
remote_send host "sect .data $dataoff\n"; |
remote_send host "sect .data $dataoff\n" |
298 |
remote_expect host 10 { |
remote_expect host 10 { |
299 |
-re "$gdb_prompt" { } |
-re "$gdb_prompt" { } |
300 |
} |
} |
301 |
remote_send host "sect .bss $bssoff\n"; |
remote_send host "sect .bss $bssoff\n" |
302 |
remote_expect host 10 { |
remote_expect host 10 { |
303 |
-re "$gdb_prompt" { } |
-re "$gdb_prompt" { } |
304 |
} |
} |
310 |
# use printf to indicate pass/fail status. |
# use printf to indicate pass/fail status. |
311 |
|
|
312 |
if { [gdb_comm_add_breakpoint _exit] != "" } { |
if { [gdb_comm_add_breakpoint _exit] != "" } { |
313 |
gdb_comm_add_breakpoint exit; |
gdb_comm_add_breakpoint exit |
314 |
} |
} |
315 |
gdb_comm_add_breakpoint abort; |
gdb_comm_add_breakpoint abort |
316 |
|
|
317 |
set protocol [board_info $dest gdb_protocol]; |
set protocol [board_info $dest gdb_protocol] |
318 |
if [board_info $dest exists gdb_serial] { |
if [board_info $dest exists gdb_serial] { |
319 |
set targetname [board_info $dest gdb_serial]; |
set targetname [board_info $dest gdb_serial] |
320 |
} elseif [board_info $dest exists netport] { |
} elseif [board_info $dest exists netport] { |
321 |
set targetname [board_info $dest netport]; |
set targetname [board_info $dest netport] |
322 |
} else { |
} else { |
323 |
if [board_info $dest exists serial] { |
if [board_info $dest exists serial] { |
324 |
set targetname [board_info $dest serial]; |
set targetname [board_info $dest serial] |
325 |
} else { |
} else { |
326 |
set targetname "" |
set targetname "" |
327 |
} |
} |
331 |
remote_expect host 10 { |
remote_expect host 10 { |
332 |
-re ".*$gdb_prompt $" {} |
-re ".*$gdb_prompt $" {} |
333 |
default { |
default { |
334 |
warning "failed setting baud rate"; |
warning "failed setting baud rate" |
335 |
} |
} |
336 |
} |
} |
337 |
} |
} |
338 |
remote_send host "target $protocol $targetname\n"; |
remote_send host "target $protocol $targetname\n" |
339 |
remote_expect host 60 { |
remote_expect host 60 { |
340 |
-re "Couldn.t establish conn.*$gdb_prompt $" { |
-re "Couldn.t establish conn.*$gdb_prompt $" { |
341 |
warning "Unable to connect to $targetname with GDB." |
warning "Unable to connect to $targetname with GDB." |
342 |
quit_gdb; |
quit_gdb |
343 |
return [gdb_comm_reload $dest $prog $args] |
return [gdb_comm_reload $dest $prog $args] |
344 |
} |
} |
345 |
-re "Ending remote.*$gdb_prompt $" { |
-re "Ending remote.*$gdb_prompt $" { |
346 |
warning "Unable to connect to $targetname with GDB." |
warning "Unable to connect to $targetname with GDB." |
347 |
quit_gdb; |
quit_gdb |
348 |
return [gdb_comm_reload $dest $prog $args] |
return [gdb_comm_reload $dest $prog $args] |
349 |
} |
} |
350 |
-re "Remote target $protocol connected to.*$gdb_prompt $" { } |
-re "Remote target $protocol connected to.*$gdb_prompt $" { } |
354 |
-re "Remote.*using $targetname.*$gdb_prompt $" { } |
-re "Remote.*using $targetname.*$gdb_prompt $" { } |
355 |
-re "$gdb_prompt $" { |
-re "$gdb_prompt $" { |
356 |
warning "Unable to connect to $targetname with GDB." |
warning "Unable to connect to $targetname with GDB." |
357 |
quit_gdb; |
quit_gdb |
358 |
return [gdb_comm_reload $dest $prog $args] |
return [gdb_comm_reload $dest $prog $args] |
359 |
} |
} |
360 |
-re ".*RDI_open.*should reset target.*" { |
-re ".*RDI_open.*should reset target.*" { |
361 |
warning "RDI Open Failed" |
warning "RDI Open Failed" |
362 |
quit_gdb; |
quit_gdb |
363 |
return [gdb_comm_reload $dest $prog $args] |
return [gdb_comm_reload $dest $prog $args] |
364 |
} |
} |
365 |
default { |
default { |
366 |
warning "Unable to connect to $targetname with GDB." |
warning "Unable to connect to $targetname with GDB." |
367 |
quit_gdb; |
quit_gdb |
368 |
return [gdb_comm_reload $dest $prog $args] |
return [gdb_comm_reload $dest $prog $args] |
369 |
} |
} |
370 |
} |
} |
371 |
|
|
372 |
if [target_info exists gdb_init_command] { |
if [target_info exists gdb_init_command] { |
373 |
remote_send host "[target_info gdb_init_command]\n"; |
remote_send host "[target_info gdb_init_command]\n" |
374 |
remote_expect host 10 { |
remote_expect host 10 { |
375 |
-re ".*$gdb_prompt $" { } |
-re ".*$gdb_prompt $" { } |
376 |
default { |
default { |
377 |
gdb_comm_leave; |
gdb_comm_leave |
378 |
return [list "fail" ""]; |
return [list "fail" ""] |
379 |
} |
} |
380 |
} |
} |
381 |
} |
} |
382 |
# Now download the executable to the target board. If communications |
# Now download the executable to the target board. If communications |
383 |
# with the target are very slow the timeout might need to be increased. |
# with the target are very slow the timeout might need to be increased. |
384 |
if [board_info $dest exists gdb_load_offset] { |
if [board_info $dest exists gdb_load_offset] { |
385 |
remote_send host "load $prog [board_info $dest gdb_load_offset]\n"; |
remote_send host "load $prog [board_info $dest gdb_load_offset]\n" |
386 |
} else { |
} else { |
387 |
remote_send host "load\n" |
remote_send host "load\n" |
388 |
} |
} |
391 |
-re "data.*text.*$gdb_prompt $" { } |
-re "data.*text.*$gdb_prompt $" { } |
392 |
-re "$gdb_prompt $" { |
-re "$gdb_prompt $" { |
393 |
warning "Unable to send program to target board." |
warning "Unable to send program to target board." |
394 |
gdb_comm_leave; |
gdb_comm_leave |
395 |
return [gdb_comm_reload $dest $prog $args]; |
return [gdb_comm_reload $dest $prog $args] |
396 |
} |
} |
397 |
default { |
default { |
398 |
warning "Unable to send program to target board." |
warning "Unable to send program to target board." |
399 |
gdb_comm_leave; |
gdb_comm_leave |
400 |
return [gdb_comm_reload $dest $prog $args]; |
return [gdb_comm_reload $dest $prog $args] |
401 |
} |
} |
402 |
} |
} |
403 |
|
|
407 |
# And a whole lot of other magic stuff too. |
# And a whole lot of other magic stuff too. |
408 |
|
|
409 |
if [board_info $dest exists gdb_run_command] { |
if [board_info $dest exists gdb_run_command] { |
410 |
remote_send host "[board_info $dest gdb_run_command]\n"; |
remote_send host "[board_info $dest gdb_run_command]\n" |
411 |
} else { |
} else { |
412 |
remote_send host "run\n" |
remote_send host "run\n" |
413 |
} |
} |
414 |
# FIXME: The value 300 below should be a parameter. |
# FIXME: The value 300 below should be a parameter. |
415 |
if [board_info $dest exists testcase_timeout] { |
if [board_info $dest exists testcase_timeout] { |
416 |
set testcase_timeout [board_info $dest testcase_timeout]; |
set testcase_timeout [board_info $dest testcase_timeout] |
417 |
} else { |
} else { |
418 |
set testcase_timeout 300; |
set testcase_timeout 300 |
419 |
} |
} |
420 |
remote_expect host $testcase_timeout { |
remote_expect host $testcase_timeout { |
421 |
-re "Line.*Jump anyway.*.y or n.*" { |
-re "Line.*Jump anyway.*.y or n.*" { |
422 |
remote_send host "y\n"; |
remote_send host "y\n" |
423 |
exp_continue; |
exp_continue |
424 |
} |
} |
425 |
-re "Continuing( at |\\.| with no signal\\.)\[^\r\n\]*\[\r\n\]" { |
-re "Continuing( at |\\.| with no signal\\.)\[^\r\n\]*\[\r\n\]" { |
426 |
exp_continue; |
exp_continue |
427 |
} |
} |
428 |
-re ".*Start it from the beginning?.*y or n.*" { |
-re ".*Start it from the beginning?.*y or n.*" { |
429 |
remote_send host "n\n"; |
remote_send host "n\n" |
430 |
remote_expect host 10 { |
remote_expect host 10 { |
431 |
-re ".*$gdb_prompt $" { |
-re ".*$gdb_prompt $" { |
432 |
remote_send host "signal 0\n"; |
remote_send host "signal 0\n" |
433 |
remote_expect host 10 { |
remote_expect host 10 { |
434 |
-re "signal 0\[\r\n\]+" { exp_continue; } |
-re "signal 0\[\r\n\]+" { exp_continue; } |
435 |
-re "Continuing(\\.| with no signal\\.)\[\r\n\]" {} |
-re "Continuing(\\.| with no signal\\.)\[\r\n\]" {} |
445 |
exp_continue |
exp_continue |
446 |
} |
} |
447 |
-re "(.*)Breakpoint.*exit.*=0.*$gdb_prompt $" { |
-re "(.*)Breakpoint.*exit.*=0.*$gdb_prompt $" { |
448 |
append output $expect_out(1,string); |
append output $expect_out(1,string) |
449 |
set result [check_for_board_status output]; |
set result [check_for_board_status output] |
450 |
gdb_comm_leave; |
gdb_comm_leave |
451 |
if { $result > 0 } { |
if { $result > 0 } { |
452 |
return [list "fail" $output]; |
return [list "fail" $output] |
453 |
} |
} |
454 |
return [list "pass" $output]; |
return [list "pass" $output] |
455 |
} |
} |
456 |
-re "(.*)Breakpoint.*exit.*=\[1-9\]\[0-9\]*.*$gdb_prompt $" { |
-re "(.*)Breakpoint.*exit.*=\[1-9\]\[0-9\]*.*$gdb_prompt $" { |
457 |
append output $expect_out(1,string); |
append output $expect_out(1,string) |
458 |
set result [check_for_board_status output]; |
set result [check_for_board_status output] |
459 |
gdb_comm_leave; |
gdb_comm_leave |
460 |
if { $result == 0 } { |
if { $result == 0 } { |
461 |
return [list "pass" $output]; |
return [list "pass" $output] |
462 |
} |
} |
463 |
if [board_info $dest exists exit_statuses_bad] { |
if [board_info $dest exists exit_statuses_bad] { |
464 |
return [list "pass" $output]; |
return [list "pass" $output] |
465 |
} |
} |
466 |
return [list "fail" $output]; |
return [list "fail" $output] |
467 |
} |
} |
468 |
-re "(.*)Breakpoint.*exit.*$gdb_prompt $" { |
-re "(.*)Breakpoint.*exit.*$gdb_prompt $" { |
469 |
append output $expect_out(1,string); |
append output $expect_out(1,string) |
470 |
set status [check_for_board_status output]; |
set status [check_for_board_status output] |
471 |
gdb_comm_leave; |
gdb_comm_leave |
472 |
if { $status > 0 } { |
if { $status > 0 } { |
473 |
return [list "fail" $output]; |
return [list "fail" $output] |
474 |
} |
} |
475 |
return [list "pass" $output]; |
return [list "pass" $output] |
476 |
} |
} |
477 |
-re "(.*)Breakpoint.*abort.*$gdb_prompt $" { |
-re "(.*)Breakpoint.*abort.*$gdb_prompt $" { |
478 |
append output $expect_out(1,string); |
append output $expect_out(1,string) |
479 |
check_for_board_status output; |
check_for_board_status output |
480 |
gdb_comm_leave; |
gdb_comm_leave |
481 |
return [list "fail" $output]; |
return [list "fail" $output] |
482 |
} |
} |
483 |
-re "SIGTRAP.*$gdb_prompt $" { |
-re "SIGTRAP.*$gdb_prompt $" { |
484 |
return [gdb_comm_reload $dest $prog $args]; |
return [gdb_comm_reload $dest $prog $args] |
485 |
} |
} |
486 |
-re "(.*)Program (received |terminated ).*$gdb_prompt $" { |
-re "(.*)Program (received |terminated ).*$gdb_prompt $" { |
487 |
set output $expect_out(1,string); |
set output $expect_out(1,string) |
488 |
check_for_board_status output; |
check_for_board_status output |
489 |
gdb_comm_leave; |
gdb_comm_leave |
490 |
remote_reboot $dest; |
remote_reboot $dest |
491 |
return [list "fail" $output]; |
return [list "fail" $output] |
492 |
} |
} |
493 |
-re "(.*)Program exited with code \[0-9\]+.*$gdb_prompt $" { |
-re "(.*)Program exited with code \[0-9\]+.*$gdb_prompt $" { |
494 |
set output $expect_out(1,string); |
set output $expect_out(1,string) |
495 |
set status [check_for_board_status output]; |
set status [check_for_board_status output] |
496 |
gdb_comm_leave; |
gdb_comm_leave |
497 |
if { $status > 0 } { |
if { $status > 0 } { |
498 |
return [list "fail" $output]; |
return [list "fail" $output] |
499 |
} |
} |
500 |
return [list "pass" $output]; |
return [list "pass" $output] |
501 |
} |
} |
502 |
default { |
default { |
503 |
gdb_comm_leave; |
gdb_comm_leave |
504 |
if [board_info $dest exists unreliable] { |
if [board_info $dest exists unreliable] { |
505 |
if { [board_info $dest unreliable] > 0 } { |
if { [board_info $dest unreliable] > 0 } { |
506 |
global board_info; |
global board_info |
507 |
set name [board_info $dest name]; |
set name [board_info $dest name] |
508 |
incr board_info($name,unreliable) -1; |
incr board_info($name,unreliable) -1 |
509 |
set result [gdb_comm_reload $dest $prog $args]; |
set result [gdb_comm_reload $dest $prog $args] |
510 |
incr board_info($name,unreliable); |
incr board_info($name,unreliable) |
511 |
return $result; |
return $result |
512 |
} |
} |
513 |
} |
} |
514 |
return [list "fail" ""]; |
return [list "fail" ""] |
515 |
} |
} |
516 |
} |
} |
517 |
gdb_comm_leave; |
gdb_comm_leave |
518 |
return [list "fail" ""]; |
return [list "fail" ""] |
519 |
} |
} |
520 |
|
|
521 |
# If we've tried less than 4 times to load PROG, reboot the target, restart GDB |
# If we've tried less than 4 times to load PROG, reboot the target, restart GDB |
522 |
# and try again. Otherwise, return "untested". |
# and try again. Otherwise, return "untested". |
523 |
proc gdb_comm_reload { dest prog aargs } { |
proc gdb_comm_reload { dest prog aargs } { |
524 |
global try_again; |
global try_again |
525 |
|
|
526 |
# how many times have we done this? |
# how many times have we done this? |
527 |
set n_reloads [board_info $dest n_reloads] |
set n_reloads [board_info $dest n_reloads] |
550 |
} |
} |
551 |
|
|
552 |
if { $try_again < 4 } { |
if { $try_again < 4 } { |
553 |
global GDB; |
global GDB |
554 |
remote_reboot $dest; |
remote_reboot $dest |
555 |
remote_close host; |
remote_close host |
556 |
incr try_again; |
incr try_again |
557 |
set result [eval remote_load \"$dest\" \"$prog\" $aargs] |
set result [eval remote_load \"$dest\" \"$prog\" $aargs] |
558 |
set try_again 0; |
set try_again 0 |
559 |
return "$result"; |
return "$result" |
560 |
} else { |
} else { |
561 |
set try_again 0; |
set try_again 0 |
562 |
return [list "untested" ""]; |
return [list "untested" ""] |
563 |
} |
} |
564 |
} |
} |
565 |
|
|
566 |
set_board_info protocol "gdb_comm"; |
set_board_info protocol "gdb_comm" |