From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10418 invoked by alias); 6 Jul 2010 22:30:21 -0000 Received: (qmail 10409 invoked by uid 22791); 6 Jul 2010 22:30:21 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 06 Jul 2010 22:30:15 +0000 Received: (qmail 13961 invoked from network); 6 Jul 2010 22:30:13 -0000 Received: from unknown (HELO caradoc.them.org) (dan@127.0.0.2) by mail.codesourcery.com with ESMTPA; 6 Jul 2010 22:30:13 -0000 Date: Tue, 06 Jul 2010 22:30:00 -0000 From: Daniel Jacobowitz To: Joel Brobecker Cc: gdb-patches@sourceware.org Subject: Re: [RFA/gdbserver] Unexpected EOF read from socket after inferior exits. Message-ID: <20100706223007.GA15723@caradoc.them.org> Mail-Followup-To: Joel Brobecker , gdb-patches@sourceware.org References: <1278451801-10588-1-git-send-email-brobecker@adacore.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1278451801-10588-1-git-send-email-brobecker@adacore.com> User-Agent: Mutt/1.5.20 (2009-06-14) 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: 2010-07/txt/msg00106.txt.bz2 On Tue, Jul 06, 2010 at 02:30:01PM -0700, Joel Brobecker wrote: > Going back to the terminal where GDBserver is running, we see the following > output: > > Child exited with status 0 > readchar: Got EOF > Remote side has terminated connection. GDBserver will reopen the connection. > Listening on port 4444 > > The problem is that we're missing a call to mourn_inferior. As a result, > after we've handled the vCont packet, we fail to notice that there are > no process left to debug (target_running() returns true), and thus try > to continue reading from the remote socket. However, since GDB just > disconnected after having received the "exit with status 0" reply to the > vCont request, the read triggers the EOF exception. I agree that the current state is buggy; when I traced the calls around, Linux + async is the only combination that ever calls mourn. Your patch looks right to me, by analogy with the async case. -- Daniel Jacobowitz CodeSourcery