]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
* lib/gdb.exp(gdb_test): Check the result of send_gdb. Use
authorBob Manson <manson@cygnus>
Tue, 11 Feb 1997 00:49:17 +0000 (00:49 +0000)
committerBob Manson <manson@cygnus>
Tue, 11 Feb 1997 00:49:17 +0000 (00:49 +0000)
$gdb_spawn_id directly.

Checking for errors actually helps. *sigh*

gdb/testsuite/ChangeLog
gdb/testsuite/lib/gdb.exp

index 263d0cf2c926f11e49f73dd541085aae3e2f71cb..ac51f3a309ab68b67258e28ddd9a22c4aa790def 100644 (file)
@@ -1,3 +1,8 @@
+Mon Feb 10 16:40:47 1997  Bob Manson  <manson@charmed.cygnus.com>
+
+       * lib/gdb.exp(gdb_test): Check the result of send_gdb. Use
+       $gdb_spawn_id directly.
+
 Mon Feb 10 11:26:59 1997  Jeffrey A Law  (law@cygnus.com)
 
        * gdb.base/exprs.exp: Delete bogus/incorrect (and probably
index 6024df33796b40bd93ce20088fbe82c5d9ca0ced..5b903495ceb910c24f893e8ace89bf3f3a303840 100644 (file)
@@ -310,6 +310,7 @@ proc gdb_test { args } {
     global GDB
     global expect_out
     upvar timeout timeout
+    global gdb_spawn_id;
 
     if [llength $args]>2 then {
        set message [lindex $args 2]
@@ -334,11 +335,14 @@ proc gdb_test { args } {
 
     set result -1
     if ![string match $command ""] {
-       send_gdb "$command\n"
+       if { [send_gdb "$command\n"] != "" } {
+           perror "Couldn't send $command to GDB.";
+           return $result;
+       }
     }
 
     expect {
-       -re ".*Ending remote debugging.*$gdb_prompt$" {
+       -i $gdb_spawn_id -re ".*Ending remote debugging.*$gdb_prompt$" {
            if ![isnative] then {
                warning "Can`t communicate to remote target."
            }
@@ -346,25 +350,25 @@ proc gdb_test { args } {
            gdb_start
            set result -1
        }
-       -re "\[\r\n\]*($pattern)\[\r\n\]+$gdb_prompt $" {
+       -i $gdb_spawn_id -re "\[\r\n\]*($pattern)\[\r\n\]+$gdb_prompt $" {
            if ![string match "" $message] then {
                pass "$message"
            }
            set result 0
        }
-       -re "(${question_string})$" {
+       -i $gdb_spawn_id -re "(${question_string})$" {
            send_gdb "$response_string\n";
            exp_continue;
        }
-       -re "Undefined command:.*$gdb_prompt" {
+       -i $gdb_spawn_id -re "Undefined command:.*$gdb_prompt" {
            perror "Undefined command \"$command\"."
            set result 1
        }
-       -re "Ambiguous command.*$gdb_prompt $" {
+       -i $gdb_spawn_id -re "Ambiguous command.*$gdb_prompt $" {
            perror "\"$command\" is not a unique command name."
            set result 1
        }
-       -re ".*Program exited with code \[0-9\]+.*$gdb_prompt $" {
+       -i $gdb_spawn_id -re ".*Program exited with code \[0-9\]+.*$gdb_prompt $" {
            if ![string match "" $message] then {
                set errmsg "$message: the program exited"
            } else {
@@ -373,7 +377,7 @@ proc gdb_test { args } {
            fail "$errmsg"
            return -1
        }
-       -re "The program is not being run.*$gdb_prompt $" {
+       -i $gdb_spawn_id -re "The program is not being run.*$gdb_prompt $" {
            if ![string match "" $message] then {
                set errmsg "$message: the program is no longer running"
            } else {
@@ -382,25 +386,25 @@ proc gdb_test { args } {
            fail "$errmsg"
            return -1
        }
-       -re ".*$gdb_prompt $" {
+       -i $gdb_spawn_id -re ".*$gdb_prompt $" {
            if ![string match "" $message] then {
                fail "$message"
            }
            set result 1
        }
-       "<return>" {
+       -i $gdb_spawn_id "<return>" {
            send_gdb "\n"
            perror "Window too small."
        }
-       -re "\\(y or n\\) " {
+       -i $gdb_spawn_id -re "\\(y or n\\) " {
            send_gdb "n\n"
            perror "Got interactive prompt."
        }
-       eof {
+       -i $gdb_spawn_id eof {
            perror "Process no longer exists"
            return -1
        }
-       full_buffer {
+       -i $gdb_spawn_id full_buffer {
            perror "internal buffer is full."
        }
        timeout {