[Bug 21723] New: Setting a breakpoint on Windows leads to the target image file not being deletable for a short time even AFTER the process exits.

Bug ID 21723
Summary Setting a breakpoint on Windows leads to the target image file not being deletable for a short time even AFTER the process exits.
Product lldb
Version unspecified
Hardware PC
OS Windows NT
Status NEW
Severity normal
Priority P
Component All Bugs
Assignee zturner@google.com
Reporter zturner@google.com
CC lldb-dev@cs.uiuc.edu
Classification Unclassified

The python test suite uses LLDB as an in-process extension module.  When
running a test, it test suite first compiles the test program from source, and
then debugs the resulting executable.  When the test invokes LLDB's public API
to set a breakpoint, this is implemented by an eventual call to
WriteProcessMemory to write a breakpoint opcode into the target.  After the
test is complete, the test runner attempts to delete the compiled executable.

For some reason, this call to WriteProcessMemory prevents the test runner from
deleting the executable (error value is ERROR_ACCESS_DENIED).  Commenting out
this one system call -- and nothing else -- results in the executable being
deletable by the test suite.

This is incredibly strange behavior, and although I suspect a race condition
between closing all the handles to the process and the test runner attempting
to delete the process (perhaps a side effect of Bug 21722), there's no
reasonable explanation why WriteProcessMemory would trigger the race.  

The fix may be as simple as fixing Bug 21722, but it also may be something
different.  And even if it is, it might be worth investigating this further and
filing a bug against the Windows kernel.

Zachary Turner changed bug 21723

What Removed Added
Status NEW RESOLVED
Resolution FIXED

Comment # 1 on bug 21723 from Zachary Turner

Fixed by r223272