Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA/testsuite]: Don't exit when `target sim' fails
@ 2007-04-25 11:23 Corinna Vinschen
  2007-04-25 11:39 ` Daniel Jacobowitz
  0 siblings, 1 reply; 3+ messages in thread
From: Corinna Vinschen @ 2007-04-25 11:23 UTC (permalink / raw)
  To: gdb-patches

Hi,

Newer GCC linkers unlink the output file before trying to open it.  This
results in a sharing violation under Cygwin/Windows if the file is still
in use by GDB, as in the gdb.base/chng-syms.exp testcase.  As a result,
the `target sim' command prints an error message that the executable
can't be opened by GDB.

Unfortunately, the gdb_target_sim function in config/sim.exp reacts in a
very unfriendly way when `target sim' fails: It just exits instead of
returning with an error code.  In turn, the testrun exits entirely, and
one instance of GDB keeps potentially running, because the testcase has
no chance to clean up properly.

Another situation in which the exit is very annoying is, when running the
testsuite on remote harware over a not-always-reliable connection.  If
`target sim' fails once, the whole testsuite exits instead of just skipping
this one testcase.

The below patch changes gdb_target_sim to return with -1 instead of
just exiting.  This allows the testsuite to run further along, instead
of just exiting.

Ok to apply?


Corinna


	* config/sim.exp (gdb_target_sim): Just return with -1 when setting
	target sim fails.  Return 0 otherwise.
	(gdb_load): Return prematurely if gdb_target_sim fails.

Index: config/sim.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/config/sim.exp,v
retrieving revision 1.4
diff -u -p -r1.4 sim.exp
--- config/sim.exp	9 Jan 2007 17:59:08 -0000	1.4
+++ config/sim.exp	25 Apr 2007 10:09:18 -0000
@@ -23,7 +23,6 @@ load_lib gdb.exp
 #
 proc gdb_target_sim { } {
     global gdb_prompt
-    global exit_status
     
     set target_sim_options "[board_info target gdb,target_sim_options]";
 
@@ -37,11 +36,12 @@ proc gdb_target_sim { } {
 	timeout { 
 	    perror "Couldn't set target for simulator."
 	    cleanup
-	    exit $exit_status
+	    return -1
 	}
     }
     set timeout 10
     verbose "Timeout is now $timeout seconds" 2
+    return 0
 }
 
 #
@@ -59,7 +59,7 @@ proc gdb_load { arg } {
 	if [gdb_file_cmd $arg] then { return -1 }
     }
 
-    gdb_target_sim
+    if [gdb_target_sim] then { return -1 }
 
     send_gdb "load\n"
     set timeout 2400

-- 
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-04-25 11:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-25 11:23 [RFA/testsuite]: Don't exit when `target sim' fails Corinna Vinschen
2007-04-25 11:39 ` Daniel Jacobowitz
2007-04-25 16:01   ` Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox