From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9301 invoked by alias); 8 Mar 2004 17:55:47 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 9290 invoked from network); 8 Mar 2004 17:55:46 -0000 Received: from unknown (HELO hub.ott.qnx.com) (209.226.137.76) by sources.redhat.com with SMTP; 8 Mar 2004 17:55:46 -0000 Received: from smtp.ott.qnx.com (smtp.ott.qnx.com [10.0.2.158]) by hub.ott.qnx.com (8.9.3/8.9.3) with ESMTP id NAA28374; Mon, 8 Mar 2004 13:11:25 -0500 Received: from qnx.com ([10.4.2.2]) by smtp.ott.qnx.com (8.8.8/8.6.12) with ESMTP id MAA15103; Mon, 8 Mar 2004 12:55:45 -0500 Message-ID: <404CB3E2.70301@qnx.com> Date: Mon, 08 Mar 2004 17:55:00 -0000 From: Kris Warkentin User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040113 MIME-Version: 1.0 To: Andrew Cagney CC: Daniel Jacobowitz , "Gdb@Sources.Redhat.Com" Subject: Re: File locking of target executable References: <4044F049.6060009@qnx.com> <4044F174.10004@qnx.com> <20040302204402.GA20170@nevyn.them.org> <4044F4C4.7040704@gnu.org> In-Reply-To: <4044F4C4.7040704@gnu.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2004-03/txt/msg00050.txt.bz2 This is an interesting and subtle problem. Looks like cygwin's fopen() command does some sort of funky file-locking that open() does not. If I compile my fopen() test with -mno-cygwin, I can delete the target file without difficulty so the fact that bfd uses fopen() would seem to be the reason you can't delete an executable which is being debugged. Since our ultimate aim is to build all of our tools without cygwin, this problem should eventually solve itself, assuming I can find my way down the long and winding road of getting gdb to build with mingw32. That seems a more attractive solution that trying to replace all the FILE * with file descriptors. I think a FILE * is more portable than a file descriptor anyway. cheers, Kris Andrew Cagney wrote: >> On Tue, Mar 02, 2004 at 03:41:24PM -0500, Kris Warkentin wrote: >> >>>> Argh. I always see the answer AFTER I mail to the mailing list. >>>> Looks like Windows itself won't let a binary be removed if it's >>>> executing. The problem report states that this is happening in the >>>> remote case but I just checked and it doesn't seem to be. Must be >>>> an error in the bug report. >>> >> >> >> It can happen in the remote case too sometimes - I don't think Windows >> lets you delete an open file either. > > > Look at bfd_cache_close(), which may solve the problem. > > Andrew > >