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
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 { } {
#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" }
}
#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
#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) " }
#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) " }
}