2006-06-13 Nathan Sidwell gdb/testsuite/ * lib/gdb.exp (gdb_load_cmd): New. Index: gdb/testsuite/lib/gdb.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/lib/gdb.exp,v retrieving revision 1.64.10.1 diff -c -3 -p -r1.64.10.1 gdb.exp *** gdb/testsuite/lib/gdb.exp 7 Mar 2006 15:48:34 -0000 1.64.10.1 --- gdb/testsuite/lib/gdb.exp 13 Jun 2006 07:31:34 -0000 *************** proc gdb_exit { } { *** 1867,1872 **** --- 1867,1916 ---- } # + # 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. #