From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11770 invoked by alias); 13 Dec 2006 13:37:48 -0000 Received: (qmail 11759 invoked by uid 22791); 13 Dec 2006 13:37:47 -0000 X-Spam-Check-By: sourceware.org Received: from nevyn.them.org (HELO nevyn.them.org) (66.93.172.17) by sourceware.org (qpsmtpd/0.31.1) with ESMTP; Wed, 13 Dec 2006 13:37:42 +0000 Received: from drow by nevyn.them.org with local (Exim 4.63) (envelope-from ) id 1GuUIk-0000hN-QH; Wed, 13 Dec 2006 08:37:38 -0500 Date: Wed, 13 Dec 2006 13:37:00 -0000 From: Daniel Jacobowitz To: Denis PILAT Cc: gdb-patches Subject: Re: gdbserver with reversed arguments goes into an infinite loop Message-ID: <20061213133737.GA2633@nevyn.them.org> Mail-Followup-To: Denis PILAT , gdb-patches References: <457FCEB6.4060008@st.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <457FCEB6.4060008@st.com> User-Agent: Mutt/1.5.13 (2006-08-11) 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: 2006-12/txt/msg00172.txt.bz2 On Wed, Dec 13, 2006 at 10:58:14AM +0100, Denis PILAT wrote: > I've found that if you revert the argument of gdbserver, means writing > the program's name before the COMM argument, it goes into an infinite > loop, and as the CTRL+C does not work, you have to kill the process from > an other shell. > > In gdbserver/server.c, the loop in question does the remote_open on the > wrong passed argument (argv[1]) which unfortunately is the binary file > you'd expect to open so remote_open does not exit on error. > > I think either we could check that we pass correct argument before using > start_inferior(), this is executing before the loop. The bellow patch is > in that sense. > > Or we find a way to exit the loop by adding a test in it. May be by > adding something in remote_open to let it fail. I doubt it's in an infinite loop. It's probably sleeping, "waiting" for a connection. We ought to allow C-c when no debugger is connected yet. It'd be nice if remote_open wouldn't open ordinary files, too. -- Daniel Jacobowitz CodeSourcery