diff options
-rw-r--r-- | gdb/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/testsuite/config/monitor.exp | 55 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/setshow.exp | 28 |
3 files changed, 53 insertions, 35 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 15a1d8f..ac06583 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,5 +1,10 @@ Wed Mar 5 00:00:43 1997 Bob Manson <manson@charmed.cygnus.com> + * config/monitor.exp(gdb_target_monitor): Add pattern for + "Ending remote" to detect errors in connecting. + + * gdb.base/setshow.exp: Add .* within auto language test. + * lib/gdb.exp(gdb_run_cmd): Add check for gdb_init_command target feature. diff --git a/gdb/testsuite/config/monitor.exp b/gdb/testsuite/config/monitor.exp index a2863b2..b7591e2 100644 --- a/gdb/testsuite/config/monitor.exp +++ b/gdb/testsuite/config/monitor.exp @@ -67,6 +67,7 @@ proc gdb_target_monitor { } { verbose "Set target to $targetname" return } + -re "Ending remote.*$gdb_prompt" { } -re "Connection refused.*$gdb_prompt" { verbose "Connection refused by remote target. Pausing, and trying again." sleep 30 @@ -99,32 +100,44 @@ proc gdb_load { arg } { global gdb_prompt global timeout - if { $arg != "" } { - if [gdb_file_cmd $arg] { return -1 } - } - - gdb_target_monitor - - if [is_remote host] { - # FIXME: - set arg a.out; - } + for { set j 1; } { $j <= 2 } {incr j; } { + if { $arg != "" } { + if [gdb_file_cmd $arg] { return -1 } + } + + gdb_target_monitor - verbose "Loading $arg" - send_gdb "load $arg\n" - set timeout 1000 - verbose "Timeout is now $timeout seconds" 2 - gdb_expect { - -re ".*$gdb_prompt $" { - verbose "Loaded $arg into $GDB\n" - return 1 + if [is_remote host] { + # FIXME: + set arg a.out; } - timeout { - if { $verbose > 1 } { - perror "Timed out trying to load $arg." + + verbose "Loading $arg" + send_gdb "load $arg\n" + set timeout 1000 + verbose "Timeout is now $timeout seconds" 2 + gdb_expect { + -re ".*\[Ff\]ailed.*$gdb_prompt $" { + verbose "load failed"; + } + -re ".*$gdb_prompt $" { + verbose "Loaded $arg into $GDB\n" + return 1 + } + timeout { + if { $verbose > 1 } { + perror "Timed out trying to load $arg." + } } } + gdb_test "target exec" "No exec file now." "" ".*Kill it.*y or n.*" "y" + + if { $j == 1 && ![reboot_target] } { + break; + } } + perror "Couldn't load file into GDB."; + return -1; } proc gdb_start { } { diff --git a/gdb/testsuite/gdb.base/setshow.exp b/gdb/testsuite/gdb.base/setshow.exp index c0ce98f..a23d9b7 100644 --- a/gdb/testsuite/gdb.base/setshow.exp +++ b/gdb/testsuite/gdb.base/setshow.exp @@ -55,27 +55,27 @@ gdb_test "show annotate" "Annotation_level is 0..*" "default annotation_level i #test set annotate 2 send_gdb "set annotate 2\n" -expect { - -re ".*\032\032pre-prompt.*$prompt .*\032\032prompt.*$" \ +gdb_expect { + -re ".*\032\032pre-prompt.*$gdb_prompt .*\032\032prompt.*$" \ { pass "set annotate 2" } - -re ".*$prompt $" { fail "set annotate 2" } + -re ".*$gdb_prompt $" { fail "set annotate 2" } timeout { fail "(timeout) set annotate 2" } } send_gdb "show annotate\n" -expect { - -re ".*\032\032post-prompt.*Annotation_level is 2..*\032\032pre-prompt.*$prompt .*\032\032prompt.*$" \ +gdb_expect { + -re ".*\032\032post-prompt.*Annotation_level is 2..*\032\032pre-prompt.*$gdb_prompt .*\032\032prompt.*$" \ { pass "show annotate (2)" } - -re ".*$prompt $" { fail "show annotate (2)" } + -re ".*$gdb_prompt $" { fail "show annotate (2)" } timeout { fail "(timeout) show annotate (2)" } } #test annotation_level 2 send_gdb "info line 1\n" -expect { - -re ".*\032\032post-prompt.*Line 1 of .* is at address .* but contains no code.*:1:0:beg:0x.*\032\032pre-prompt.*$prompt .*\032\032prompt.*$" \ +gdb_expect { + -re ".*\032\032post-prompt.*Line 1 of .* is at address .* but contains no code.*:1:0:beg:0x.*\032\032pre-prompt.*$gdb_prompt .*\032\032prompt.*$" \ { pass "annotation_level 2" } - -re ".*$prompt $" { fail "annotation_level 2" } + -re ".*$gdb_prompt $" { fail "annotation_level 2" } timeout { fail "(timeout) annotation_level 2" } } @@ -166,7 +166,7 @@ gdb_test "show language" "The current source language is \"asm\"..*" "show langu #test set language auto gdb_test "set language auto" "" "set language auto" #test show language -gdb_test "show language" "The current source language is \"auto\"..*" "show language (auto)" +gdb_test "show language" "The current source language is \"auto.*\"..*" "show language (auto)" #test set listsize 100 gdb_test "set listsize 100" "" "set listsize 100" #test show listsize 100 @@ -175,14 +175,14 @@ gdb_test "show listsize" "Number of source lines gdb will list by default is 100 #test set prompt (FooBarBaz) set newprompt "\\(FooBarBaz\\)" send_gdb "set prompt (FooBarBaz) \n" -expect { +gdb_expect { -re "$newprompt $" { pass "set prompt (FooBarBaz) " } timeout { fail "(timeout) set prompt (FooBarBaz) " } } #test show prompt (FooBarBaz) send_gdb "show prompt\n" -expect { +gdb_expect { -re "Gdb's prompt is \"$newprompt \"..* $" \ { pass "show prompt (FooBarBaz) " } timeout { fail "(timeout) show prompt (FooBarBaz) " } @@ -190,8 +190,8 @@ expect { #test set prompt (gdb) send_gdb "set prompt (gdb) \n" -expect { - -re "$prompt $" { pass "set prompt (gdb) " } +gdb_expect { + -re "$gdb_prompt $" { pass "set prompt (gdb) " } timeout { fail "(timeout) set prompt (gdb) " } } |