This is the mail archive of the gdb-patches@sourceware.cygnus.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

lib/gdb.exp: Don't loop infinitly on download attempts


Hello,

Encountered a situtation where GDB could just keep trying to download. 
The attatched caps the number of load attempts.

Is this ok?

	Andrew
Wed Oct  6 12:05:58 1999  Andrew Cagney  <cagney@b1.cygnus.com>

	* lib/gdb.exp (gdb_run_cmd): Give up after five download attempts.

Index: gdb/testsuite/lib/gdb.exp
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/testsuite/lib/gdb.exp,v
retrieving revision 1.147
diff -p -r1.147 gdb.exp
*** gdb.exp	1999/09/07 23:19:44	1.147
--- gdb.exp	1999/10/06 02:50:58
*************** proc gdb_run_cmd {args} {
*** 196,201 ****
--- 196,204 ----
  	    set start "start";
  	}
  	send_gdb  "jump *$start\n"
+ 	# Count down on load attempts so that this
+ 	# doesn't loop infinitly.
+ 	set load_attempts 2
  	gdb_expect 30 {
  	    -re "Continuing at \[^\r\n\]*\[\r\n\]" {
  		if ![target_info exists gdb_stub] {
*************** proc gdb_run_cmd {args} {
*** 204,209 ****
--- 207,217 ----
  	    }
  	    -re "No symbol \"start\" in current.*$gdb_prompt $" {
  		send_gdb "jump *_start\n";
+ 		set load_attempts [expr $load_attempts - 1]
+ 		if [expr $load_attempts <= 0] {
+ 		    perror "Load failed"
+ 		    return
+ 		}
  		exp_continue;
  	    }
  	    -re "No symbol \"_start\" in current.*$gdb_prompt $" {
*************** proc gdb_run_cmd {args} {
*** 212,223 ****
--- 220,241 ----
  	    }
  	    -re "Line.* Jump anyway.*y or n. $" {
  		send_gdb "y\n"
+ 		set load_attempts [expr $load_attempts - 1]
+ 		if [expr $load_attempts <= 0] {
+ 		    perror "Load failed"
+ 		    return
+ 		}
  		exp_continue;
              }
  	    -re "No symbol.*context.*$gdb_prompt $" {}
  	    -re "The program is not being run.*$gdb_prompt $" {
  		gdb_load "";
  		send_gdb "jump *$start\n";
+ 		set load_attempts [expr $load_attempts - 1]
+ 		if [expr $load_attempts <= 0] {
+ 		    perror "Load failed"
+ 		    return
+ 		}
  		exp_continue;
  	    }
  	    timeout { perror "Jump to start() failed (timeout)"; return }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]