$gdb_spawn_id directly.
Checking for errors actually helps. *sigh*
+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
Mon Feb 10 11:26:59 1997 Jeffrey A Law (law@cygnus.com)
* gdb.base/exprs.exp: Delete bogus/incorrect (and probably
global GDB
global expect_out
upvar timeout timeout
global GDB
global expect_out
upvar timeout timeout
if [llength $args]>2 then {
set message [lindex $args 2]
if [llength $args]>2 then {
set message [lindex $args 2]
set result -1
if ![string match $command ""] {
set result -1
if ![string match $command ""] {
+ if { [send_gdb "$command\n"] != "" } {
+ perror "Couldn't send $command to GDB.";
+ return $result;
+ }
- -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."
}
if ![isnative] then {
warning "Can`t communicate to remote target."
}
gdb_start
set result -1
}
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
}
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;
}
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
}
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
}
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 {
if ![string match "" $message] then {
set errmsg "$message: the program exited"
} else {
fail "$errmsg"
return -1
}
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 {
if ![string match "" $message] then {
set errmsg "$message: the program is no longer running"
} else {
fail "$errmsg"
return -1
}
fail "$errmsg"
return -1
}
- -re ".*$gdb_prompt $" {
+ -i $gdb_spawn_id -re ".*$gdb_prompt $" {
if ![string match "" $message] then {
fail "$message"
}
set result 1
}
if ![string match "" $message] then {
fail "$message"
}
set result 1
}
+ -i $gdb_spawn_id "<return>" {
send_gdb "\n"
perror "Window too small."
}
send_gdb "\n"
perror "Window too small."
}
+ -i $gdb_spawn_id -re "\\(y or n\\) " {
send_gdb "n\n"
perror "Got interactive prompt."
}
send_gdb "n\n"
perror "Got interactive prompt."
}
perror "Process no longer exists"
return -1
}
perror "Process no longer exists"
return -1
}
+ -i $gdb_spawn_id full_buffer {
perror "internal buffer is full."
}
timeout {
perror "internal buffer is full."
}
timeout {