aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2006-06-13 13:20:25 +0000
committerNathan Sidwell <nathan@codesourcery.com>2006-06-13 13:20:25 +0000
commite63b55d15bc54c3b72484267566c5999a2bc1357 (patch)
tree6ef9d2e1d5673e9e6d0c7b167a47e2053dce1d86 /gdb
parent5600ea19e0ff645c85a8719648655c2e7b2e4717 (diff)
downloadgdb-e63b55d15bc54c3b72484267566c5999a2bc1357.zip
gdb-e63b55d15bc54c3b72484267566c5999a2bc1357.tar.gz
gdb-e63b55d15bc54c3b72484267566c5999a2bc1357.tar.bz2
* lib/gdb.exp (gdb_load_cmd): New.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/testsuite/ChangeLog2
-rw-r--r--gdb/testsuite/lib/gdb.exp44
2 files changed, 46 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 4e4fb35..3655498 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,7 @@
2006-06-13 Nathan Sidwell <nathan@codesourcery.com>
+ * lib/gdb.exp (gdb_load_cmd): New.
+
* gdb.base/fileio.c: Add system(NULL) test.
* gdb.base/fileio.exp: Check it.
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 4bb4b05..eca2a50 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.
#