[lldb-dev] Windows crash after D9056

Aidan Dodds aidan at codeplay.com
Tue May 19 04:52:47 PDT 2015


Hi,

We have been seeing a crash on windows when connecting to an android 
target using lldb-server.
I am not sure if this affects other platforms too.
I think this was introduced with http://reviews.llvm.org/D9056.

I tracked the crash back to the workings of ModuleCache::GetAndPut().

The crash seems to be due to a file descriptor being released twice, 
once by the original "File lock_file" and again by the "LockFile lock" 
who share the same file descriptor.

The file descriptor sharing happens because of this line:
ModuleCache.cpp @ 164
LockFile lock (lock_file.GetDescriptor ());

Both destructors attempt to release effectively the same file 
descriptor.  I was able to fix the crash by duplicating the file handle 
in the lock file constructor using _dup().  (patch attached)
I wasn't sure if this was the right fix however. Has anyone else seen this?
Should "File lock_file" perhaps transfer its file descriptor completely 
rather then share it?

Thanks,
Aidan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fd_crash_fix.patch
Type: text/x-patch
Size: 527 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20150519/f616c5f4/attachment.bin>


More information about the lldb-dev mailing list