* lib/gdb.exp (gdb_load_cmd): New.
authorNathan Sidwell <nathan@codesourcery.com>
Tue, 13 Jun 2006 13:20:25 +0000 (13:20 +0000)
committerNathan Sidwell <nathan@codesourcery.com>
Tue, 13 Jun 2006 13:20:25 +0000 (13:20 +0000)
gdb/testsuite/ChangeLog
gdb/testsuite/lib/gdb.exp

index 4e4fb35bc9db1d42f4e96d05b5161ffcec76f282..3655498b5e57b2a92e108f6e66944b4d47026d73 100644 (file)
@@ -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.
 
index 4bb4b0577891f853ce1b33ff4addd213c5c8acdb..eca2a50466628ec29b53b3d9bf06b976553601e8 100644 (file)
@@ -1866,6 +1866,50 @@ proc gdb_exit { } {
     catch default_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.
This page took 0.030216 seconds and 4 git commands to generate.