Skip to content

Commit

Permalink
fix: auto print thread backtrace and exit with crash code when detect…
Browse files Browse the repository at this point in the history
…ed any thread stopped with exception reason (#601)

Co-authored-by: sylar <[email protected]>
  • Loading branch information
peilinok and sylar authored Jun 24, 2024
1 parent a4c1c33 commit 83f7d9e
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/scripts/lldb.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,13 +169,21 @@ def CloseOut():
CloseOut()
os._exit(process.GetExitStatus())
elif printBacktraceTime is None and state == lldb.eStateStopped:
selectedThread = process.GetSelectedThread()
if selectedThread.GetStopReason() == lldb.eStopReasonNone:
# During startup there are some stops for lldb to setup properly.
# On iOS-16 we receive them with stop reason none.
continue
haveException = False
allThreads = process.get_process_thread_list()
for thread in allThreads:
if(thread.GetStopReason() == lldb.eStopReasonException):
haveException = True
print_stacktrace(thread)
if haveException == False:
selectedThread = process.GetSelectedThread()
if selectedThread.GetStopReason() == lldb.eStopReasonNone:
# During startup there are some stops for lldb to setup properly.
# On iOS-16 we receive them with stop reason none.
continue
else:
print_stacktrace(selectedThread)
sys.stdout.write( '\\nPROCESS_STOPPED\\n' )
print_stacktrace(process.GetSelectedThread())
CloseOut()
os._exit({exitcode_app_crash})
elif state == lldb.eStateCrashed:
Expand Down

0 comments on commit 83f7d9e

Please sign in to comment.