diff options
author | Ben Elliston <bje@gnu.org> | 2003-08-07 03:42:42 +0000 |
---|---|---|
committer | Ben Elliston <bje@gnu.org> | 2003-08-07 03:42:42 +0000 |
commit | d7b7156075df25716082174f6baf2ac0e163e939 (patch) | |
tree | e2c4f9afdb89cf1e6f082acf7c1a0aae0fd423a8 /config | |
parent | 8f0d1b58dbfb8b4e7ad5c14f21d65da05a364200 (diff) | |
download | dejagnu-d7b7156075df25716082174f6baf2ac0e163e939.zip dejagnu-d7b7156075df25716082174f6baf2ac0e163e939.tar.gz dejagnu-d7b7156075df25716082174f6baf2ac0e163e939.tar.bz2 |
Strip trailing semicolons from Tcl source files.
Diffstat (limited to 'config')
41 files changed, 965 insertions, 965 deletions
diff --git a/config/arc.exp b/config/arc.exp index e9c3862..33c948e 100644 --- a/config/arc.exp +++ b/config/arc.exp @@ -17,4 +17,4 @@ # Please email any bugs, comments, and/or additions to this file to: # bug-dejagnu@gnu.org -load_generic_config "gdb-comm"; +load_generic_config "gdb-comm" diff --git a/config/arm-ice.exp b/config/arm-ice.exp index bd36fce..1affda1 100644 --- a/config/arm-ice.exp +++ b/config/arm-ice.exp @@ -17,4 +17,4 @@ # Please email any bugs, comments, and/or additions to this file to: # bug-dejagnu@gnu.org -load_generic_config "gdb-comm"; +load_generic_config "gdb-comm" diff --git a/config/base-config.exp b/config/base-config.exp index 53f98c9..dba347a 100644 --- a/config/base-config.exp +++ b/config/base-config.exp @@ -23,26 +23,26 @@ # proc reboot_via_x10 { dest } { if [board_info $dest exists name] { - set dest [board_info $dest name]; + set dest [board_info $dest name] } if [board_info $dest exists x10] { - set x10 [board_info $dest x10]; + set x10 [board_info $dest x10] verbose "rebooting x10 unit $x10" 1 rsh_exec rtl "/usr/unsupported/bin/x10-hellcab unit $x10 off" sleep 2 rsh_exec rtl "/usr/unsupported/bin/x10-hellcab unit $x10 on" sleep 2 - return 1; + return 1 } - return 0; + return 0 } proc ${board}_reboot { args } { if { [llength $args] > 0} { - set dest [lindex $args 0]; + set dest [lindex $args 0] } else { - set dest target; + set dest target } - return [reboot_via_x10 $dest]; + return [reboot_via_x10 $dest] } diff --git a/config/base68k.exp b/config/base68k.exp index a9b322c..c76bd57 100644 --- a/config/base68k.exp +++ b/config/base68k.exp @@ -34,27 +34,27 @@ proc base68k_ld { dest prog } { return "untested" } if [is_remote host] { - set prog [remote_download host $prog]; + set prog [remote_download host $prog] if { $prog == "" } { - verbose -log "Unable to download $prog to host."; - return "untested"; + verbose -log "Unable to download $prog to host." + return "untested" } } if [board_info $dest exists objcopy] { - set OBJCOPY [board_info $dest objcopy]; + set OBJCOPY [board_info $dest objcopy] set exec_file "${prog}.srec" set objcopy_args "" if [board_info $dest exists use_vma_offset] { - set objcopy_args "--adjust-vma=[board_info $dest hex_startaddr]"; + set objcopy_args "--adjust-vma=[board_info $dest hex_startaddr]" } set status [remote_exec host "$OBJCOPY $objcopy_args -O srec $prog ${prog}.srec"] - set result [lindex $status 1]; + set result [lindex $status 1] regsub -all -- "\[\r\n\]*" $result "" result if { $result != "" || [lindex $status 0] != 0 } { warning "Got \"$result\" from $OBJCOPY" verbose -log "Couldn't convert to srecord for downloading" - remote_close $dest; + remote_close $dest return "untested" } else { verbose "Converted $prog to an srecord." 2 @@ -63,7 +63,7 @@ proc base68k_ld { dest prog } { set exec_file $prog } - set value 0; + set value 0 if ![board_info $dest exists fileid] { while { $value < 2 } { set rom68k_shell_id [remote_open $dest] @@ -72,15 +72,15 @@ proc base68k_ld { dest prog } { verbose -log "$prog not executed, couldn't connect to target." return "untested" } - incr value; + incr value } else { - break; + break } } # dbug has problems if we go into binary mode, so this allows us to # disable entry into binary mode. if ![board_info $dest exists no_binary_mode] { - remote_binary $dest; + remote_binary $dest } } @@ -88,17 +88,17 @@ proc base68k_ld { dest prog } { # can load it if [is_remote host] { global objdir - set exec_file [remote_upload host ${exec_file} "${objdir}/a.out"]; + set exec_file [remote_upload host ${exec_file} "${objdir}/a.out"] } - set got_p 0; + set got_p 0 for { set tries 0; } { (! $got_p) && $tries < 5 } { incr tries } { remote_send $dest "\r\n\r\n" remote_expect $dest 5 { -re "${shell_prompt}$" { verbose "Got prompt." set result 0 - set got_p 1; + set got_p 1 } timeout { warning "Never got prompt." @@ -107,7 +107,7 @@ proc base68k_ld { dest prog } { if { ! $got_p } { if $tries<=4 then { if { $tries == 3 } then { - remote_reboot $dest; + remote_reboot $dest } else { remote_send $dest "\r\n" } @@ -119,9 +119,9 @@ proc base68k_ld { dest prog } { # scrogged -- the remote_expect above will fail in a lot of # non-clean ways. if { ! $got_p } { - remote_close $dest; - remote_reboot $dest; - return "unresolved"; + remote_close $dest + remote_reboot $dest + return "unresolved" } else { # Flush out any remaining cruft. remote_expect $dest 2 { @@ -133,7 +133,7 @@ proc base68k_ld { dest prog } { if [board_info $dest exists download_command] { # Load the program. - remote_send $dest "\r\n"; + remote_send $dest "\r\n" # dbug has problems sending download command immediately after a # newline, so we wait for the prompt to come back first. remote_expect $dest 5 { @@ -150,29 +150,29 @@ proc base68k_ld { dest prog } { [board_info $dest download_response] { } timeout { perror "Download command never responded." - return "unresolved"; + return "unresolved" } } } } verbose "Writing records to target..." - set status [remote_transmit $dest $exec_file]; + set status [remote_transmit $dest $exec_file] if { $exec_file != $prog } { remote_file build delete $exec_file } if { $status != 0 } { - remote_close $dest; + remote_close $dest verbose -log "Transmission of $exec_file to the target failed." 3 return "unresolved" } verbose "Wrote records to target...waiting for prompt." remote_send $dest "\n" - set got_p 0; + set got_p 0 remote_expect $dest 50 { -re "$shell_prompt$" { verbose "Got prompt." - set got_p 1; + set got_p 1 } timeout { } } @@ -183,120 +183,120 @@ proc base68k_ld { dest prog } { -re ".+" { exp_continue } default { } } - return "pass"; + return "pass" } else { - remote_close $dest; - remote_reboot $dest; - return "unresolved"; + remote_close $dest + remote_reboot $dest + return "unresolved" } } proc base68k_spawn { dest prog args } { - set shell_prompt [board_info $dest shell_prompt]; + set shell_prompt [board_info $dest shell_prompt] - set result [remote_ld $dest $prog]; + set result [remote_ld $dest $prog] if { $result != "pass" } { - return [list $result ""]; + return [list $result ""] } if [board_info $dest exists startaddr] { - set go_command "[board_info $dest go_command] [board_info $dest startaddr]"; + set go_command "[board_info $dest go_command] [board_info $dest startaddr]" } else { - set go_command "[board_info $dest go_command]"; + set go_command "[board_info $dest go_command]" } - verbose "Sending $go_command, waiting for results."; - remote_send $dest "${go_command}\n"; - return { "pass" "" }; + verbose "Sending $go_command, waiting for results." + remote_send $dest "${go_command}\n" + return { "pass" "" } } proc base68k_wait { dest timeout } { - set shell_prompt [board_info $dest shell_prompt]; - set noappend 0; - set result -1; + set shell_prompt [board_info $dest shell_prompt] + set noappend 0 + set result -1 - set output ""; + set output "" remote_expect $dest $timeout { -re [board_info $dest go_response] { - append output $expect_out(buffer); - set noappend 1; - set result 0; - exp_continue -continue_timer; + append output $expect_out(buffer) + set noappend 1 + set result 0 + exp_continue -continue_timer } -re "$shell_prompt$" { - verbose "Got prompt."; - set result 0; + verbose "Got prompt." + set result 0 } -re "\[\r\n\]+" { if { ! $noappend } { - append output $expect_out(buffer); + append output $expect_out(buffer) if { [string length $output] < 512000 } { - exp_continue -continue_timer; + exp_continue -continue_timer } else { - set result -1; + set result -1 } } } timeout { - warning "Nothing ever came back."; - set result -1; + warning "Nothing ever came back." + set result -1 } } if [board_info $dest exists output_end] { - regsub "[board_info $dest output_end]" "$output" "\n" output; + regsub "[board_info $dest output_end]" "$output" "\n" output } # There has got to be a better way. (We need to do this in order to remove # the echoed "go command". if [board_info $dest exists startaddr] { - set go_command "[board_info $dest go_command] [board_info $dest startaddr]"; + set go_command "[board_info $dest go_command] [board_info $dest startaddr]" } else { - set go_command "[board_info $dest go_command]"; + set go_command "[board_info $dest go_command]" } - regsub "^.*$go_command\[\r\n\]*" "$output" "" output; - regsub "^.*$go_command\[\r\n\]*" "$output" "" output; + regsub "^.*$go_command\[\r\n\]*" "$output" "" output + regsub "^.*$go_command\[\r\n\]*" "$output" "" output # We always want to check for a status, even if there was a funky weird # failure above. - set status [check_for_board_status output]; + set status [check_for_board_status output] if { $result == 0 } { - set result $status; - verbose -log "exit status was $status"; + set result $status + verbose -log "exit status was $status" } # A negative value indicates that we should reboot. Otherwise, return # the exit status from the program if we got one (and we should have). - return [list $result "$output"]; + return [list $result "$output"] } proc base68k_load { dest prog args } { global base68k_retry - set shell_prompt [board_info $dest shell_prompt]; + set shell_prompt [board_info $dest shell_prompt] if { [llength $args] > 0 } { for { set x 0; } { $x < [llength $args] } { incr x ; } { if { [lindex $args $x] != "" } { - verbose -log "Cannot pass parameters or input file to this target"; - return [list "unsupported" ""]; + verbose -log "Cannot pass parameters or input file to this target" + return [list "unsupported" ""] } } } - set result [remote_spawn $dest $prog]; + set result [remote_spawn $dest $prog] if { [lindex $result 0] != "pass" } { - return $result; + return $result } # FIXME: The value 360 below should be a parameter. - set result [remote_wait $dest 360]; - set output [lindex $result 1]; - set status [lindex $result 0]; + set result [remote_wait $dest 360] + set output [lindex $result 1] + set status [lindex $result 0] verbose "output from board is $output" @@ -304,20 +304,20 @@ proc base68k_load { dest prog args } { send_log "\n" if { $status > 0 } { - return [list "fail" $output]; + return [list "fail" $output] } elseif { $status == 0 } { - return [list "pass" $output]; + return [list "pass" $output] } else { if [info exists base68k_retry] { - return [list "fail" $output]; + return [list "fail" $output] } - set base68k_retry 1; - remote_reboot $dest; - set status [eval base68k_load \{$dest\} \{$prog\} $args]; - unset base68k_retry; - return $status; + set base68k_retry 1 + remote_reboot $dest + set status [eval base68k_load \{$dest\} \{$prog\} $args] + unset base68k_retry + return $status } } -set_board_info protocol "base68k"; +set_board_info protocol "base68k" set_board_info send_initial_cr 1 diff --git a/config/bug.exp b/config/bug.exp index c175c80..f4f6b44 100644 --- a/config/bug.exp +++ b/config/bug.exp @@ -19,7 +19,7 @@ # This file was written by Bob Manson (manson@cygnus.com). -load_generic_config "base68k"; +load_generic_config "base68k" set_board_info shell_prompt "\[0-9\]+Bug>" set_board_info download_command "lo 0\r" diff --git a/config/cfdbug.exp b/config/cfdbug.exp index 7948146..d461576 100644 --- a/config/cfdbug.exp +++ b/config/cfdbug.exp @@ -19,7 +19,7 @@ # This file was written by Bob Manson (manson@cygnus.com). -load_generic_config "base68k"; +load_generic_config "base68k" set_board_info shell_prompt "dBUG> *" set_board_info download_command "dl\r\n" diff --git a/config/cygmon.exp b/config/cygmon.exp index faf8dd8..7fb7dd1 100644 --- a/config/cygmon.exp +++ b/config/cygmon.exp @@ -17,6 +17,6 @@ # Please email any bugs, comments, and/or additions to this file to: # bug-dejagnu@gnu.org -load_generic_config "gdb-comm"; +load_generic_config "gdb-comm" -set_board_info send_initial_cr 1; +set_board_info send_initial_cr 1 diff --git a/config/d10v.exp b/config/d10v.exp index bd36fce..1affda1 100644 --- a/config/d10v.exp +++ b/config/d10v.exp @@ -17,4 +17,4 @@ # Please email any bugs, comments, and/or additions to this file to: # bug-dejagnu@gnu.org -load_generic_config "gdb-comm"; +load_generic_config "gdb-comm" diff --git a/config/ddb-ether.exp b/config/ddb-ether.exp index 91e0af0..88c707e 100644 --- a/config/ddb-ether.exp +++ b/config/ddb-ether.exp @@ -21,166 +21,166 @@ # Reset the prompt to what GDB needs. proc ${board}_init { dest } { - global doing_ddb_init; + global doing_ddb_init if ![info exists doing_ddb_init] { - set doing_ddb_init 1; + set doing_ddb_init 1 - remote_close $dest; + remote_close $dest for { set x 0; } { $x < 3 } { incr x; } { - set shell_id [remote_open $dest]; + set shell_id [remote_open $dest] if { $shell_id == "" || $shell_id < 0 } { - remote_reboot $dest; + remote_reboot $dest } else { - break; + break } } - set shell_prompt [board_info $dest shell_prompt]; + set shell_prompt [board_info $dest shell_prompt] - remote_send $dest "\n"; + remote_send $dest "\n" remote_expect $dest 10 { -re ".*PMON> $" { - remote_send $dest "set prompt \"$shell_prompt\"\n"; - exp_continue; + remote_send $dest "set prompt \"$shell_prompt\"\n" + exp_continue } -re ".*${shell_prompt}$" { } } - remote_close $dest; - unset doing_ddb_init; + remote_close $dest + unset doing_ddb_init } else { - return; + return } } proc ddb_ether_load { dest prog args } { for { set x 0; } { $x < 3 } { incr x } { - set result [eval remote_spawn \{$dest\} \{$prog\} $args]; + set result [eval remote_spawn \{$dest\} \{$prog\} $args] if { $result < 0 } { - remote_reboot $dest; + remote_reboot $dest } else { - set result [remote_wait $dest 300]; - set status [lindex $result 0]; - set output [lindex $result 1]; + set result [remote_wait $dest 300] + set status [lindex $result 0] + set output [lindex $result 1] if { $status >= 0 } { if { $status > 0 } { - return [list "fail" $output]; + return [list "fail" $output] } else { - return [list "pass" $output]; + return [list "pass" $output] } } } } - return [list "fail" ""]; + return [list "fail" ""] } proc ddb_ether_ld { dest prog } { if ![board_info $dest exists tftpdir] { - perror "Must set_board_info tftpdir for [board_info $dest name]"; - return "fail"; + perror "Must set_board_info tftpdir for [board_info $dest name]" + return "fail" } if ![board_info $dest exists fileid] { - set spawn_id [remote_open $dest]; + set spawn_id [remote_open $dest] if { $spawn_id == "" || $spawn_id < 0 } { - return "retry"; + return "retry" } - remote_binary $dest; + remote_binary $dest } - set shell_prompt [board_info $dest shell_prompt]; + set shell_prompt [board_info $dest shell_prompt] - remote_send $dest "\n"; + remote_send $dest "\n" remote_expect $dest 10 { -re ".*${shell_prompt}$" { } default { - return "retry"; + return "retry" } } - set basename "a.out.[pid]"; - set file "[board_info $dest tftpdir]/$basename"; - set file [remote_download build $prog $file]; + set basename "a.out.[pid]" + set file "[board_info $dest tftpdir]/$basename" + set file [remote_download build $prog $file] if { $file == "" } { - perror "download to tftp area failed"; - return "fail"; + perror "download to tftp area failed" + return "fail" } - set state "pass"; + set state "pass" - remote_send $dest "boot /$basename\n"; - set tries 0; + remote_send $dest "boot /$basename\n" + set tries 0 remote_expect $dest 30 { -re "Loading.*Entry address is.*${shell_prompt}$" { } -re "invalid executable.*${shell_prompt}$" { - incr tries; + incr tries if { $tries < 3 } { - sleep 2; - remote_send $dest "boot /$basename\n"; - exp_continue; + sleep 2 + remote_send $dest "boot /$basename\n" + exp_continue } } -re ".*${shell_prompt}$" { - set state "fail"; + set state "fail" } default { - set state "fail"; + set state "fail" } } - remote_file build delete $file; + remote_file build delete $file if { $state == "fail" } { - return $state; + return $state } - return "pass"; + return "pass" } proc ddb_ether_spawn { dest prog args } { - set state [ddb_ether_ld $dest $prog]; + set state [ddb_ether_ld $dest $prog] if { $state != "pass" } { - return -1; + return -1 } - remote_send $dest "g\n"; + remote_send $dest "g\n" remote_expect $dest 5 { -re "g\[\r\n\]\[\r\n\]?" { } default { } } - return [board_info $dest fileid]; + return [board_info $dest fileid] } proc ddb_ether_wait { dest timeout } { - set output ""; - set shell_prompt [board_info $dest shell_prompt]; + set output "" + set shell_prompt [board_info $dest shell_prompt] remote_expect $dest $timeout { -re "^g\[\r\n\]\[\r\n\]?" { if { $output != "" } { - append output $expect_out(buffer); + append output $expect_out(buffer) } - exp_continue; + exp_continue } -re "(.*)$shell_prompt" { - append output $expect_out(1,string); - set status [check_for_board_status output]; + append output $expect_out(1,string) + set status [check_for_board_status output] if { $status > 0 } { - return [list $status $output]; + return [list $status $output] } else { if [regexp "Exception Cause=" $output] { - remote_reboot $dest; - return [list -1 $output]; + remote_reboot $dest + return [list -1 $output] } - return [list 0 $output]; + return [list 0 $output] } } -re "\[\r\n\]+" { - append output $expect_out(buffer); + append output $expect_out(buffer) if { [string length $output] < 512000 } { - exp_continue; + exp_continue } else { - return [list -1 ""]; + return [list -1 ""] } } default { - return [list -1 ""]; + return [list -1 ""] } } } diff --git a/config/ddb.exp b/config/ddb.exp index 2c1aa21..89ceb55 100644 --- a/config/ddb.exp +++ b/config/ddb.exp @@ -20,12 +20,12 @@ # This file was written by Bob Manson (manson@cygnus.com) # We use GDB to talk to a vr4300 board. -load_generic_config "base68k"; +load_generic_config "base68k" -set_board_info shell_prompt "NEC010> "; -set_board_info download_command "load tty0\n"; -set_board_info download_response "Downloading from"; -set_board_info go_command "g -e"; +set_board_info shell_prompt "NEC010> " +set_board_info download_command "load tty0\n" +set_board_info download_response "Downloading from" +set_board_info go_command "g -e" set_board_info startaddr "a0100000" set_board_info hex_startaddr "0xa0100000" set_board_info go_response "(^|\[\r\n\])(Exception Cause|\[0-9a-z\]+ \[0-9a-z\]+ break|\\*\\*\\*EXIT code )\[^\r\n\]*\[\r\n\]" @@ -33,51 +33,51 @@ set_board_info output_end "\[\r\n\](Exception Cause|\[0-9a-z\]+ \[0-9a-z\]+ brea # Reset the prompt to what GDB needs. proc ${board}_init { dest } { - global doing_ddb_init; + global doing_ddb_init if [is_remote host] { - return; + return } if ![info exists doing_ddb_init] { - set doing_ddb_init 1; + set doing_ddb_init 1 for { set i 1; } { $i <= 3 } {incr i } { - remote_close $dest; + remote_close $dest for { set x 0; } { $x < 3 } { incr x; } { - set shell_id [remote_open $dest]; + set shell_id [remote_open $dest] if { $shell_id == "" || $shell_id < 0 } { - remote_reboot $dest; + remote_reboot $dest } else { - break; + break } } - set count 0; - remote_send $dest "\n"; + set count 0 + remote_send $dest "\n" remote_expect $dest 20 { -re ".*PMON> $" { - remote_send $dest "set prompt \"NEC010> \"\n"; - exp_continue; + remote_send $dest "set prompt \"NEC010> \"\n" + exp_continue } -re "NEC010> $" { - set i 10; + set i 10 } timeout { } -re "0x0" { - count++; + count++ if(count<5) { - exp_continue; + exp_continue } } } if { $i < 3 } { - remote_reboot $dest; + remote_reboot $dest } } - remote_close $dest; - unset doing_ddb_init; + remote_close $dest + unset doing_ddb_init } else { - return; + return } } @@ -86,7 +86,7 @@ set_board_info dont_wait_for_prompt 1 # If no output format is specified, use objcopy. if ![board_info $board exists output_format] { - set tempfil [lookfor_file $tool_root_dir binutils/objcopy]; + set tempfil [lookfor_file $tool_root_dir binutils/objcopy] if { $tempfil != "" } { set_board_info objcopy $tempfil } else { diff --git a/config/dos.exp b/config/dos.exp index 9158c2b..4a52113 100644 --- a/config/dos.exp +++ b/config/dos.exp @@ -26,97 +26,97 @@ proc dos_open { dest args } { global destbat_num if ![info exists destbat_num] { - set destbat_num [pid]; + set destbat_num [pid] } if { [board_info $dest conninfo] == "" } { - global board_info; - set name [board_info $dest name]; + global board_info + set name [board_info $dest name] - set board_info($name,conninfo) "b${destbat_num}.bat"; - incr destbat_num; + set board_info($name,conninfo) "b${destbat_num}.bat" + incr destbat_num } if [board_info $dest exists fileid] { - return [board_info $dest fileid]; + return [board_info $dest fileid] } verbose "doing a dos_open to $dest" - set shell_prompt [board_info $dest shell_prompt]; + set shell_prompt [board_info $dest shell_prompt] - set shell_id [remote_raw_open $dest]; + set shell_id [remote_raw_open $dest] if { $shell_id == "" || $shell_id < 0 } { - return -1; + return -1 } if [board_info $dest exists init_command] { - remote_send $dest "[board_info $dest init_command]\n"; + remote_send $dest "[board_info $dest init_command]\n" remote_expect $dest 10 { -re "$shell_prompt" { } default { perror "failed connection to DOS on $dest." - return -1; + return -1 } } } if [board_info $dest exists ftp_directory] { - set dir [board_info $dest ftp_directory]; - regsub -all "/" "$dir" "\\" dir; - remote_send $dest "cd $dir\n"; + set dir [board_info $dest ftp_directory] + regsub -all "/" "$dir" "\\" dir + remote_send $dest "cd $dir\n" remote_expect $dest 10 { -re "$shell_prompt" { } default { perror "failed connection to DOS on $dest." - return -1; + return -1 } } } if [board_info $dest exists dos_dir] { - set dos_dir [board_info $dest dos_dir]; - regsub -all "^(\[a-zA-Z]:).*$" "$dos_dir" "\\1" drive; - regsub -all "^\[a-zA-Z]:" "$dos_dir" "" dos_dir; - remote_send $dest "${drive}\n"; + set dos_dir [board_info $dest dos_dir] + regsub -all "^(\[a-zA-Z]:).*$" "$dos_dir" "\\1" drive + regsub -all "^\[a-zA-Z]:" "$dos_dir" "" dos_dir + remote_send $dest "${drive}\n" remote_expect $dest 10 { -re "$shell_prompt" { } default { perror "failed connection to DOS on $dest." - return -1; + return -1 } } - remote_send $dest "cd $dos_dir\n"; + remote_send $dest "cd $dos_dir\n" remote_expect $dest 10 { -re "$shell_prompt" { } default { perror "failed connection to DOS on $dest." - return -1; + return -1 } } } global target_alias if [info exists target_alias] { - set talias $target_alias; + set talias $target_alias } else { set talias "foo-bar" } - global board_info; + global board_info if [board_info $dest exists name] { - set n [board_info $dest name]; + set n [board_info $dest name] } else { - set n $dest; + set n $dest } - set board_info($n,fileid) $shell_id; + set board_info($n,fileid) $shell_id if [board_info $dest exists init_script] { remote_exec $dest "[board_info $dest init_script] $talias" } verbose "Succeeded in connecting to DOS." - return $shell_id; + return $shell_id } # @@ -126,33 +126,33 @@ proc dos_open { dest args } { proc dos_close { dest args } { if [board_info $dest exists fileid] { if { [board_info $dest connect] == "telnet" } { - remote_send $dest "exit\n"; - sleep 2; + remote_send $dest "exit\n" + sleep 2 } - return [remote_raw_close $dest]; + return [remote_raw_close $dest] } } proc dos_prep_command { dest cmdline } { - global board_info; + global board_info - set name [board_info $dest name]; - set shell_id [remote_open "$dest"]; + set name [board_info $dest name] + set shell_id [remote_open "$dest"] - set localbat "/tmp/b[pid].bat"; - set remotebat [board_info $dest conninfo]; + set localbat "/tmp/b[pid].bat" + set remotebat [board_info $dest conninfo] verbose "opened" if { $shell_id != "" && $shell_id >= 0 } { - set fileid [open "$localbat" "w"]; - puts -nonewline $fileid "@echo off\r\n$cmdline\r\nif errorlevel 1 echo *** DOSEXIT code 1\r\nif not errorlevel 1 echo *** DOSEXIT code 0\r\n"; - close $fileid; - set result [remote_download $dest $localbat $remotebat]; + set fileid [open "$localbat" "w"] + puts -nonewline $fileid "@echo off\r\n$cmdline\r\nif errorlevel 1 echo *** DOSEXIT code 1\r\nif not errorlevel 1 echo *** DOSEXIT code 0\r\n" + close $fileid + set result [remote_download $dest $localbat $remotebat] } else { set result "" } - remote_file build delete $localbat; - return $result; + remote_file build delete $localbat + return $result } # @@ -166,19 +166,19 @@ proc dos_prep_command { dest cmdline } { proc dos_exec { dest program pargs inp outp } { set cmdline "$program $pargs" - set shell_prompt [board_info $dest shell_prompt]; + set shell_prompt [board_info $dest shell_prompt] if { $inp != "" } { - set inp [remote_download $dest $inp inpfile]; + set inp [remote_download $dest $inp inpfile] if { $inp != "" } { - set inp " < $inp"; + set inp " < $inp" } } if { $outp != "" } { - set outpf " > tempout"; + set outpf " > tempout" } else { - set outpf ""; + set outpf "" } verbose "cmdline is $cmdline$inp." 2 @@ -186,30 +186,30 @@ proc dos_exec { dest program pargs inp outp } { # Make a DOS batch file; we use @echo off so we don't have to see # the DOS command prompts and such. for { set i 0; } { $i < 2 } { incr i } { - set exit_status -1; + set exit_status -1 verbose "calling open" - set batfile [dos_prep_command $dest "$cmdline$inp$outpf"]; + set batfile [dos_prep_command $dest "$cmdline$inp$outpf"] if { $batfile != "" } { if { [dos_start_command $batfile $dest] == "" } { # FIXME: The 300 below should be a parameter. - set result [remote_wait $dest 300]; - set exit_status [lindex $result 0]; - set output [lindex $result 1]; + set result [remote_wait $dest 300] + set exit_status [lindex $result 0] + set output [lindex $result 1] } } if { $exit_status >= 0 } { if { $outp != "" } { - remote_upload $dest tempout $outp; - remote_file $dest delete tempout; + remote_upload $dest tempout $outp + remote_file $dest delete tempout } - return [list $exit_status $output]; + return [list $exit_status $output] } if { $exit_status != -2 } { - remote_close $dest; - remote_reboot $dest; + remote_close $dest + remote_reboot $dest } } - return [list -1 "program execution failed"]; + return [list -1 "program execution failed"] } # @@ -219,40 +219,40 @@ proc dos_exec { dest program pargs inp outp } { # proc dos_start_command { cmdline dest } { - set shell_prompt [board_info $dest shell_prompt]; + set shell_prompt [board_info $dest shell_prompt] set prefix "" - set ok 0; + set ok 0 for {set i 0;} {$i <= 2 && ! $ok} {incr i;} { - set shell_id [remote_open $dest]; + set shell_id [remote_open $dest] if { $shell_id != "" && $shell_id > 0 } { - remote_send $dest "echo k\r"; + remote_send $dest "echo k\r" remote_expect $dest 20 { -re "\\(gdb\\)" { - set shell_prompt "\\(gdb\\)"; + set shell_prompt "\\(gdb\\)" # gdb uses 'shell command'. - set prefix "shell "; - set ok 1; + set prefix "shell " + set ok 1 } -re "$shell_prompt" { - set ok 1; + set ok 1 } default { } } } if { ! $ok } { - remote_close $dest; - remote_reboot $dest; + remote_close $dest + remote_reboot $dest } } if { ! $ok } { return "unable to start command" } else { - remote_send $dest "${prefix}${cmdline}\n"; + remote_send $dest "${prefix}${cmdline}\n" remote_expect $dest 2 { -re "${cmdline}\[\r\n\]\[\r\n\]?" { } timeout { } } - return ""; + return "" } } @@ -285,47 +285,47 @@ proc dos_send { dest string } { proc dos_spawn { dest program args } { verbose "running $program on $dest" - set remotebat [dos_prep_command $dest $program]; + set remotebat [dos_prep_command $dest $program] for { set x 0; } { $x < 3 } { incr x } { if { [dos_start_command $remotebat $dest] == "" } { - return [board_info $dest fileid]; + return [board_info $dest fileid] } - remote_close $dest; - remote_reboot $dest; + remote_close $dest + remote_reboot $dest } - return -1; + return -1 } proc dos_wait { dest timeout } { - set output ""; - set shell_prompt [board_info $dest shell_prompt]; - set status 1; + set output "" + set shell_prompt [board_info $dest shell_prompt] + set status 1 - verbose "waiting in dos_wait"; + verbose "waiting in dos_wait" remote_expect $dest $timeout { -re "(.*)\[*\]\[*\]\[*\] DOSEXIT code (\[0-9\]+)\[\r\n\]\[\r\n\]?" { - verbose "got exit status"; - append output $expect_out(1,string); - set status $expect_out(2,string); - exp_continue; + verbose "got exit status" + append output $expect_out(1,string) + set status $expect_out(2,string) + exp_continue } -re "(.*)${shell_prompt}" { - append output $expect_out(1,string); - verbose "output from dos is:'$output'"; - return [list $status $output]; + append output $expect_out(1,string) + verbose "output from dos is:'$output'" + return [list $status $output] } -re "(.*)\\(gdb\\)" { - append output $expect_out(1,string); - return [list $status $output]; + append output $expect_out(1,string) + return [list $status $output] } -re "In.*cygwin.*except" { - remote_close $dest; - remote_reboot $dest; - return [list -2 $output]; + remote_close $dest + remote_reboot $dest + return [list -2 $output] } -re "\[\r\n\]+" { @@ -335,89 +335,89 @@ proc dos_wait { dest timeout } { # first time 'round. The other tricky bit is that # expect_out(buffer) will contain everything before and including # the matched pattern. - append output $expect_out(buffer); - exp_continue -continue_timer; + append output $expect_out(buffer) + exp_continue -continue_timer } timeout { - warning "timeout in dos_wait"; + warning "timeout in dos_wait" if { [dos_interrupt_job $dest] == "" } { - return [list 1 $output]; + return [list 1 $output] } } eof { - warning "got EOF from dos host."; + warning "got EOF from dos host." } } - remote_close $dest; + remote_close $dest - return [list -1 $output]; + return [list -1 $output] } proc dos_load { dest prog args } { - global dos_dll_loaded; - set progargs ""; - set inpfile ""; + global dos_dll_loaded + set progargs "" + set inpfile "" if { [llength $args] > 0 } { - set progargs [lindex $args 1]; + set progargs [lindex $args 1] } if { [llength $args] > 1 } { - set inpfile [lindex $args 1]; + set inpfile [lindex $args 1] } if ![info exists dos_dll_loaded] { if ![is_remote host] { - global target_alias; + global target_alias - set comp [get_multilibs]; + set comp [get_multilibs] if [file exists "${comp}/winsup/new-cygwin1.dll"] { - set dll "${comp}/winsup/new-cygwin1.dll"; - set dll_name "cygwin1.dll"; + set dll "${comp}/winsup/new-cygwin1.dll" + set dll_name "cygwin1.dll" } elseif [file exists "${comp}/winsup/new-cygwin.dll"] { - set dll "${comp}/winsup/new-cygwin.dll"; - set dll_name "cygwin.dll"; + set dll "${comp}/winsup/new-cygwin.dll" + set dll_name "cygwin.dll" } elseif [file exists ${comp}/lib/cygwin1.dll] { - set dll "${comp}/lib/cygwin1.dll"; - set dll_name "cygwin1.dll"; + set dll "${comp}/lib/cygwin1.dll" + set dll_name "cygwin1.dll" } elseif [file exists ${comp}/lib/cygwin.dll] { - set dll "${comp}/lib/cygwin.dll"; - set dll_name "cygwin.dll"; + set dll "${comp}/lib/cygwin.dll" + set dll_name "cygwin.dll" } else { error "couldn't find cygwin.dll:$comp" - return "fail"; + return "fail" } remote_download $dest $dll $dll_name } - set dos_dll_loaded 1; + set dos_dll_loaded 1 } - set remote_prog [remote_download $dest $prog "aout.exe"]; - set result [remote_exec $dest $remote_prog $progargs $inpfile]; - set status [lindex $result 0]; - set output [lindex $result 1]; - set status2 [check_for_board_status output]; + set remote_prog [remote_download $dest $prog "aout.exe"] + set result [remote_exec $dest $remote_prog $progargs $inpfile] + set status [lindex $result 0] + set output [lindex $result 1] + set status2 [check_for_board_status output] if { $status2 >= 0 } { - set status $status2; + set status $status2 } if { $status != 0 } { - set status "fail"; + set status "fail" } else { - set status "pass"; + set status "pass" } - return [list $status $output]; + return [list $status $output] } proc dos_file { dest op args } { switch $op { delete { foreach x $args { - remote_exec $dest "del" "$x"; + remote_exec $dest "del" "$x" } - return; + return } default { - return [eval standard_file \{$dest\} \{$op\} $args]; + return [eval standard_file \{$dest\} \{$op\} $args] } } } @@ -427,32 +427,32 @@ proc dos_file { dest op args } { # part is that we have to handle the "Terminate batch job" prompt. # proc dos_interrupt_job { host } { - set shell_prompt [board_info $host shell_prompt]; + set shell_prompt [board_info $host shell_prompt] - remote_send $host "\003"; + remote_send $host "\003" remote_expect $host 10 { -re "Terminate batch job.*Y/N\[)\]\[?\] *$" { - remote_send $host "n\n"; - exp_continue; + remote_send $host "n\n" + exp_continue } -re "$shell_prompt" { - return ""; + return "" } -re ">" { - remote_send $host "\n"; - exp_continue; + remote_send $host "\n" + exp_continue } } - return "fail"; + return "fail" } proc dos_copy_download { host localfile remotefile } { - remote_file build delete "[board_info $host local_dir]/$remotefile"; + remote_file build delete "[board_info $host local_dir]/$remotefile" if [remote_file build exists $localfile] { - set result [remote_download build $localfile "[board_info $host local_dir]/$remotefile"]; + set result [remote_download build $localfile "[board_info $host local_dir]/$remotefile"] if { $result != "" } { - remote_exec build "chmod" "a+rw $result"; - return $remotefile; + remote_exec build "chmod" "a+rw $result" + return $remotefile } } else { return "" @@ -460,25 +460,25 @@ proc dos_copy_download { host localfile remotefile } { } proc dos_copy_upload { host remotefile localfile } { - remote_file build delete $localfile; + remote_file build delete $localfile if [file exists "[board_info $host local_dir]/$remotefile"] { - set result [remote_download build "[board_info $host local_dir]/$remotefile" $localfile]; + set result [remote_download build "[board_info $host local_dir]/$remotefile" $localfile] } else { - set result ""; + set result "" } if { $result != "" } { - remote_exec build "chmod" "a+rw $result"; - return $result; + remote_exec build "chmod" "a+rw $result" + return $result } } proc dos_copy_file { dest op args } { if { $op == "delete" } { - set file "[board_info $dest local_dir]/[lindex $args 0]"; - remote_file build delete $file; + set file "[board_info $dest local_dir]/[lindex $args 0]" + remote_file build delete $file } } -set_board_info protocol "dos"; -set_board_info shell_prompt "(^|\[\r\n\])\[a-zA-Z\]:\[^\r\n\]*>\[ \t\]*$"; +set_board_info protocol "dos" +set_board_info shell_prompt "(^|\[\r\n\])\[a-zA-Z\]:\[^\r\n\]*>\[ \t\]*$" set_board_info needs_status_wrapper 1 diff --git a/config/dve.exp b/config/dve.exp index 35f8c3f..02a2643 100644 --- a/config/dve.exp +++ b/config/dve.exp @@ -19,4 +19,4 @@ # For Densan MIPS boards we use gdb to load and execute programs. -load_generic_config "gdb-comm"; +load_generic_config "gdb-comm" diff --git a/config/gdb-comm.exp b/config/gdb-comm.exp index 0255335..6c7d67e 100644 --- a/config/gdb-comm.exp +++ b/config/gdb-comm.exp @@ -37,7 +37,7 @@ set try_again 0 proc gdb_comm_delete_breakpoints {} { global gdb_prompt - remote_send host "delete breakpoints\n"; + remote_send host "delete breakpoints\n" remote_expect host 10 { -re "Delete all breakpoints.*y or n. $" { remote_send host "y\n" @@ -52,7 +52,7 @@ proc gdb_comm_delete_breakpoints {} { -re ".*$gdb_prompt $" { perror "breakpoints not deleted" ; return -1} timeout { perror "info breakpoints (timeout)" ; return -1} } - return 0; + return 0 } # @@ -70,7 +70,7 @@ proc gdb_comm_file_cmd { arg } { # The "file" command loads up a new symbol file for gdb, deal with # the various messages it might spew out. if [is_remote host] { - set arg [remote_download host $arg a.out]; + set arg [remote_download host $arg a.out] } remote_send host "file $arg\n" remote_expect host 60 { @@ -120,31 +120,31 @@ proc gdb_comm_file_cmd { arg } { return -1 } } - return 0; + return 0 } # Disconnect from the target and forget that we have an executable. Returns # -1 on failure, 0 on success. proc gdb_comm_go_idle { } { - global gdb_prompt; + global gdb_prompt if ![board_info host exists fileid] { - return -1; + return -1 } - remote_send host "target exec\n"; + remote_send host "target exec\n" remote_expect host 10 { -re "Kill it.*y or n.*$" { remote_send host "y\n" - exp_continue; + exp_continue } -re "No exec.* file now.*$gdb_prompt $" { - return 0; + return 0 } default { - remote_close host; - return -1; + remote_close host + return -1 } } } @@ -160,7 +160,7 @@ proc gdb_comm_start { dest } { if ![board_info $dest exists gdb_prompt] then { set gdb_prompt "\\(gdb\\)" } else { - set gdb_prompt [board_info $dest gdb_prompt]; + set gdb_prompt [board_info $dest gdb_prompt] } # Similarly for GDB. Look in the object directory for gdb if we aren't # provided with one. @@ -171,20 +171,20 @@ proc gdb_comm_start { dest } { } } if [board_info host exists gdb_opts] { - set gdb_opts [board_info host gdb_opts]; + set gdb_opts [board_info host gdb_opts] } else { set gdb_opts "" } # Start up gdb (no startfiles, no windows) and wait for a prompt. - remote_spawn host "$GDB $gdb_opts -nw -nx"; + remote_spawn host "$GDB $gdb_opts -nw -nx" remote_expect host 60 { -re ".*$gdb_prompt $" { } } - remote_send host "set height 0\n"; + remote_send host "set height 0\n" remote_expect host 10 { -re ".*$gdb_prompt $" {} } - remote_send host "set width 0\n"; + remote_send host "set width 0\n" remote_expect host 10 { -re ".*$gdb_prompt $" {} } @@ -211,16 +211,16 @@ proc gdb_comm_add_breakpoint { function } { # proc quit_gdb { } { - global gdb_prompt; + global gdb_prompt - set spawn_id [board_info host fileid]; + set spawn_id [board_info host fileid] if { $spawn_id != "" && $spawn_id > -1 } { if { [remote_send host "quit\n"] == "" } { remote_expect host 10 { -re ".*y or n.*$" { - remote_send host "y\n"; - exp_continue; + remote_send host "y\n" + exp_continue } -re ".*\[*\]\[*\]\[*\].*EXIT code" { } default { } @@ -228,15 +228,15 @@ proc quit_gdb { } { } } if ![is_remote host] { - remote_close host; + remote_close host } } proc gdb_comm_leave { } { if [is_remote host] { - quit_gdb; + quit_gdb } else { - gdb_comm_go_idle; + gdb_comm_go_idle } } # @@ -255,50 +255,50 @@ proc gdb_comm_load { dest prog args } { for { set x 0; } { $x < [llength $args] } { incr x } { if { [lindex $args $x] != "" } { - return [list "unsupported" "no support for [lindex $argnames $x] on this target"]; + return [list "unsupported" "no support for [lindex $argnames $x] on this target"] } } # Make sure the file we're supposed to load really exists. if ![file exists $prog] then { perror "$prog does not exist." - return [list "untested" ""]; + return [list "untested" ""] } if { [is_remote host] || ![board_info host exists fileid] } { - gdb_comm_start $dest; + gdb_comm_start $dest } # Remove all breakpoints, then tell the debugger that we have # new exec file. if { [gdb_comm_delete_breakpoints] != 0 } { - gdb_comm_leave; - return [gdb_comm_reload $dest $prog $args]; + gdb_comm_leave + return [gdb_comm_reload $dest $prog $args] } if { [gdb_comm_file_cmd $prog] != 0 } { - gdb_comm_leave; - return [gdb_comm_reload $dest $prog $args]; + gdb_comm_leave + return [gdb_comm_reload $dest $prog $args] } if [board_info $dest exists gdb_sect_offset] { - set textoff [board_info $dest gdb_sect_offset]; - remote_send host "sect .text $textoff\n"; + set textoff [board_info $dest gdb_sect_offset] + remote_send host "sect .text $textoff\n" remote_expect host 10 { -re "(0x\[0-9a-z]+) - 0x\[0-9a-z\]+ is \\.data" { - set dataoff $expect_out(1,string); - exp_continue; + set dataoff $expect_out(1,string) + exp_continue } -re "(0x\[0-9a-z\]+) - 0x\[0-9a-z\]+ is \\.bss" { - set bssoff $expect_out(1,string); - exp_continue; + set bssoff $expect_out(1,string) + exp_continue } -re "$gdb_prompt" { } } - set dataoff [format 0x%x [expr $dataoff + $textoff]]; - set bssoff [format 0x%x [expr $bssoff + $textoff]]; - remote_send host "sect .data $dataoff\n"; + set dataoff [format 0x%x [expr $dataoff + $textoff]] + set bssoff [format 0x%x [expr $bssoff + $textoff]] + remote_send host "sect .data $dataoff\n" remote_expect host 10 { -re "$gdb_prompt" { } } - remote_send host "sect .bss $bssoff\n"; + remote_send host "sect .bss $bssoff\n" remote_expect host 10 { -re "$gdb_prompt" { } } @@ -310,18 +310,18 @@ proc gdb_comm_load { dest prog args } { # use printf to indicate pass/fail status. if { [gdb_comm_add_breakpoint _exit] != "" } { - gdb_comm_add_breakpoint exit; + gdb_comm_add_breakpoint exit } - gdb_comm_add_breakpoint abort; + gdb_comm_add_breakpoint abort - set protocol [board_info $dest gdb_protocol]; + set protocol [board_info $dest gdb_protocol] if [board_info $dest exists gdb_serial] { - set targetname [board_info $dest gdb_serial]; + set targetname [board_info $dest gdb_serial] } elseif [board_info $dest exists netport] { - set targetname [board_info $dest netport]; + set targetname [board_info $dest netport] } else { if [board_info $dest exists serial] { - set targetname [board_info $dest serial]; + set targetname [board_info $dest serial] } else { set targetname "" } @@ -331,20 +331,20 @@ proc gdb_comm_load { dest prog args } { remote_expect host 10 { -re ".*$gdb_prompt $" {} default { - warning "failed setting baud rate"; + warning "failed setting baud rate" } } } - remote_send host "target $protocol $targetname\n"; + remote_send host "target $protocol $targetname\n" remote_expect host 60 { -re "Couldn.t establish conn.*$gdb_prompt $" { warning "Unable to connect to $targetname with GDB." - quit_gdb; + quit_gdb return [gdb_comm_reload $dest $prog $args] } -re "Ending remote.*$gdb_prompt $" { warning "Unable to connect to $targetname with GDB." - quit_gdb; + quit_gdb return [gdb_comm_reload $dest $prog $args] } -re "Remote target $protocol connected to.*$gdb_prompt $" { } @@ -354,35 +354,35 @@ proc gdb_comm_load { dest prog args } { -re "Remote.*using $targetname.*$gdb_prompt $" { } -re "$gdb_prompt $" { warning "Unable to connect to $targetname with GDB." - quit_gdb; + quit_gdb return [gdb_comm_reload $dest $prog $args] } -re ".*RDI_open.*should reset target.*" { warning "RDI Open Failed" - quit_gdb; + quit_gdb return [gdb_comm_reload $dest $prog $args] } default { warning "Unable to connect to $targetname with GDB." - quit_gdb; + quit_gdb return [gdb_comm_reload $dest $prog $args] } } if [target_info exists gdb_init_command] { - remote_send host "[target_info gdb_init_command]\n"; + remote_send host "[target_info gdb_init_command]\n" remote_expect host 10 { -re ".*$gdb_prompt $" { } default { - gdb_comm_leave; - return [list "fail" ""]; + gdb_comm_leave + return [list "fail" ""] } } } # Now download the executable to the target board. If communications # with the target are very slow the timeout might need to be increased. if [board_info $dest exists gdb_load_offset] { - remote_send host "load $prog [board_info $dest gdb_load_offset]\n"; + remote_send host "load $prog [board_info $dest gdb_load_offset]\n" } else { remote_send host "load\n" } @@ -391,13 +391,13 @@ proc gdb_comm_load { dest prog args } { -re "data.*text.*$gdb_prompt $" { } -re "$gdb_prompt $" { warning "Unable to send program to target board." - gdb_comm_leave; - return [gdb_comm_reload $dest $prog $args]; + gdb_comm_leave + return [gdb_comm_reload $dest $prog $args] } default { warning "Unable to send program to target board." - gdb_comm_leave; - return [gdb_comm_reload $dest $prog $args]; + gdb_comm_leave + return [gdb_comm_reload $dest $prog $args] } } @@ -407,29 +407,29 @@ proc gdb_comm_load { dest prog args } { # And a whole lot of other magic stuff too. if [board_info $dest exists gdb_run_command] { - remote_send host "[board_info $dest gdb_run_command]\n"; + remote_send host "[board_info $dest gdb_run_command]\n" } else { remote_send host "run\n" } # FIXME: The value 300 below should be a parameter. if [board_info $dest exists testcase_timeout] { - set testcase_timeout [board_info $dest testcase_timeout]; + set testcase_timeout [board_info $dest testcase_timeout] } else { - set testcase_timeout 300; + set testcase_timeout 300 } remote_expect host $testcase_timeout { -re "Line.*Jump anyway.*.y or n.*" { - remote_send host "y\n"; - exp_continue; + remote_send host "y\n" + exp_continue } -re "Continuing( at |\\.| with no signal\\.)\[^\r\n\]*\[\r\n\]" { - exp_continue; + exp_continue } -re ".*Start it from the beginning?.*y or n.*" { - remote_send host "n\n"; + remote_send host "n\n" remote_expect host 10 { -re ".*$gdb_prompt $" { - remote_send host "signal 0\n"; + remote_send host "signal 0\n" remote_expect host 10 { -re "signal 0\[\r\n\]+" { exp_continue; } -re "Continuing(\\.| with no signal\\.)\[\r\n\]" {} @@ -445,83 +445,83 @@ proc gdb_comm_load { dest prog args } { exp_continue } -re "(.*)Breakpoint.*exit.*=0.*$gdb_prompt $" { - append output $expect_out(1,string); - set result [check_for_board_status output]; - gdb_comm_leave; + append output $expect_out(1,string) + set result [check_for_board_status output] + gdb_comm_leave if { $result > 0 } { - return [list "fail" $output]; + return [list "fail" $output] } - return [list "pass" $output]; + return [list "pass" $output] } -re "(.*)Breakpoint.*exit.*=\[1-9\]\[0-9\]*.*$gdb_prompt $" { - append output $expect_out(1,string); - set result [check_for_board_status output]; - gdb_comm_leave; + append output $expect_out(1,string) + set result [check_for_board_status output] + gdb_comm_leave if { $result == 0 } { - return [list "pass" $output]; + return [list "pass" $output] } if [board_info $dest exists exit_statuses_bad] { - return [list "pass" $output]; + return [list "pass" $output] } - return [list "fail" $output]; + return [list "fail" $output] } -re "(.*)Breakpoint.*exit.*$gdb_prompt $" { - append output $expect_out(1,string); - set status [check_for_board_status output]; - gdb_comm_leave; + append output $expect_out(1,string) + set status [check_for_board_status output] + gdb_comm_leave if { $status > 0 } { - return [list "fail" $output]; + return [list "fail" $output] } - return [list "pass" $output]; + return [list "pass" $output] } -re "(.*)Breakpoint.*abort.*$gdb_prompt $" { - append output $expect_out(1,string); - check_for_board_status output; - gdb_comm_leave; - return [list "fail" $output]; + append output $expect_out(1,string) + check_for_board_status output + gdb_comm_leave + return [list "fail" $output] } -re "SIGTRAP.*$gdb_prompt $" { - return [gdb_comm_reload $dest $prog $args]; + return [gdb_comm_reload $dest $prog $args] } -re "(.*)Program (received |terminated ).*$gdb_prompt $" { - set output $expect_out(1,string); - check_for_board_status output; - gdb_comm_leave; - remote_reboot $dest; - return [list "fail" $output]; + set output $expect_out(1,string) + check_for_board_status output + gdb_comm_leave + remote_reboot $dest + return [list "fail" $output] } -re "(.*)Program exited with code \[0-9\]+.*$gdb_prompt $" { - set output $expect_out(1,string); - set status [check_for_board_status output]; - gdb_comm_leave; + set output $expect_out(1,string) + set status [check_for_board_status output] + gdb_comm_leave if { $status > 0 } { - return [list "fail" $output]; + return [list "fail" $output] } - return [list "pass" $output]; + return [list "pass" $output] } default { - gdb_comm_leave; + gdb_comm_leave if [board_info $dest exists unreliable] { if { [board_info $dest unreliable] > 0 } { - global board_info; - set name [board_info $dest name]; - incr board_info($name,unreliable) -1; - set result [gdb_comm_reload $dest $prog $args]; - incr board_info($name,unreliable); - return $result; + global board_info + set name [board_info $dest name] + incr board_info($name,unreliable) -1 + set result [gdb_comm_reload $dest $prog $args] + incr board_info($name,unreliable) + return $result } } - return [list "fail" ""]; + return [list "fail" ""] } } - gdb_comm_leave; - return [list "fail" ""]; + gdb_comm_leave + return [list "fail" ""] } # If we've tried less than 4 times to load PROG, reboot the target, restart GDB # and try again. Otherwise, return "untested". proc gdb_comm_reload { dest prog aargs } { - global try_again; + global try_again # how many times have we done this? set n_reloads [board_info $dest n_reloads] @@ -550,17 +550,17 @@ proc gdb_comm_reload { dest prog aargs } { } if { $try_again < 4 } { - global GDB; - remote_reboot $dest; - remote_close host; - incr try_again; + global GDB + remote_reboot $dest + remote_close host + incr try_again set result [eval remote_load \"$dest\" \"$prog\" $aargs] - set try_again 0; - return "$result"; + set try_again 0 + return "$result" } else { - set try_again 0; - return [list "untested" ""]; + set try_again 0 + return [list "untested" ""] } } -set_board_info protocol "gdb_comm"; +set_board_info protocol "gdb_comm" diff --git a/config/gdb_stub.exp b/config/gdb_stub.exp index a31fc87..746316c 100644 --- a/config/gdb_stub.exp +++ b/config/gdb_stub.exp @@ -36,61 +36,61 @@ proc gdb_stub_init { dest args } { } if [board_info $dest exists gdb_prompt] { - set gdb_prompt [board_info $dest gdb_prompt]; + set gdb_prompt [board_info $dest gdb_prompt] } else { set gdb_prompt "\\(gdb\\)" } - return 1; + return 1 } proc gdb_stub_restart { dest } { global gdb_prompt global GDB - gdb_stub_init $dest; + gdb_stub_init $dest for {set x 1;} { $x < 4 } {incr x} { - remote_close $dest; - sleep 2; - set command "$GDB -nw -nx"; + remote_close $dest + sleep 2 + set command "$GDB -nw -nx" if [host_info exists gdb_opts] { - append command " [host_info gdb_opts]"; + append command " [host_info gdb_opts]" } - set spawn_id [remote_spawn host $command]; + set spawn_id [remote_spawn host $command] remote_expect host 30 { -re "$gdb_prompt" { } } if { $spawn_id >= 0 } { if [board_info $dest exists baud] { - remote_send host "set remotebaud [board_info $dest baud]\n"; + remote_send host "set remotebaud [board_info $dest baud]\n" remote_expect host 5 { -re "$gdb_prompt" { } default { warning "Error setting baud rate." - return -1; + return -1 } } } - set value [gdb_stub_startup $dest]; + set value [gdb_stub_startup $dest] if { $value > 0 } { - break; + break } - verbose "got $value from gdb_stub_startup"; - remote_send host "quit\n"; + verbose "got $value from gdb_stub_startup" + remote_send host "quit\n" } - remote_reboot $dest; + remote_reboot $dest } if { ${x} < 4 } { - global board_info; - set name [board_info $dest name]; + global board_info + set name [board_info $dest name] - set board_info($name,gdb_is_running) 1; - return 1; + set board_info($name,gdb_is_running) 1 + return 1 } else { - return 0; + return 0 } } @@ -98,33 +98,33 @@ proc gdb_stub_remote_check { dest } { global gdb_prompt if [board_info $dest exists gdb_serial] { - set serial [board_info $dest gdb_serial]; + set serial [board_info $dest gdb_serial] } elseif [board_info $dest exists serial] { - set serial [board_info $dest serial]; + set serial [board_info $dest serial] } else { - set serial [board_info $dest netport]; + set serial [board_info $dest netport] } - remote_send host "target remote $serial\n"; + remote_send host "target remote $serial\n" remote_expect host 10 { -re "Couldn't establish connection.*$gdb_prompt" { - return 0; + return 0 } -re "Remote debugging.*$gdb_prompt" { verbose "stub is already running" - return 1; + return 1 } -re "$gdb_prompt" { - return 0; + return 0 } timeout { - remote_send host "\003"; + remote_send host "\003" remote_expect host 10 { -re "$gdb_prompt" { } } - return 0; + return 0 } default { - return 0; + return 0 } } } @@ -133,50 +133,50 @@ proc gdb_stub_startup { dest } { global gdb_prompt global GDB - set is_running_stub 0; + set is_running_stub 0 if [gdb_stub_remote_check $dest] { - set is_running_stub 1; + set is_running_stub 1 } if [board_info $dest exists serial] { - set serial [board_info $dest serial]; + set serial [board_info $dest serial] } else { - set serial [board_info $dest netport]; + set serial [board_info $dest netport] } if { ! $is_running_stub } { - set command "target [board_info $dest gdb_protocol] $serial\n"; - remote_send host $command; + set command "target [board_info $dest gdb_protocol] $serial\n" + remote_send host $command remote_expect host 5 { -re "already.*y or n." { - remote_send host "y\n"; - exp_continue; + remote_send host "y\n" + exp_continue } -re "appears to be alive.*$gdb_prompt" { } -re "Remote target.*connected to.*$gdb_prompt" { } default { - return -1; + return -1 } } } if { $is_running_stub == 0 } { global libdir - verbose "building loader"; - set loader "loader"; + verbose "building loader" + set loader "loader" if ![file exists $loader] { if [board_info $dest exists gdb_stub_offset] { - set result [target_compile "${libdir}/stub-loader.c" $loader executable "libs=-Wl,-Ttext,[board_info $dest gdb_stub_offset]"]; + set result [target_compile "${libdir}/stub-loader.c" $loader executable "libs=-Wl,-Ttext,[board_info $dest gdb_stub_offset]"] } else { - set result [target_compile "${libdir}/stub-loader.c" $loader executable "ldscript=[board_info $dest gdb_stub_ldscript]"]; + set result [target_compile "${libdir}/stub-loader.c" $loader executable "ldscript=[board_info $dest gdb_stub_ldscript]"] } - verbose "result is $result"; + verbose "result is $result" if [is_remote host] { - set loader [remote_download host $loader]; + set loader [remote_download host $loader] } } - remote_send host "file $loader\n"; + remote_send host "file $loader\n" remote_expect host 20 { -re "A program is being debug.*Kill it.*y or n. $" { remote_send host "y\n" @@ -189,27 +189,27 @@ proc gdb_stub_startup { dest } { -re "Reading symbols from.*done..*$gdb_prompt $" {} -re "$gdb_prompt $" { warning "GDB couldn't find loader" } timeout { - warning "(timeout) read symbol file" ; + warning "(timeout) read symbol file" return -1 } } if [board_info $dest exists serial] { - set serial [board_info $dest serial]; + set serial [board_info $dest serial] } else { - set serial [board_info $dest netport]; + set serial [board_info $dest netport] } - remote_send host "target [board_info $dest gdb_protocol] $serial\n"; + remote_send host "target [board_info $dest gdb_protocol] $serial\n" remote_expect host 60 { -re "appears to be alive.*$gdb_prompt" { } -re "Remote target.*connected to.*$gdb_prompt" { } -re "$gdb_prompt" { - warning "Error reconnecting to stub."; - return -1; + warning "Error reconnecting to stub." + return -1 } default { - warning "Error reconnecting to stub."; - return -1; + warning "Error reconnecting to stub." + return -1 } } @@ -218,23 +218,23 @@ proc gdb_stub_startup { dest } { if [board_info $dest exists gdb_load_offset] { remote_send host "load $loader [board_info $dest gdb_stub_offset]\n" } else { - remote_send host "load $loader\n"; + remote_send host "load $loader\n" } verbose "Loading $loader into $GDB" 2 global verbose - set no_run_command 0; + set no_run_command 0 # FIXME: The value 1200 below should be a parameter. remote_expect host 1200 { -re "Transfer rate:.*Switching to remote protocol.*Remote debugging" { - set no_run_command 1; - remote_send host ""; - sleep 2; - remote_send host ""; - sleep 1; + set no_run_command 1 + remote_send host "" + sleep 2 + remote_send host "" + sleep 1 } -re "Loading.*Starting.*at.*$gdb_prompt $" { verbose "Loaded $loader into $GDB" 1 - set no_run_command 1; + set no_run_command 1 } -re "Loading.*$gdb_prompt $" { verbose "Loaded $loader into $GDB" 1 @@ -252,7 +252,7 @@ proc gdb_stub_startup { dest } { } if { ! $no_run_command } { - remote_send host "run\n"; + remote_send host "run\n" remote_expect host 60 { -re "A program is being debug.*Kill it.*y or n. $" { remote_send host "y\n" @@ -263,19 +263,19 @@ proc gdb_stub_startup { dest } { exp_continue } -re "Starting program:.*loader.*$" { - verbose "Starting loader succeeded" + verbose "Starting loader succeeded" } timeout { - warning "(timeout) starting the loader" ; + warning "(timeout) starting the loader" return -1 } default { - warning "error starting the loader"; + warning "error starting the loader" } } - sleep 2; + sleep 2 remote_send host "" - sleep 1; + sleep 1 remote_send host "" verbose "Sent ^C^C" remote_expect host 30 { @@ -284,21 +284,21 @@ proc gdb_stub_startup { dest } { exp_continue } -re "$gdb_prompt $" { - verbose "Running loader succeeded" + verbose "Running loader succeeded" } timeout { - warning "(timeout) interrupting the loader" ; + warning "(timeout) interrupting the loader" return -1 } default { - warning "error interrupting the loader"; + warning "error interrupting the loader" } } } - remote_send host "quit\n"; - return [gdb_stub_restart $dest]; + remote_send host "quit\n" + return [gdb_stub_restart $dest] } - return 1; + return 1 } # @@ -323,7 +323,7 @@ proc gdb_stub_delete_breakpoints {} { -re "$gdb_prompt $" { warning "breakpoints not deleted" ; return -1} timeout { warning "info breakpoints (timeout)" ; return -1} } - return 0; + return 0 } proc gdb_stub_go_idle { dest } { @@ -345,68 +345,68 @@ proc gdb_stub_add_breakpoint { function args } { } proc gdb_stub_start { dest } { - global gdb_prompt; + global gdb_prompt - set exit_brnum [gdb_stub_add_breakpoint _exit]; + set exit_brnum [gdb_stub_add_breakpoint _exit] if { $exit_brnum == "undef" || [board_info $dest exists always_break_exit] } { - set exit_brnum [gdb_stub_add_breakpoint exit]; + set exit_brnum [gdb_stub_add_breakpoint exit] } - set abort_brnum [gdb_stub_add_breakpoint abort]; + set abort_brnum [gdb_stub_add_breakpoint abort] upvar #0 gdb_stub_info I set I($dest,exit_brnum) $exit_brnum set I($dest,abort_brnum) $abort_brnum - remote_send host "set \$fp=0\n"; + remote_send host "set \$fp=0\n" remote_expect host 10 { -re "$gdb_prompt" { } } # This is needed for the SparcLite. Whee. if [board_info $dest exists gdb,start_symbol] { - set start_comm "jump *[board_info $dest gdb,start_symbol]\n"; + set start_comm "jump *[board_info $dest gdb,start_symbol]\n" } else { - set start_comm "jump *start\n"; + set start_comm "jump *start\n" } - remote_send host "break copyloop\n"; + remote_send host "break copyloop\n" remote_expect host 10 { -re "Breakpoint.*$gdb_prompt $" { - set start_comm "continue\n"; + set start_comm "continue\n" } -re "Function.*not defined.*$gdb_prompt $" { } default { } } - remote_send host $start_comm; + remote_send host $start_comm remote_expect host 10 { -re "y or n. $" { remote_send host "y\n" - exp_continue; + exp_continue } -re "Breakpoint.*in copyloop.*$gdb_prompt $" { - remote_send host "jump relocd\n"; - exp_continue; + remote_send host "jump relocd\n" + exp_continue } -re "Continuing at.*\[\r\n\]" { } default { - return { "fail" "" }; + return { "fail" "" } } } - return { "pass" "" }; + return { "pass" "" } } proc gdb_stub_spawn { dest prog args } { for { set x 0; } { $x < 3 } { incr x } { if { [remote_ld $dest $prog] != 1 } { - return [list "fail" "remote_ld failed"]; + return [list "fail" "remote_ld failed"] } - set result [gdb_stub_start $dest]; + set result [gdb_stub_start $dest] if { [lindex $result 0] != "pass" } { - remote_reboot target; + remote_reboot target } else { return 666; # does anyone use this value? } } - return -1; + return -1 } proc gdb_stub_wait { dest timeout } { @@ -420,55 +420,55 @@ proc gdb_stub_wait { dest timeout } { remote_expect host $timeout { -re "Breakpoint.*exit.*=0.*$gdb_prompt $" { gdb_stub_go_idle $dest - return [list 0 ""]; + return [list 0 ""] } -re "Breakpoint.*exit.*=\[1-9\]\[0-9\]*.*$gdb_prompt $" { gdb_stub_go_idle $dest - return [list 0 ""]; + return [list 0 ""] } -re "Breakpoint.*exit.*$gdb_prompt $" { gdb_stub_go_idle $dest - return [list 0 ""]; + return [list 0 ""] } -re "Breakpoint.*abort.*$gdb_prompt $" { gdb_stub_go_idle $dest - return [list 1 ""]; + return [list 1 ""] } -re " EXIT code 0.*$gdb_prompt $" { - gdb_stub_go_idle $dest; - return [list 0 ""]; + gdb_stub_go_idle $dest + return [list 0 ""] } -re " EXIT code \[1-9]\[0-9]*.*$gdb_prompt $" { - gdb_stub_go_idle $dest; - return [list 0 ""]; + gdb_stub_go_idle $dest + return [list 0 ""] } -re " EXIT code 4242.*$gdb_prompt $" { - gdb_stub_go_idle $dest; - return [list 1 ""]; + gdb_stub_go_idle $dest + return [list 1 ""] } -re "Program received.*$gdb_prompt $" { gdb_stub_go_idle $dest - return [list 1 ""]; + return [list 1 ""] } -re "Program exited.*$gdb_prompt $" { gdb_stub_go_idle $dest - return [list 1 ""]; + return [list 1 ""] } -re "Breakpoint $exit_brnum.*$gdb_prompt $" { - gdb_stub_go_idle $dest; - return [list 0 ""]; + gdb_stub_go_idle $dest + return [list 0 ""] } -re "Breakpoint $abort_brnum.*$gdb_prompt $" { - gdb_stub_go_idle $dest; - return [list 1 ""]; + gdb_stub_go_idle $dest + return [list 1 ""] } default { - remote_close $dest; - remote_reboot $dest; - return [list -1 ""]; + remote_close $dest + remote_reboot $dest + return [list -1 ""] } } - return [list -1 ""]; + return [list -1 ""] } proc gdb_stub_load { dest prog args } { @@ -477,43 +477,43 @@ proc gdb_stub_load { dest prog args } { for { set x 0; } { $x < [llength $args] } { incr x } { if { [lindex $args $x] != "" } { - return [list "unsupported" "no support for [lindex $argnames $x] on this target"]; + return [list "unsupported" "no support for [lindex $argnames $x] on this target"] } } - set result [remote_spawn $dest $prog]; + set result [remote_spawn $dest $prog] if { $result < 0 } { - return [list "fail" "remote_spawn failed"]; + return [list "fail" "remote_spawn failed"] } # FIXME: The value 120 should be a parameter. - set result [remote_wait $dest 120]; - set status [lindex $result 0]; - set output [lindex $result 1]; + set result [remote_wait $dest 120] + set status [lindex $result 0] + set output [lindex $result 1] if { $status == 0 } { - return [list "pass" $output]; + return [list "pass" $output] } else if { $status > 0 } { - return [list "fail" $output]; + return [list "fail" $output] } else { - global gdb_stub_retry; + global gdb_stub_retry if ![info exists gdb_stub_retry] { - set gdb_stub_retry 1; + set gdb_stub_retry 1 - set result [eval gdb_stub_load \{$dest\} \{$prog\} $args]; - unset gdb_stub_retry; - return $result; + set result [eval gdb_stub_load \{$dest\} \{$prog\} $args] + unset gdb_stub_retry + return $result } else { - return [list "fail" $output]; + return [list "fail" $output] } } } # -# gdb_stub_ld -- load PROG into the board; +# gdb_stub_ld -- load PROG into the board # Returns a 0 if there was an error, # 1 if it loaded successfully. # @@ -523,7 +523,7 @@ proc gdb_stub_ld { dest prog } { if ![board_info $dest exists gdb_is_running] { if ![gdb_stub_restart $dest] { - return 0; + return 0 } } @@ -544,11 +544,11 @@ proc gdb_stub_ld { dest prog } { -re "$gdb_prompt $" { # Hmmm...is retrying going to help? I kinda doubt it. warning "GDB couldn't read file" - return [gdb_stub_retry_ld "$dest" "$prog"]; + return [gdb_stub_retry_ld "$dest" "$prog"] } timeout { - warning "(timeout) read symbol file"; - return [gdb_stub_retry_ld "$dest" "$prog"]; + warning "(timeout) read symbol file" + return [gdb_stub_retry_ld "$dest" "$prog"] } } @@ -556,17 +556,17 @@ proc gdb_stub_ld { dest prog } { gdb_stub_delete_breakpoints if [board_info $dest exists gdb_serial] { - set serial [board_info $dest gdb_serial]; + set serial [board_info $dest gdb_serial] } elseif [board_info $dest exists serial] { - set serial [board_info $dest serial]; + set serial [board_info $dest serial] } else { - set serial [board_info $dest netport]; + set serial [board_info $dest netport] } remote_send host "target remote $serial\n" remote_expect host 60 { -re "Kill it?.*y or n.*" { - remote_send host "y\n"; + remote_send host "y\n" exp_continue } -re "$gdb_prompt $" { @@ -579,13 +579,13 @@ proc gdb_stub_ld { dest prog } { } if [board_info $dest exists gdb_load_offset] { - set offset "[board_info $dest gdb_load_offset]"; + set offset "[board_info $dest gdb_load_offset]" } else { - set offset ""; + set offset "" } remote_send host "load $prog $offset\n" verbose "Loading $prog into $GDB" 2 - global verbose; + global verbose remote_expect host 1200 { -re "Loading.*$gdb_prompt $" { verbose "Loaded $prog into $GDB" 1 @@ -609,30 +609,30 @@ proc gdb_stub_ld { dest prog } { # proc gdb_stub_retry_ld { dest prog } { - global gdb_stub_retry_ld; + global gdb_stub_retry_ld - remote_reboot $dest; + remote_reboot $dest if [info exists gdb_stub_retry_ld] { - unset gdb_stub_retry_ld; - return 0; + unset gdb_stub_retry_ld + return 0 } else { - set gdb_stub_retry_ld 1; + set gdb_stub_retry_ld 1 } - gdb_stub_restart $dest; - set status [gdb_stub_ld $dest $prog]; + gdb_stub_restart $dest + set status [gdb_stub_ld $dest $prog] if [info exists gdb_stub_retry_ld] { - unset gdb_stub_retry_ld; + unset gdb_stub_retry_ld } - return $status; + return $status } proc gdb_stub_close { dest } { global board_info - set name [board_info $dest name]; + set name [board_info $dest name] if [info exists board_info($name,gdb_is_running)] { - unset board_info($name,gdb_is_running); + unset board_info($name,gdb_is_running) } - return [remote_close host]; + return [remote_close host] } set_board_info protocol "gdb_stub" diff --git a/config/h8300.exp b/config/h8300.exp index bd36fce..1affda1 100644 --- a/config/h8300.exp +++ b/config/h8300.exp @@ -17,4 +17,4 @@ # Please email any bugs, comments, and/or additions to this file to: # bug-dejagnu@gnu.org -load_generic_config "gdb-comm"; +load_generic_config "gdb-comm" diff --git a/config/i386-bozo.exp b/config/i386-bozo.exp index f25ac72..4e28116 100644 --- a/config/i386-bozo.exp +++ b/config/i386-bozo.exp @@ -17,30 +17,30 @@ # Please email any bugs, comments, and/or additions to this file to: # bug-dejagnu@gnu.org -load_generic_config "gdb-comm"; +load_generic_config "gdb-comm" proc ${board}_init { args } { - set linux_box [target_info linux_box]; - set bozo_server [target_info bozo_server]; - remote_spawn $linux_box "$bozo_server unknown"; + set linux_box [target_info linux_box] + set bozo_server [target_info bozo_server] + remote_spawn $linux_box "$bozo_server unknown" remote_expect $linux_box 60 { -re "port is (\[0-9\]+)" { - set_currtarget_info netport "${linux_box}:$expect_out(1,string)"; + set_currtarget_info netport "${linux_box}:$expect_out(1,string)" } } } proc ${board}_close { board } { - set linux_box [board_info $board linux_box]; + set linux_box [board_info $board linux_box] if [board_info $linux_box exists fileid] { - remote_send $linux_box "\003"; - remote_close $linux_box; + remote_send $linux_box "\003" + remote_close $linux_box } - standard_close $board; + standard_close $board } proc ${board}_reboot { board args } { - remote_close $board; - unset_currtarget_info netport; - return 1; + remote_close $board + unset_currtarget_info netport + return 1 } diff --git a/config/i960.exp b/config/i960.exp index e6f8bd3..1c722d6 100644 --- a/config/i960.exp +++ b/config/i960.exp @@ -23,22 +23,22 @@ # getting a valid prompt. # proc ${board}_init { dest } { - global i960_try_count; + global i960_try_count - set prompt [board_info $dest shell_prompt]; - set done 0; + set prompt [board_info $dest shell_prompt] + set done 0 if ![info exists i960_try_count] { - set i960_try_count 1; + set i960_try_count 1 } - remote_close $dest; + remote_close $dest if { [remote_open $dest] != "" } { for { set tries 0; } { $tries < 7 && ! $done } { incr tries } { - remote_send $dest "\n"; + remote_send $dest "\n" remote_expect $dest 1 { -re "${prompt}" { - set done 1; + set done 1 } -re ".+" { exp_continue } timeout { } @@ -46,18 +46,18 @@ proc ${board}_init { dest } { } } - remote_close $dest; + remote_close $dest if { ! $done } { if { $i960_try_count == 3 } { - perror "Couldn't connect to board."; + perror "Couldn't connect to board." } else { - incr i960_try_count; - remote_close $dest; - remote_reboot $dest; + incr i960_try_count + remote_close $dest + remote_reboot $dest } } if [info exists i960_try_count] { - unset i960_try_count; + unset i960_try_count } } @@ -66,156 +66,156 @@ proc i960_ld { dest prog } { perror "$prog does not exist." return "untested" } - set shell_prompt [board_info $dest shell_prompt]; - set strip [board_info $dest strip]; - set rprog [remote_download host $prog a.out]; + set shell_prompt [board_info $dest shell_prompt] + set strip [board_info $dest strip] + set rprog [remote_download host $prog a.out] if { $strip != "" } { - remote_exec host $strip $rprog; + remote_exec host $strip $rprog } - remote_upload host $rprog a.out; + remote_upload host $rprog a.out - set id [remote_open $dest]; + set id [remote_open $dest] if { $id < 0 } { - return -1; + return -1 } - remote_binary $dest; - remote_send $dest "\n"; + remote_binary $dest + remote_send $dest "\n" remote_expect $dest 5 { -re $shell_prompt { } } - remote_send $dest "do\n"; + remote_send $dest "do\n" remote_expect $dest 5 { -re "Downloading" { } } # Nasty. if { [board_info $dest connect] == "telnet" } { - global board_info; + global board_info - remote_close $dest; - set hp [split [board_info $dest netport] ":"]; - set host [lindex $hp 0]; - set port [lindex $hp 1]; - set status -1; + remote_close $dest + set hp [split [board_info $dest netport] ":"] + set host [lindex $hp 0] + set port [lindex $hp 1] + set status -1 while { $status != 0 } { - set status [catch "socket $host $port" id2]; + set status [catch "socket $host $port" id2] if { $status != 0 } { - sleep 5; + sleep 5 } } } else { - set id2 [exp_open -leaveopen -i $id]; + set id2 [exp_open -leaveopen -i $id] } if [catch "exec sx -bX a.out <@$id2 >@$id2 2>/dev/null" error] { perror "exec sx failed: $error" } if { [board_info $dest connect] == "telnet" } { - close $id2; - sleep 2; - remote_open $dest; - remote_binary $dest; + close $id2 + sleep 2 + remote_open $dest + remote_binary $dest } - set result 1; - remote_send $dest "\n"; + set result 1 + remote_send $dest "\n" remote_expect $dest 1 { -re "$shell_prompt" { - set result 0; - exp_continue; + set result 0 + exp_continue } timeout { } } - return $result; + return $result } proc i960_spawn { dest prog args } { - set shell_prompt [board_info $dest shell_prompt]; + set shell_prompt [board_info $dest shell_prompt] for { set tries 0 ; } { $tries < 3 } { incr tries } { - set result [remote_ld $dest $prog]; + set result [remote_ld $dest $prog] if { $result == 0 } { - set comm "go [board_info $dest start_addr]"; - remote_send $dest "$comm\n"; + set comm "go [board_info $dest start_addr]" + remote_send $dest "$comm\n" remote_expect $dest 10 { -re "$comm\[\r\n\]\[\r\n\]?" { } default { } } - return [board_info $dest fileid]; + return [board_info $dest fileid] } else { - remote_reboot $dest; + remote_reboot $dest } } - return -1; + return -1 } proc i960_wait { dest timeout } { - set output ""; - set shell_prompt [board_info $dest shell_prompt]; + set output "" + set shell_prompt [board_info $dest shell_prompt] remote_expect $dest $timeout { -re " fault at \[0-9a-h\]+, subtype \[0-9a-h\]+" { - set status -1; - exp_continue; + set status -1 + exp_continue } -re "(.*)(\[\r\n\]|^)Program Exit: (\[0-9\]+)\[\r\n\]" { - append output $expect_out(1,string); - set status $expect_out(3,string); - exp_continue; + append output $expect_out(1,string) + set status $expect_out(3,string) + exp_continue } -re "(.*)$shell_prompt" { - append output $expect_out(1,string); - set bstatus [check_for_board_status output]; + append output $expect_out(1,string) + set bstatus [check_for_board_status output] if { $bstatus >= 0 } { - set status $bstatus; + set status $bstatus } } -re "\[\r\n\]+" { # Sometimes the board goes wacky in the head, and we have # to shoot it. - append output $expect_out(buffer); + append output $expect_out(buffer) if { [string length $output] < 512000 } { - exp_continue; + exp_continue } else { - set status -1; + set status -1 } } default { - set status -1; + set status -1 } } - return [list $status $output]; + return [list $status $output] } proc i960_load { dest prog args } { for { set x 0; } { $x < 3 } { incr x; } { - set id [eval remote_spawn \{$dest\} \{$prog\} $args]; + set id [eval remote_spawn \{$dest\} \{$prog\} $args] if { $id < 0 } { - return [list "fail" ""]; + return [list "fail" ""] } - set result [remote_wait $dest 120]; - set status [lindex $result 0]; - set output [lindex $result 1]; + set result [remote_wait $dest 120] + set status [lindex $result 0] + set output [lindex $result 1] if { $status == 0 } { - return [list "pass" $output]; + return [list "pass" $output] } else { - global i960_retry; + global i960_retry if { [board_info $dest exists unreliable] && ![info exists i960_retry] } { - set i960_retry 1; - remote_reboot $dest; - set result [eval i960_load \{$dest\} \{$prog\} $args]; - unset i960_retry; - return $result; + set i960_retry 1 + remote_reboot $dest + set result [eval i960_load \{$dest\} \{$prog\} $args] + unset i960_retry + return $result } else { if { $status < 0 } { - remote_reboot $dest; + remote_reboot $dest } - return [list "fail" $output]; + return [list "fail" $output] } } } } -set_board_info shell_prompt "=>"; -set_board_info send_initial_cr 1; +set_board_info shell_prompt "=>" +set_board_info send_initial_cr 1 # We take care of getting a prompt in ${board}_init. -set_board_info dont_wait_for_prompt 1; +set_board_info dont_wait_for_prompt 1 diff --git a/config/m32r-stub.exp b/config/m32r-stub.exp index d5bbeb1..fa43509 100644 --- a/config/m32r-stub.exp +++ b/config/m32r-stub.exp @@ -17,4 +17,4 @@ # Please email any bugs, comments, and/or additions to this file to: # bug-dejagnu@gnu.org -load_generic_config "gdb_stub"; +load_generic_config "gdb_stub" diff --git a/config/m32r.exp b/config/m32r.exp index bd36fce..1affda1 100644 --- a/config/m32r.exp +++ b/config/m32r.exp @@ -17,4 +17,4 @@ # Please email any bugs, comments, and/or additions to this file to: # bug-dejagnu@gnu.org -load_generic_config "gdb-comm"; +load_generic_config "gdb-comm" diff --git a/config/m68hc11.exp b/config/m68hc11.exp index 6c1fa65..fa8097c 100644 --- a/config/m68hc11.exp +++ b/config/m68hc11.exp @@ -17,4 +17,4 @@ # Please email any bugs, comments, and/or additions to this file to: # bug-dejagnu@gnu.org -load_generic_config "gdb-comm"; +load_generic_config "gdb-comm" diff --git a/config/m68k-emc.exp b/config/m68k-emc.exp index 6b13dc1..d6db29b 100644 --- a/config/m68k-emc.exp +++ b/config/m68k-emc.exp @@ -18,34 +18,34 @@ # bug-dejagnu@gnu.org proc ${board}_init { dest } { - global doing_emc_init; + global doing_emc_init if [info exists doing_emc_init] { - return; + return } - set doing_emc_init 1; - remote_close $dest; - set dos_host [board_info $dest dos_host]; - remote_reboot $dos_host; - unset doing_emc_init; + set doing_emc_init 1 + remote_close $dest + set dos_host [board_info $dest dos_host] + remote_reboot $dos_host + unset doing_emc_init } proc m68k_emc_board_connect { dest } { - global board_info; - set tname [board_info $dest name]; + global board_info + set tname [board_info $dest name] - set board_info($tname,m68k_connected) 1; - set dos_host [board_info $dest dos_host]; + set board_info($tname,m68k_connected) 1 + set dos_host [board_info $dest dos_host] for { set x 0; } { $x < 3 } { incr x; } { - set shell_id [remote_open $dos_host]; + set shell_id [remote_open $dos_host] if { $shell_id == "" || $shell_id < 0 } { - remote_reboot $dos_host; + remote_reboot $dos_host } else { - break; + break } } - remote_send $dos_host "c:\\symetrix.bat\n"; + remote_send $dos_host "c:\\symetrix.bat\n" remote_expect $dos_host 300 { -re "SymmComm.*Installed.*\033.2J.*\033.2J" { } default { @@ -57,13 +57,13 @@ proc m68k_emc_board_connect { dest } { -re ".+" { exp_continue; } } # Get past first menu. - remote_send $dos_host "\n"; + remote_send $dos_host "\n" remote_expect $dos_host 10 { -re "\033.07;02H" { } default { } } # We don't want a log file. - remote_send $dos_host "\n"; + remote_send $dos_host "\n" remote_expect $dos_host 10 { -re "\033.02;24H" { } default { } diff --git a/config/mips-idt.exp b/config/mips-idt.exp index f5427e9..76c7ca2 100644 --- a/config/mips-idt.exp +++ b/config/mips-idt.exp @@ -19,6 +19,6 @@ # For MIPS/IDT we use gdb to load and execute programs. -load_generic_config "gdb-comm"; +load_generic_config "gdb-comm" -set_board_info gdb_init_command "set syn-garbage-limit 0"; +set_board_info gdb_init_command "set syn-garbage-limit 0" diff --git a/config/mn10200-eval.exp b/config/mn10200-eval.exp index 54bb269..0f7a051 100644 --- a/config/mn10200-eval.exp +++ b/config/mn10200-eval.exp @@ -19,4 +19,4 @@ # For MN10200 evaluation boards we use gdb to load and execute programs. -load_generic_config "gdb-comm"; +load_generic_config "gdb-comm" diff --git a/config/mn10300-eval.exp b/config/mn10300-eval.exp index 1e3e42c..3405287 100644 --- a/config/mn10300-eval.exp +++ b/config/mn10300-eval.exp @@ -19,4 +19,4 @@ # For MN10300 evaluation boards we use gdb to load and execute programs. -load_generic_config "gdb-comm"; +load_generic_config "gdb-comm" diff --git a/config/netware.exp b/config/netware.exp index 5658de2..af670b1 100644 --- a/config/netware.exp +++ b/config/netware.exp @@ -37,11 +37,11 @@ proc ${board}_init { args } { } set shell_prompt "Password:" - set shell_id [remote_open target]; + set shell_id [remote_open target] if [target_info exists passwd] { - set passwd [target_info passwd]; + set passwd [target_info passwd] } else { - set passwd ""; + set passwd "" } if $shell_id<0 then { warning "Couldn't connect to target" @@ -95,9 +95,9 @@ proc ${board}_load { dest prog args } { global errorCode if [board_info $dest exists fileid] { - set shell_id [board_info $dest fileid]; + set shell_id [board_info $dest fileid] } else { - set shell_id -1; + set shell_id -1 } set output "" @@ -210,5 +210,5 @@ proc ${board}_load { dest prog args } { # proc ${board}_exit {} { - remote_close target; + remote_close target } diff --git a/config/powerpc-bug.exp b/config/powerpc-bug.exp index bd36fce..1affda1 100644 --- a/config/powerpc-bug.exp +++ b/config/powerpc-bug.exp @@ -17,4 +17,4 @@ # Please email any bugs, comments, and/or additions to this file to: # bug-dejagnu@gnu.org -load_generic_config "gdb-comm"; +load_generic_config "gdb-comm" diff --git a/config/proelf.exp b/config/proelf.exp index e816a49..5c34681 100644 --- a/config/proelf.exp +++ b/config/proelf.exp @@ -17,9 +17,9 @@ # Please email any bugs, comments, and/or additions to this file to: # bug-dejagnu@gnu.org -load_generic_config "base68k"; +load_generic_config "base68k" set_board_info shell_prompt "#" -set_board_info download_command "r 0\n"; +set_board_info download_command "r 0\n" set_board_info go_command "g" set_board_info startaddr "40000" diff --git a/config/rom68k.exp b/config/rom68k.exp index f8a8143..9e9d0ca 100644 --- a/config/rom68k.exp +++ b/config/rom68k.exp @@ -20,11 +20,11 @@ # This file was written by Bob Manson (manson@cygnus.com) # based on earlier work by J.T. Conklin (jtc@cygnus.com) -load_generic_config "base68k"; +load_generic_config "base68k" set_board_info shell_prompt "ROM68K :-> " -set_board_info download_command "DC\n"; -set_board_info download_response "Waiting for S-records from host... "; +set_board_info download_command "DC\n" +set_board_info download_response "Waiting for S-records from host... " set_board_info go_command "GO" set_board_info startaddr "10000" set_board_info hex_startaddr "0x10000" diff --git a/config/sh.exp b/config/sh.exp index bd36fce..1affda1 100644 --- a/config/sh.exp +++ b/config/sh.exp @@ -17,4 +17,4 @@ # Please email any bugs, comments, and/or additions to this file to: # bug-dejagnu@gnu.org -load_generic_config "gdb-comm"; +load_generic_config "gdb-comm" diff --git a/config/sid.exp b/config/sid.exp index 0805b40..fceaf0d 100644 --- a/config/sid.exp +++ b/config/sid.exp @@ -42,7 +42,7 @@ proc set_host_info { entry value } { set machine host if [info exists target_info($machine,name)] { - set machine $target_info($machine,name); + set machine $target_info($machine,name) } set board_info($machine,$entry) $value } diff --git a/config/sim.exp b/config/sim.exp index 2441a7c..3471f27 100644 --- a/config/sim.exp +++ b/config/sim.exp @@ -28,7 +28,7 @@ proc sim_spawn { dest cmdline args } { perror "no simulator defined for [board_info $dest name]" exit 1 } else { - set sim [board_info $dest sim]; + set sim [board_info $dest sim] } if [board_info $dest exists sim,options] { @@ -40,7 +40,7 @@ proc sim_spawn { dest cmdline args } { if ![is_remote host] { if { [which $sim] == 0 } { verbose -log "Simulator $sim missing." 3 - return -1; + return -1 } } @@ -49,15 +49,15 @@ proc sim_spawn { dest cmdline args } { # we're assuming the program is the first word in the command. # FIXME: "prog < infile" won't work until we download infile. set prog [lindex $cmdline 0] - set prog [remote_download host $prog a.out]; + set prog [remote_download host $prog a.out] set cmdline [lreplace $cmdline 0 0 $prog] } - return [eval remote_spawn host \{ $sim $simflags $cmdline \} $args]; + return [eval remote_spawn host \{ $sim $simflags $cmdline \} $args] } proc sim_wait { dest timeout } { - return [remote_wait host $timeout]; + return [remote_wait host $timeout] } proc sim_load { dest prog args } { @@ -71,16 +71,16 @@ proc sim_load { dest prog args } { if ![file exists $prog] then { perror "sim.exp: $prog to be downloaded does not exist." verbose -log "$prog to be downloaded does not exist." 3 - return [list "untested" ""]; + return [list "untested" ""] } if [board_info $dest exists sim_time_limit] { - set sim_time_limit [board_info $dest sim_time_limit]; + set sim_time_limit [board_info $dest sim_time_limit] } else { set sim_time_limit 240 } - set output ""; + set output "" if { [board_info target sim,protocol] == "sid" } { set cmd "-e \"set cpu-loader file [list $prog]\"" @@ -94,21 +94,21 @@ proc sim_load { dest prog args } { # this isn't as nice as limiting the amount of CPU time, it # will have to do. if { $inpfile != "" } { - set res [remote_spawn target "${cmd} < $inpfile" "readonly"]; + set res [remote_spawn target "${cmd} < $inpfile" "readonly"] } else { - set res [remote_spawn target "${cmd}"]; + set res [remote_spawn target "${cmd}"] } if { $res <= 0 } { - return [list "fail" "remote_spawn failed"]; + return [list "fail" "remote_spawn failed"] } - set state [remote_wait target $sim_time_limit]; - set status [lindex $state 0]; - set output [lindex $state 1]; - verbose "Output is $output"; + set state [remote_wait target $sim_time_limit] + set status [lindex $state 0] + set output [lindex $state 1] + verbose "Output is $output" - set status2 [check_for_board_status output]; + set status2 [check_for_board_status output] if { $status2 >= 0 } { set status $status2 } @@ -122,10 +122,10 @@ proc sim_load { dest prog args } { } else { set result "fail" } - return [list $result $output]; + return [list $result $output] } -set_board_info protocol "sim"; +set_board_info protocol "sim" # By default, assume the simulator is slow. This causes some tests # to either be simplified or skipped completely. diff --git a/config/slite.exp b/config/slite.exp index 081666b..392e347 100644 --- a/config/slite.exp +++ b/config/slite.exp @@ -17,4 +17,4 @@ # Please email any bugs, comments, and/or additions to this file to: # bug-dejagnu@gnu.org -load_generic_config "gdb_stub"; +load_generic_config "gdb_stub" diff --git a/config/sparclet.exp b/config/sparclet.exp index 9d478ce..9f13e68 100644 --- a/config/sparclet.exp +++ b/config/sparclet.exp @@ -19,8 +19,8 @@ # This file was written by Michael Snyder <msnyder@cygnus.com>. -load_generic_config "gdb_stub"; +load_generic_config "gdb_stub" # This is the old GDB prompt for the toolchain. # Uncomment for old tests -#set_board_info gdb_prompt "\\(gdbslet\\)"; +#set_board_info gdb_prompt "\\(gdbslet\\)" diff --git a/config/tic80.exp b/config/tic80.exp index 817fa64..feeb5f2 100644 --- a/config/tic80.exp +++ b/config/tic80.exp @@ -26,75 +26,75 @@ # proc tic80_load { dest prog args } { - set dos_box [board_info $dest dos_host]; + set dos_box [board_info $dest dos_host] - remote_spawn $dos_box [board_info $dest io_program]; + remote_spawn $dos_box [board_info $dest io_program] - set status [remote_ld $dest $prog]; + set status [remote_ld $dest $prog] if { $status != "pass" } { - return $status; + return $status } - set result [remote_wait $dos_box 300]; - set output [lindex $result 1]; + set result [remote_wait $dos_box 300] + set output [lindex $result 1] if { [lindex $result 0] < 0 } { if [board_info $dos_box exists fileid] { - dos_interrupt_job $dos_box; + dos_interrupt_job $dos_box } else { - remote_close $dos_box; + remote_close $dos_box } } - set status "fail"; - regsub "(\\*\\*\\* EXIT code \[0-9\]+\[\r\n]+).*$" "$output" "\\1" output; - verbose "board out is $output"; - set bstatus [check_for_board_status output]; + set status "fail" + regsub "(\\*\\*\\* EXIT code \[0-9\]+\[\r\n]+).*$" "$output" "\\1" output + verbose "board out is $output" + set bstatus [check_for_board_status output] if { [lindex $result 0] >= 0 } { if { $bstatus == 0 } { - set status "pass"; + set status "pass" } } - remote_file build delete "a.fix"; - return [list $status $output]; + remote_file build delete "a.fix" + return [list $status $output] } proc tic80_ld { dest prog } { - set dos_box [board_info $dest dos_host]; - set dopush 0; + set dos_box [board_info $dest dos_host] + set dopush 0 if { [remote_swap_conn $dos_box] == "fail" } { if { [remote_push_conn $dos_box] == "fail" } { - set dopush 1; + set dopush 1 } - remote_open $dos_box; + remote_open $dos_box } - set prog [remote_download $dos_box $prog "a.fix"]; + set prog [remote_download $dos_box $prog "a.fix"] - remote_spawn $dos_box "[board_info $dest start_program] $prog"; + remote_spawn $dos_box "[board_info $dest start_program] $prog" remote_expect $dos_box 10 { -re "file\[(\]s\[)\] copied" {} } - sleep 3; - dos_interrupt_job $dos_box; + sleep 3 + dos_interrupt_job $dos_box if { $dopush } { - remote_push_conn $dos_box; + remote_push_conn $dos_box } else { - remote_swap_conn $dos_box; + remote_swap_conn $dos_box } - return "pass"; + return "pass" } # # Close the connection to the DOS box. # proc tic80_close { host } { - set dos_box [board_info $host dos_host]; + set dos_box [board_info $host dos_host] - return [remote_close $dos_box]; + return [remote_close $dos_box] } -set_board_info protocol "tic80"; -set_board_info gdb,use_standard_load 1; -set_board_info gdb,no_push_conn 1; -set_board_info gdb,do_reload_on_run 1; +set_board_info protocol "tic80" +set_board_info gdb,use_standard_load 1 +set_board_info gdb,no_push_conn 1 +set_board_info gdb,do_reload_on_run 1 set_board_info gdb,use_breakpoint_for_stub 1 diff --git a/config/udi.exp b/config/udi.exp index 4719d45..c7a7f07 100644 --- a/config/udi.exp +++ b/config/udi.exp @@ -30,18 +30,18 @@ # proc udi_load { dest prog args } { - set shell_prompt [board_info $dest shell_prompt]; - set output ""; + set shell_prompt [board_info $dest shell_prompt] + set output "" if ![file exists $prog] then { perror "$prog does not exist." verbose -log "$prog does not exist." 3 - return [list "untested" ""]; + return [list "untested" ""] } # Load the program. if ![board_info $dest exists fileid] then { - remote_open $dest; + remote_open $dest if ![board_info $dest exists fileid] then { verbose -log "$prog not executed, couldn't connect to $dest." 3 return "untested" @@ -50,50 +50,50 @@ proc udi_load { dest prog args } { if { [remote_ld $dest $prog] == "" } { verbose -log "$prog not executed, load failed." 3 - return [list "unresolved" ""]; + return [list "unresolved" ""] } # Execute it. set result -1 - set output ""; - set noappend 0; + set output "" + set noappend 0 verbose "Executing $prog." 2 remote_send $dest "g\n" # FIXME: The value 300 below should be a parameter. remote_expect $dest 300 { -re "(.*)Process exited with 0x0\[^\r\n\]*\[\r\n\]" { - append output $expect_out(1,string); + append output $expect_out(1,string) verbose "$prog executed successfully" 2 - set noappend 1; - set result 0; - exp_continue; + set noappend 1 + set result 0 + exp_continue } -re "(.*)Halt instruction encountered" { - append output $expect_out(1,string); + append output $expect_out(1,string) verbose "$prog got a HALT instruction" 2 - set result 1; - set noappend 1; - exp_continue; + set result 1 + set noappend 1 + exp_continue } -re "(^|\[\r\n\])$shell_prompt" { if { $result == -1 } { - exp_continue; + exp_continue } } -re "(^|\[\r\n\]+)g\[\r\n\]+" { - exp_continue; + exp_continue } -re "\[\r\n\]+" { if { ! $noappend } { - append output $expect_out(buffer); + append output $expect_out(buffer) if { [string length $output] < 512000 } { - exp_continue; + exp_continue } else { - set result 1; + set result 1 } } else { - exp_continue; + exp_continue } } timeout { @@ -104,12 +104,12 @@ proc udi_load { dest prog args } { # See what happened. switch -- $result { 0 { - set status [check_for_board_status output]; + set status [check_for_board_status output] if { $status < 0 } { blammo } if { $status > 0 } { - set result "fail"; + set result "fail" } else { set result "pass" } @@ -125,7 +125,7 @@ proc udi_load { dest prog args } { # Get nastier. We want to leave the system in a state # ready to run the next testcase. remote_send $dest "q\n" - remote_close $dest; + remote_close $dest set udi_shell_id [remote_open $dest] if { $udi_shell_id < 0 } { perror "Couldn't reset $dest." @@ -142,7 +142,7 @@ proc udi_load { dest prog args } { set result "unresolved" } } - return [list $result $output]; + return [list $result $output] } # @@ -150,9 +150,9 @@ proc udi_load { dest prog args } { # proc udi_exit {} { - remote_close target; + remote_close target } -set_board_info protocol "udi"; -set_board_info connect "mondfe"; -set_board_info shell_prompt "mondfe>"; +set_board_info protocol "udi" +set_board_info connect "mondfe" +set_board_info shell_prompt "mondfe>" diff --git a/config/unix.exp b/config/unix.exp index 971ed2a..c8263d7 100644 --- a/config/unix.exp +++ b/config/unix.exp @@ -39,13 +39,13 @@ proc unix_load { dest prog args } { set orig_ld_library_path "" if { [llength $args] > 0 } { - set parg [lindex $args 0]; + set parg [lindex $args 0] } else { set parg "" } if { [llength $args] > 1 } { - set inp [lindex $args 1]; + set inp [lindex $args 1] } else { set inp "" } @@ -61,7 +61,7 @@ proc unix_load { dest prog args } { if { "$inp" != "" } { set command "$prog $parg < $inp" } else { - set command "$prog $parg"; + set command "$prog $parg" } if ![info exists ld_library_path] { @@ -73,14 +73,14 @@ proc unix_load { dest prog args } { setenv SHLIB_PATH "$ld_library_path:$orig_ld_library_path" verbose -log "Setting LD_LIBRARY_PATH to $ld_library_path:$orig_ld_library_path" 2 - set id [remote_spawn $dest "$command" "readonly"]; + set id [remote_spawn $dest "$command" "readonly"] if { $id < 0 } { set output "remote_spawn failed" - set status -1; + set status -1 } else { - set status [remote_wait $dest 300]; - set output [lindex $status 1]; - set status [lindex $status 0]; + set status [remote_wait $dest 300] + set output [lindex $status 1] + set status [lindex $status 0] } # Unset them so we don't potentially get hosed when we try to run a # non-testcase executable. (Setting LD_LIBRARY_PATH is the wrong @@ -92,10 +92,10 @@ proc unix_load { dest prog args } { } } else { set remotefile "/tmp/[file tail $prog].[pid]" - set remotefile [remote_download $dest $prog $remotefile]; + set remotefile [remote_download $dest $prog $remotefile] if { $remotefile == "" } { verbose -log "Download of $prog to [board_info $dest name] failed." 3 - return [list "unresolved" ""]; + return [list "unresolved" ""] } if [board_info $dest exists remote_link] { if [[board_info $dest remote_link] $remotefile] { @@ -111,11 +111,11 @@ proc unix_load { dest prog args } { if { [lindex $status 0] != 0 } { remote_file $dest delete ${remotefile}.o $remotefile verbose -log "chmod +x of $prog on $dest failed." 3 - return [list "unresolved" ""]; + return [list "unresolved" ""] } } set status [remote_exec $dest "$remotefile" $parg $inp] - remote_file $dest delete $remotefile.o $remotefile; + remote_file $dest delete $remotefile.o $remotefile if { [lindex $status 0] < 0 } { verbose -log "Couldn't execute $prog, [lindex $status 1]" 3 return [list "unresolved" ""] @@ -132,11 +132,11 @@ proc unix_load { dest prog args } { verbose -- "$output" 2 } if { $status == 0 } { - set result "pass"; + set result "pass" } else { - set result "fail"; + set result "fail" } - return [list $result $output]; + return [list $result $output] } -set_board_info protocol "unix"; +set_board_info protocol "unix" diff --git a/config/vr4100.exp b/config/vr4100.exp index 00b96eb..9a9bb0c 100644 --- a/config/vr4100.exp +++ b/config/vr4100.exp @@ -18,4 +18,4 @@ # bug-dejagnu@gnu.org # We're using a ddb monitor. -load_generic_config "ddb"; +load_generic_config "ddb" diff --git a/config/vr4300.exp b/config/vr4300.exp index 00b96eb..9a9bb0c 100644 --- a/config/vr4300.exp +++ b/config/vr4300.exp @@ -18,4 +18,4 @@ # bug-dejagnu@gnu.org # We're using a ddb monitor. -load_generic_config "ddb"; +load_generic_config "ddb" diff --git a/config/vr5000.exp b/config/vr5000.exp index f95d597..b5338e3 100644 --- a/config/vr5000.exp +++ b/config/vr5000.exp @@ -18,4 +18,4 @@ # bug-dejagnu@gnu.org # We're using a ddb monitor, but we want to use the ethernet to load files. -load_generic_config "ddb-ether"; +load_generic_config "ddb-ether" diff --git a/config/vrtx.exp b/config/vrtx.exp index 95288b6..298a8e1 100644 --- a/config/vrtx.exp +++ b/config/vrtx.exp @@ -33,7 +33,7 @@ load_lib remote.exp # proc vrtx_load { dest prog args } { - remote_open $dest; + remote_open $dest switch -- [remote_download $dest $prog] { 0 { return "pass" } diff --git a/config/vxworks.exp b/config/vxworks.exp index 81af297..e47d5d8 100644 --- a/config/vxworks.exp +++ b/config/vxworks.exp @@ -25,90 +25,90 @@ # proc ${board}_init { dest } { # This is not the right way to determine the required OS... - global target_os; - set shell_prompt [board_info $dest shell_prompt]; - set do_reboot 0; + global target_os + set shell_prompt [board_info $dest shell_prompt] + set do_reboot 0 - set desired_kernel [board_info $dest "kernel,$target_os"]; + set desired_kernel [board_info $dest "kernel,$target_os"] if { $desired_kernel == "" } { - vxworks_final_init $dest; + vxworks_final_init $dest # Nothing to see here, nothing to do. Move along. - return; + return } - remote_raw_open $dest raw; - remote_send $dest "\n"; + remote_raw_open $dest raw + remote_send $dest "\n" remote_expect $dest 5 { -re "$shell_prompt" { - set do_reboot 1; + set do_reboot 1 } -re "Press any key to stop auto-boot" { - remote_send $dest "\n"; - exp_continue; + remote_send $dest "\n" + exp_continue } -re "VxWorks Boot" { - set boot_mon 0; - set boot_mon_prompt "VxWorks Boot"; + set boot_mon 0 + set boot_mon_prompt "VxWorks Boot" } -re "\[0-9\]\[\r\n\]+ *\[0-9\]\[\r\n\]" { - remote_send $dest "\n"; - exp_continue; + remote_send $dest "\n" + exp_continue } timeout { - set do_reboot 1; + set do_reboot 1 } } if { $do_reboot } { - remote_close $dest; - remote_reboot $dest; - return; + remote_close $dest + remote_reboot $dest + return } - remote_binary $dest; - remote_send $dest "\n\n"; + remote_binary $dest + remote_send $dest "\n\n" remote_expect $dest 3 { timeout {} -re ".+" { exp_continue; } } - remote_send $dest "p\n"; + remote_send $dest "p\n" remote_expect $dest 20 { -re "file name\[ \t\]+: (\[^ \r\n\]+)\[ \r\n\]+" { - set curr_file $expect_out(1,string); - exp_continue; + set curr_file $expect_out(1,string) + exp_continue } -re "$boot_mon_prompt" { } } if ![info exists curr_file] { - remote_close $dest; - remote_reboot $dest; - return; + remote_close $dest + remote_reboot $dest + return } if { $curr_file != $desired_kernel } { - verbose "$curr_file != '$desired_kernel'"; + verbose "$curr_file != '$desired_kernel'" # Oh boy. - remote_send $dest "c\n"; + remote_send $dest "c\n" remote_expect $dest 20 { -re "file name\[ \t\]+:.*$" { - remote_send $dest "$desired_kernel\n"; - exp_continue; + remote_send $dest "$desired_kernel\n" + exp_continue } -re "\[a-z() \t\]+:.*$" { - remote_send $dest "\n"; - exp_continue; + remote_send $dest "\n" + exp_continue } -re "$boot_mon_prompt" {} } } - remote_send $dest "@\n"; + remote_send $dest "@\n" remote_expect $dest 30 { -re "(^|\[\r\n\])$shell_prompt" {} -re ".+" { - exp_continue; + exp_continue } } - vxworks_final_init $dest; - remote_close $dest; + vxworks_final_init $dest + remote_close $dest } proc vxworks_final_init { dest } { @@ -116,7 +116,7 @@ proc vxworks_final_init { dest } { if { [target_compile [board_info $dest preload_obj] foo.out object [board_info $dest preload_obj_flags]] == "" } { vxworks_ld $dest foo.out } - remote_file build delete foo.out; + remote_file build delete foo.out } } # @@ -124,102 +124,102 @@ proc vxworks_final_init { dest } { # proc vxworks_exec { dest program pargs inp outp } { - global decimal hex; + global decimal hex - set shell_id [vxworks_open $dest]; + set shell_id [vxworks_open $dest] if { $shell_id < 0 } { - return [list -1 "open failure"]; + return [list -1 "open failure"] } if { $inp != "" } { - set inp [remote_download $dest $inp]; - set suffix " < $inp"; + set inp [remote_download $dest $inp] + set suffix " < $inp" } else { set suffix "" } - set shell_prompt [board_info $dest shell_prompt]; - remote_send $dest "${program} ${pargs}$suffix\n"; + set shell_prompt [board_info $dest shell_prompt] + remote_send $dest "${program} ${pargs}$suffix\n" # FIXME: The value 300 below should probably be a parameter passed in. remote_expect $dest 300 { -re "\\\[VxWorks Boot\\\]:" { - remote_send $dest "@\n"; - sleep 20; - exp_continue; + remote_send $dest "@\n" + sleep 20 + exp_continue } -re "(.*)value = (-*$decimal) = $hex\[^\r\n\]*\[\r\n\]+$shell_prompt" { - set result [list $expect_out(2,string) $expect_out(1,string)]; + set result [list $expect_out(2,string) $expect_out(1,string)] } -re "undefined symbol: .*$shell_prompt" { - set result [list 1 "unknown command"]; + set result [list 1 "unknown command"] } -re "syntax error.*$shell_prompt" { - set result [list -1 "syntax error in command"]; + set result [list -1 "syntax error in command"] } default { - set result [list -1 "unable to execute command"]; + set result [list -1 "unable to execute command"] } } if { $suffix != "" } { - remote_file $dest delete $inp; + remote_file $dest delete $inp } - return $result; + return $result } proc vxworks_download { dest localfile remotefile } { if [board_info $dest exists vxworks_homedir] { - set rfile "[board_info $dest vxworks_homedir]/$remotefile"; - remote_download build $localfile $rfile; - return $rfile; + set rfile "[board_info $dest vxworks_homedir]/$remotefile" + remote_download build $localfile $rfile + return $rfile } - return [remote_raw_download $dest $localfile $remotefile]; + return [remote_raw_download $dest $localfile $remotefile] } proc vxworks_file { dest op args } { - set file [lindex $args 0]; + set file [lindex $args 0] if [board_info $dest exists vxworks_homedir] { - set dir "[board_info $dest vxworks_homedir]"; + set dir "[board_info $dest vxworks_homedir]" switch $op { exists { - set file "${dir}/[file tail $file]"; - return [file exists $file]; + set file "${dir}/[file tail $file]" + return [file exists $file] } delete { foreach x $args { - set x "${dir}/[file tail $x]"; + set x "${dir}/[file tail $x]" if { [file exists $x] && [file isfile $x] } { - exec rm -f $x; + exec rm -f $x } } - return; + return } } } - return [eval remote_raw_file \"$dest\" \"$op\" $args]; + return [eval remote_raw_file \"$dest\" \"$op\" $args] } proc vxworks_send { dest string } { # Convert LFs to CRs, 'cause that is what VxWorks wants to see. - regsub -all "\n" $string "\r" string; + regsub -all "\n" $string "\r" string verbose "Sending '$string' to $dest" 2 - return [remote_raw_send $dest "$string"]; + return [remote_raw_send $dest "$string"] } proc vxworks_open { dest args } { if [board_info $dest exists fileid] { - return [board_info $dest fileid]; + return [board_info $dest fileid] } set shell_prompt [board_info $dest shell_prompt] - set shell_id [remote_raw_open $dest]; + set shell_id [remote_raw_open $dest] if { $shell_id == "" || $shell_id < 0 } { - return -1; + return -1 } if [board_info $dest exists logname] { - set logname [board_info $dest logname]; + set logname [board_info $dest logname] if [board_info $dest exists password] { remote_send $dest "iam \"$logname\",\"[board_info $dest passwd]\"\r" } else { @@ -235,26 +235,26 @@ proc vxworks_open { dest args } { # or `warning' should be used here. There are *lots* of other # cases like this. perror "Couldn't set default user." - return -1; + return -1 } } } - set dir ""; + set dir "" if [board_info $dest exists ftp_directory] { - set dir [board_info $dest ftp_directory]; + set dir [board_info $dest ftp_directory] } if [board_info $dest exists vxworks_homedir] { - set dir [board_info $dest vxworks_homedir]; + set dir [board_info $dest vxworks_homedir] } if { $dir != "" } { - set status [remote_exec $dest "cd" "\"$dir\""]; + set status [remote_exec $dest "cd" "\"$dir\""] if [lindex $status 0] { - perror "Error in cd to $dir--[lindex $status 1]"; - return 1; + perror "Error in cd to $dir--[lindex $status 1]" + return 1 } } - return $shell_id; + return $shell_id } # # Load a file into vxworks @@ -269,31 +269,31 @@ proc vxworks_ld { dest prog } { global board_info if { $prog == "" } { - return 1; + return 1 } - set shell_id [remote_open $dest]; + set shell_id [remote_open $dest] if { $shell_id < 0 } { - return -1; + return -1 } - set prog [remote_download $dest $prog]; + set prog [remote_download $dest $prog] - set shell_prompt [board_info $dest shell_prompt]; + set shell_prompt [board_info $dest shell_prompt] # We always want to exit the program via the code at the end. # If the load fails we want `expect_out' stored in the log and this # saves duplicating that code. for { set x 0 ; } { $x < 3 } {incr x; } { - remote_send $dest "\n"; + remote_send $dest "\n" remote_expect $dest 30 { -re ".*$shell_prompt $" { set x 20; } -re "\\\[VxWorks Boot\\\]:" { - remote_send $dest "@\n"; - sleep 20; - exp_continue; + remote_send $dest "@\n" + sleep 20 + exp_continue } timeout { return -1; } } @@ -305,7 +305,7 @@ proc vxworks_ld { dest prog } { while { $result == -7 && $tries < $maxtries } { verbose "Loading $prog into vxworks." - remote_send $dest "ld < $prog\n"; + remote_send $dest "ld < $prog\n" incr tries remote_expect $dest 300 { -re "USER.*command not understood" { @@ -330,7 +330,7 @@ proc vxworks_ld { dest prog } { } -re "value = (-*${decimal}) = ${hex}.*$shell_prompt $" { verbose "Loaded $prog into vxworks." - set board_info([board_info $dest name],vx_module) $expect_out(1,string); + set board_info([board_info $dest name],vx_module) $expect_out(1,string) set result 0 } -re "(.*)$shell_prompt $" { @@ -347,7 +347,7 @@ proc vxworks_ld { dest prog } { send_log "$expect_out(buffer)" } - remote_file $dest delete $prog; + remote_file $dest delete $prog return $result } @@ -360,25 +360,25 @@ proc vxworks_ld { dest prog } { # -1 - unresolved, may be fixed by rebooting # proc vxworks_run { dest function pargs inp outp } { - global hex decimal; + global hex decimal - set shell_prompt [board_info $dest shell_prompt]; - set output ""; + set shell_prompt [board_info $dest shell_prompt] + set output "" # There isn't a command to wait for a thread to finish, so we have to keep # polling. Instead, we expect the status wrapper to return an exit # status. - set status [remote_exec $dest "sp" "$function $pargs" $inp $outp]; + set status [remote_exec $dest "sp" "$function $pargs" $inp $outp] - set tid [lindex $status 0]; + set tid [lindex $status 0] # Bad task id, reboot and try again. if { $tid == -1 || $tid == 0 } { - return -1; + return -1 } - set result 1; + set result 1 # FIXME: The value 300 below should be a parameter. remote_expect $dest 300 { -re "task ${hex} - aborted.*$shell_prompt $" { @@ -388,51 +388,51 @@ proc vxworks_run { dest function pargs inp outp } { } -re "\[\r\n\]syntax error\[\r\n\]" { verbose "weirdness after task started" - set result -1; + set result -1 } -re "(.*)\\*\\*\\* EXIT code ($decimal)\[\r\n\]" { - set output "$expect_out(1,string)"; - set exit_code "$expect_out(2,string)"; + set output "$expect_out(1,string)" + set exit_code "$expect_out(2,string)" if { ($exit_code + 0) != 0 } { - set result 1; + set result 1 } else { - set result 0; + set result 0 } } -re "Operation Fault.*fault type:" { - set result 1; + set result 1 } -re "Bus Error" { # This is here to try to cope with apparently flaky h/w. # This is potentially an error in the testcase, but we don't # really know, do we? warning "Bus Error." - set result 1; - set output "Bus Error"; - remote_reboot $dest; + set result 1 + set output "Bus Error" + remote_reboot $dest } timeout { # Infinite loop? probably. - remote_exec $dest "td" "$tid"; - set result 1; + remote_exec $dest "td" "$tid" + set result 1 } } - return [list $result $output]; + return [list $result $output] } # # Unload the last executable that we loaded, so we can free up its memory. # proc vxworks_unld { dest } { - global board_info; + global board_info if [board_info $dest exists vx_module] { # Vxworks5.0 does not have the unld command. if { [board_info $dest os] != "vxworks5.0" } { - remote_exec $dest "unld" "[board_info $dest vx_module]"; + remote_exec $dest "unld" "[board_info $dest vx_module]" } - unset board_info([board_info $dest name],vx_module); + unset board_info([board_info $dest name],vx_module) } } @@ -441,55 +441,55 @@ proc vxworks_unld { dest } { # "work" or we give up. # proc vxworks_load {dest prog args} { - set result ""; - set output ""; + set result "" + set output "" if { [llength $args] > 0 } { - set pargs "[lindex $args 0]"; + set pargs "[lindex $args 0]" } else { set pargs "" } if { [llength $args] > 1 } { - set inp "[lindex $args 1]"; + set inp "[lindex $args 1]" } else { set inp "" } if { [llength $args] > 2 } { - set outp "[lindex $args 2]"; + set outp "[lindex $args 2]" } else { set outp "" } for { set x 0; } { $x < 3 } { incr x } { - set status [vxworks_ld $dest $prog]; + set status [vxworks_ld $dest $prog] if { $status >= 0 } { if { $status > 0 } { - set result "fail"; + set result "fail" } else { - set out [vxworks_run $dest __wrap_main $pargs $inp $outp]; - set status [lindex $out 0]; - set output [lindex $out 1]; + set out [vxworks_run $dest __wrap_main $pargs $inp $outp] + set status [lindex $out 0] + set output [lindex $out 1] # Get rid of the carriage returns, because they confuse # callers that try to parse the result. regsub -all "\r" $output "" output if { $status != 0 } { if { $status > 0 } { - set result "fail"; + set result "fail" } } else { - set result "pass"; + set result "pass" } } } if { $result != "" } { - vxworks_unld $dest; - return [list $result $output]; + vxworks_unld $dest + return [list $result $output] } - remote_reboot $dest; + remote_reboot $dest } - return [list "fail" ""]; + return [list "fail" ""] } set_board_info protocol "vxworks" @@ -507,5 +507,5 @@ set_board_info wrap_compile_flags "-DNO_UNISTD_H" set_board_info gdb_prompt "\[(\]vxgdb\[)\]" -set_board_info is_vxworks 1; -set_board_info gdb,nosignals 1; +set_board_info is_vxworks 1 +set_board_info gdb,nosignals 1 |