Fixes #219 - iOS 9.3 app hangs on splash screen

Fixes cases where process is not yet running.

Signed-off-by: Shazron Abdullah <shazron@apache.org>
This commit is contained in:
Alexis Kofman 2016-04-05 21:32:53 +02:00 committed by Shazron Abdullah
parent 956e925f97
commit 9871c759e0

View File

@ -42,20 +42,15 @@ def run_command(debugger, command, result, internal_dict):
def safequit_command(debugger, command, result, internal_dict): def safequit_command(debugger, command, result, internal_dict):
process = lldb.target.process process = lldb.target.process
listener = debugger.GetListener() state = process.GetState()
listener.StartListeningForEvents(process.GetBroadcaster(), lldb.SBProcess.eBroadcastBitStateChanged | lldb.SBProcess.eBroadcastBitSTDOUT | lldb.SBProcess.eBroadcastBitSTDERR) if state == lldb.eStateRunning:
event = lldb.SBEvent() process.Detach()
while True: os._exit(0)
if listener.WaitForEvent(1, event) and lldb.SBProcess.EventIsProcessEvent(event): elif state > lldb.eStateRunning:
state = lldb.SBProcess.GetStateFromEvent(event) os._exit(state)
else: else:
state = process.GetState() print('\\nApplication has not been launched\\n')
os._exit(1)
if state == lldb.eStateRunning:
process.Detach()
os._exit(0)
elif state > lldb.eStateRunning:
os._exit(state)
def autoexit_command(debugger, command, result, internal_dict): def autoexit_command(debugger, command, result, internal_dict):
process = lldb.target.process process = lldb.target.process