summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2006-06-13 13:09:18 +0000
committerNathan Sidwell <nathan@codesourcery.com>2006-06-13 13:09:18 +0000
commitf91db59bc309719799096b0a12c0a07e51f68e05 (patch)
treedce6016e3c40c95f3016e484de50dafeffbad241
parent12d543b02def209057d7088bfd851cff024e168d (diff)
downloadbinutils-gdb-f91db59bc309719799096b0a12c0a07e51f68e05.tar.gz
* lib/gdb.exp (gdb_load_cmd): New.
-rw-r--r--ChangeLog.csl5
-rw-r--r--gdb/testsuite/lib/gdb.exp44
2 files changed, 49 insertions, 0 deletions
diff --git a/ChangeLog.csl b/ChangeLog.csl
index 304577d2b97..0faebe81d6a 100644
--- a/ChangeLog.csl
+++ b/ChangeLog.csl
@@ -1,3 +1,8 @@
+2006-06-13 Nathan Sidwell <nathan@codesourcery.com>
+
+ gdb/testsuite/
+ * lib/gdb.exp (gdb_load_cmd): New.
+
2006-06-12 Nathan Sidwell <nathan@codesourcery.com>
gdb/
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 4bb4b057789..eca2a504666 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -1867,6 +1867,50 @@ proc gdb_exit { } {
}
#
+# gdb_load_cmd -- load a file into the debugger.
+# ARGS - additional args to load command.
+# return a -1 if anything goes wrong.
+#
+proc gdb_load_cmd { args } {
+ global gdb_prompt
+
+ if [target_info exists gdb_load_timeout] {
+ set loadtimeout [target_info gdb_load_timeout]
+ } else {
+ set loadtimeout 1600
+ }
+ send_gdb "load $args\n"
+ verbose "Timeout is now $timeout seconds" 2
+ gdb_expect $loadtimeout {
+ -re "Loading section\[^\r\]*\r\n" {
+ exp_continue
+ }
+ -re "Start address\[\r\]*\r\n" {
+ exp_continue
+ }
+ -re "Transfer rate\[\r\]*\r\n" {
+ exp_continue
+ }
+ -re "Memory access error\[^\r\]*\r\n" {
+ perror "Failed to load program"
+ return -1
+ }
+ -re "$gdb_prompt $" {
+ return 0
+ }
+ -re "(.*)\r\n$gdb_prompt " {
+ perror "Unexpected reponse from 'load' -- $expect_out(1,string)"
+ return -1
+ }
+ timeout {
+ perror "Timed out trying to load $arg."
+ return -1
+ }
+ }
+ return -1
+}
+
+#
# gdb_load -- load a file into the debugger.
# Many files in config/*.exp override this procedure.
#