From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16790 invoked by alias); 25 Apr 2007 10:10:31 -0000 Received: (qmail 16779 invoked by uid 22791); 25 Apr 2007 10:10:30 -0000 X-Spam-Check-By: sourceware.org Received: from aquarius.hirmke.de (HELO calimero.vinschen.de) (217.91.18.234) by sourceware.org (qpsmtpd/0.31.1) with ESMTP; Wed, 25 Apr 2007 11:10:27 +0100 Received: by calimero.vinschen.de (Postfix, from userid 500) id 96C826D4803; Wed, 25 Apr 2007 12:10:24 +0200 (CEST) Date: Wed, 25 Apr 2007 11:23:00 -0000 From: Corinna Vinschen To: gdb-patches@sourceware.org Subject: [RFA/testsuite]: Don't exit when `target sim' fails Message-ID: <20070425101024.GG4270@calimero.vinschen.de> Reply-To: gdb-patches@sourceware.org Mail-Followup-To: gdb-patches@sourceware.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.2.2i X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2007-04/txt/msg00339.txt.bz2 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