Skip to content

Commit d7bd20e

Browse files
committed
[lldb/crashlog] Always load Application Specific Backtrace Thread images
This patch changes the crashlog image loading default behaviour to not only load images from the crashed thread but also for the application specific backtrace thread. This patch also move the Application Specific Backtrace / Last Exception Backtrace tag from the thread queue field to the thread name. rdar://128276576 Signed-off-by: Med Ismail Bennani <[email protected]>
1 parent 7aa382f commit d7bd20e

File tree

4 files changed

+9
-10
lines changed

4 files changed

+9
-10
lines changed

lldb/examples/python/crashlog.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -545,9 +545,9 @@ def load_images(self, options, loaded_images=None):
545545
for image in self.images:
546546
image.resolve = True
547547
elif options.crashed_only:
548+
images_to_load = []
548549
for thread in self.threads:
549-
if thread.did_crash():
550-
images_to_load = []
550+
if thread.did_crash() or thread.app_specific_backtrace:
551551
for ident in thread.idents:
552552
for image in self.find_images_with_identifier(ident):
553553
image.resolve = True
@@ -858,7 +858,7 @@ def parse_app_specific_backtraces(self, json_app_specific_bts):
858858
thread = self.crashlog.Thread(
859859
len(self.crashlog.threads), True, self.crashlog.process_arch
860860
)
861-
thread.queue = "Application Specific Backtrace"
861+
thread.name = "Application Specific Backtrace"
862862
if self.parse_asi_backtrace(thread, json_app_specific_bts[0]):
863863
self.crashlog.threads.append(thread)
864864
else:
@@ -868,7 +868,7 @@ def parse_last_exception_backtraces(self, json_last_exc_bts):
868868
thread = self.crashlog.Thread(
869869
len(self.crashlog.threads), True, self.crashlog.process_arch
870870
)
871-
thread.queue = "Last Exception Backtrace"
871+
thread.name = "Last Exception Backtrace"
872872
self.parse_frames(thread, json_last_exc_bts)
873873
self.crashlog.threads.append(thread)
874874

@@ -1168,11 +1168,13 @@ def parse_normal(self, line):
11681168
self.thread = self.crashlog.Thread(
11691169
idx, True, self.crashlog.process_arch
11701170
)
1171+
self.thread.name = "Application Specific Backtrace"
11711172
elif line.startswith("Last Exception Backtrace:"): # iOS
11721173
self.parse_mode = self.CrashLogParseMode.THREAD
11731174
self.app_specific_backtrace = True
11741175
idx = 1
11751176
self.thread = self.crashlog.Thread(idx, True, self.crashlog.process_arch)
1177+
self.thread.name = "Last Exception Backtrace"
11761178
self.crashlog.info_lines.append(line.strip())
11771179

11781180
def parse_thread(self, line):

lldb/examples/python/crashlog_scripted_process.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,7 @@ def __init__(self, process, args, crashlog_thread):
165165
self.backing_thread = crashlog_thread
166166
self.idx = self.backing_thread.index
167167
self.tid = self.backing_thread.id
168-
if self.backing_thread.app_specific_backtrace:
169-
self.name = "Application Specific Backtrace"
170-
else:
171-
self.name = self.backing_thread.name
168+
self.name = self.backing_thread.name
172169
self.queue = self.backing_thread.queue
173170
self.has_crashed = self.originating_process.crashed_thread_idx == self.idx
174171
self.create_stackframes()

lldb/test/Shell/ScriptInterpreter/Python/Crashlog/app_specific_backtrace_crashlog.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# RUN: mkdir -p %t.dir
44
# RUN: yaml2obj %S/Inputs/application_specific_info/asi.yaml > %t.dir/asi
55
# RUN: %lldb -o 'command script import lldb.macosx.crashlog' \
6-
# RUN: -o 'crashlog -a -i -t %t.dir/asi %S/Inputs/application_specific_info/asi.txt' \
6+
# RUN: -o 'crashlog -i -t %t.dir/asi %S/Inputs/application_specific_info/asi.txt' \
77
# RUN: -o "thread list" -o "bt all" 2>&1 | FileCheck %s
88

99
# CHECK: "crashlog" {{.*}} commands have been installed, use the "--help" options on these commands

lldb/test/Shell/ScriptInterpreter/Python/Crashlog/last_exception_backtrace_crashlog.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# RUN: mkdir -p %t.dir
44
# RUN: yaml2obj %S/Inputs/application_specific_info/asi.yaml > %t.dir/asi
55
# RUN: %lldb -o 'command script import lldb.macosx.crashlog' \
6-
# RUN: -o 'crashlog -a -i -t %t.dir/asi %S/Inputs/application_specific_info/leb.txt' \
6+
# RUN: -o 'crashlog -i -t %t.dir/asi %S/Inputs/application_specific_info/leb.txt' \
77
# RUN: -o "thread list" -o "bt all" 2>&1 | FileCheck %s
88

99
# CHECK: "crashlog" {{.*}} commands have been installed, use the "--help" options on these commands

0 commit comments

Comments
 (0)