Skip to content

Commit 927737a

Browse files
committed
Fixed process state handling
1 parent 18406e8 commit 927737a

File tree

1 file changed

+26
-17
lines changed

1 file changed

+26
-17
lines changed

src/scripts/lldb.py

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -130,21 +130,30 @@ def Exit(exitcode):
130130
if state == lldb.eStateExited:
131131
sys.stdout.write( '\\nPROCESS_EXITED\\n' )
132132
Exit(process.GetExitStatus())
133-
elif printBacktraceTime is None and state == lldb.eStateStopped:
134-
sys.stdout.write( '\\nPROCESS_STOPPED\\n' )
135-
debugger.HandleCommand('bt')
136-
Exit({exitcode_app_crash})
137-
elif state == lldb.eStateCrashed:
138-
sys.stdout.write( '\\nPROCESS_CRASHED\\n' )
139-
debugger.HandleCommand('bt')
140-
Exit({exitcode_app_crash})
141-
elif state == lldb.eStateDetached:
142-
sys.stdout.write( '\\nPROCESS_DETACHED\\n' )
133+
elif state == lldb.eStateRunning:
134+
if printBacktraceTime is not None and time.time() >= printBacktraceTime:
135+
printBacktraceTime = None
136+
sys.stdout.write( '\\nPRINT_BACKTRACE_TIMEOUT\\n' )
137+
debugger.HandleCommand('process interrupt')
138+
debugger.HandleCommand('bt all')
139+
debugger.HandleCommand('continue')
140+
printBacktraceTime = time.time() + 5
141+
elif state == lldb.eStateStepping or state == lldb.eStateConnected:
142+
continue
143+
elif state == lldb.eStateExited:
144+
sys.stdout.write( '\\nPROCESS_EXITED\\n' )
145+
Exit(process.GetExitStatus())
146+
else:
147+
if state == lldb.eStateStopped:
148+
sys.stdout.write( '\\nPROCESS_STOPPED\\n' )
149+
debugger.HandleCommand('bt')
150+
elif state == lldb.eStateCrashed:
151+
sys.stdout.write( '\\nPROCESS_CRASHED\\n' )
152+
debugger.HandleCommand('bt')
153+
elif state == lldb.eStateDetached:
154+
sys.stdout.write( '\\nPROCESS_DETACHED\\n' )
155+
else:
156+
sys.stdout.write( '\\nPROCESS_\\n' + str(state).upper() )
157+
debugger.HandleCommand('bt')
143158
Exit({exitcode_app_crash})
144-
elif printBacktraceTime is not None and time.time() >= printBacktraceTime:
145-
printBacktraceTime = None
146-
sys.stdout.write( '\\nPRINT_BACKTRACE_TIMEOUT\\n' )
147-
debugger.HandleCommand('process interrupt')
148-
debugger.HandleCommand('bt all')
149-
debugger.HandleCommand('continue')
150-
printBacktraceTime = time.time() + 5
159+

0 commit comments

Comments
 (0)