When attaching to a process, an extra step is needed to get the executable module loaded. This makes it possible to set breakpoints.
Detaching has to happen from the debugger thread, so there are some flags and a forced breakpoint exception to trigger that.
More work is needed on the tests (TestAttachResume.py, lldbtest.py, etc.) to get them to pass completely, but I'm separating that work from this patch.
If I understand correctly, you have let the process run freely a couple of lines back.(?)
What will happen if the process stops again (another breakpoint, watchpoint, access violation, ..) before you get a chance to stop it here? Can such a thing happen?