[Bug 27238] New: Python API: Unable to detach a process in running state.

Bug ID 27238
Summary Python API: Unable to detach a process in running state.
Product lldb
Version unspecified
Hardware Macintosh
OS MacOS X
Status NEW
Severity release blocker
Priority P
Component All Bugs
Assignee lldb-dev@lists.llvm.org
Reporter alexis.kofman@gmail.com
CC llvm-bugs@lists.llvm.org
Classification Unclassified

The following code used to work before xcode 7.3 lldb-350.0.21.3. Now it seems
that the process can't be detached anymore. There is no error, it just hangs
when trying to detach and never execute the os._exit(0). Any thought ?

safequit_command(debugger, command, result, internal_dict):
    process = lldb.target.process
    listener = debugger.GetListener()
    listener.StartListeningForEvents(process.GetBroadcaster(),
lldb.SBProcess.eBroadcastBitStateChanged | lldb.SBProcess.eBroadcastBitSTDOUT |
lldb.SBProcess.eBroadcastBitSTDERR)
    event = lldb.SBEvent()
    while True:
        if listener.WaitForEvent(1, event) and
lldb.SBProcess.EventIsProcessEvent(event):
            state = lldb.SBProcess.GetStateFromEvent(event)
        else:
            state = process.GetState()
        if state == lldb.eStateRunning:
            process.Detach()
            os._exit(0)
        elif state > lldb.eStateRunning:
            os._exit(state)