This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: File locking of target executable


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




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]