From 41a85720e045650dfbe3cda97d257c37385a8b68 Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Tue, 31 Aug 1993 22:50:11 +0000 Subject: [PATCH] Just a little cleanup. Made gdb_exit "kill" any isstip's still running and blow away the socket. GDB now restarts beautifully. --- gdb/testsuite/config/udi-gdb.exp | 87 +++++++++++++++++++++------------------- 1 file changed, 45 insertions(+), 42 deletions(-) diff --git a/gdb/testsuite/config/udi-gdb.exp b/gdb/testsuite/config/udi-gdb.exp index df64531..695e85f 100644 --- a/gdb/testsuite/config/udi-gdb.exp +++ b/gdb/testsuite/config/udi-gdb.exp @@ -31,17 +31,13 @@ if ![info exists prompt] then { set prompt "\(gdb\)" } +load_lib gdb.exp + # # gdb_version -- extract and print the version number of gdb # proc gdb_version {} { - global GDB - global GDBFLAGS - global prompt - set tmp [exec echo "q" | $GDB] - set version [lindex $tmp [lsearch $tmp "\[0-9\]*"]] - set version [string range $version 0 [expr [string length $version]-2]] - clone_output "[which $GDB] version $version $GDBFLAGS\n" + default_gdb_version } # @@ -59,27 +55,21 @@ proc gdb_load { arg } { global expect_out send "load $arg\n" - if $verbose>1 then { - send_user "Loading $arg into $GDB\n" - } + verbose "Loading $arg into $GDB" expect { -re "Loading.*\.text.*\.data.*\.bss.*Reading symbols from $arg.+done.*$prompt $" { - if $verbose>1 then { - send_user "Loaded $arg into $GDB\n" - } + verbose "Loaded $arg into $GDB" return 1 } - -re "$prompt $" { - if $verbose>1 then { - error "GDB couldn't load." - } + -re "$prompt $" { + error "Couldn't load $arg into $GDB." + return 0 } timeout { - if $verbose>1 then { error "Timed out trying to load $arg." - } + return 0 } -} + } if [info exists expect_out(buffer)] then { send_log $expect_out(buffer) } @@ -100,10 +90,17 @@ proc gdb_target_udi { } { send "target udi $targetname\n" set timeout 60 expect { + -re "target udi $targetname\[\r\n\]+" { + continue -expect + } -re "TIP UDI 1.2 Conformant.*$prompt $" { - if $verbose>1 then { - send_user "Set target to $targetname\n" - } + verbose "Set target to $targetname" + } + -re "TIP-ipc WARNING,.*failed:" { + warning "$expect_out(buffer)" + } + -re "TIP-ipc ERROR,.*failed:" { + error "$expect_out(buffer)" } -re "A program is being debugged already. Kill it\? \(y or n\)" { send "y\n" @@ -138,13 +135,16 @@ proc gdb_start { } { } expect { -re "GDB.*$prompt $" { - if $verbose>1 then { - send_user "$GDB initialized for cross mode\n\n" - } + verbose "$GDB initialized for cross mode\n" + } + -re "$prompt $" { + error "GDB never initialized." + return -1 + } + timeout { + error "(timeout) GDB never initialized." + return -1 } - -re "$prompt $" { error "GDB never initialized."; return -1 } - timeout { error "(timeout) GDB never initialized."; - return -1 } } # force the height to "unlimited", so no pagers get used @@ -158,25 +158,28 @@ proc gdb_start { } { send "set args main\n" expect -re ".*$prompt $" {} - if $verbose>1 then { - send_user "Setting up target, Please wait...\n" - } + verbose "Setting up target, Please wait..." gdb_target_udi } -expect_after { - "" { send "\n"; clone_output "ERROR: Window too small." } - -re "\(y or n\) " { send "n\n"; error "Got interactive prompt." } - buffer_full { error "internal buffer is full." } - eof { error "eof -- pty is hosed." } - timeout { error "timeout." } - "virtual memory exhausted" { error "virtual memory exhausted." } - "Undefined command" { error "send string probably wrong." } +# +# gdb_exit -- exit gdb +# +proc gdb_exit { } { + slay isstip + catch default_gdb_exit + set in [open [concat "|ls -F"] r] + while {[gets $in line]>-1} { + if [regexp "=$" $line] then { + set line [string trimright $line "="] + verbose "Removing the $line named socket" + exec rm -f $line + } + } + close $in } -load_lib gdb.exp - gdb_start # make sure gdb has actually started, otherwise if the first test -- 2.7.4