Skip to content

Commit 86dddbe

Browse files
authored
[lldb/crashlog] Always load Application Specific Backtrace Thread images (#94259)
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 8c9bb9c commit 86dddbe

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
@@ -547,9 +547,9 @@ def load_images(self, options, loaded_images=None):
547547
for image in self.images:
548548
image.resolve = True
549549
elif options.crashed_only:
550+
images_to_load = []
550551
for thread in self.threads:
551-
if thread.did_crash():
552-
images_to_load = []
552+
if thread.did_crash() or thread.app_specific_backtrace:
553553
for ident in thread.idents:
554554
for image in self.find_images_with_identifier(ident):
555555
image.resolve = True
@@ -864,7 +864,7 @@ def parse_app_specific_backtraces(self, json_app_specific_bts):
864864
thread = self.crashlog.Thread(
865865
len(self.crashlog.threads), True, self.crashlog.process_arch
866866
)
867-
thread.queue = "Application Specific Backtrace"
867+
thread.name = "Application Specific Backtrace"
868868
if self.parse_asi_backtrace(thread, json_app_specific_bts[0]):
869869
self.crashlog.threads.append(thread)
870870
else:
@@ -874,7 +874,7 @@ def parse_last_exception_backtraces(self, json_last_exc_bts):
874874
thread = self.crashlog.Thread(
875875
len(self.crashlog.threads), True, self.crashlog.process_arch
876876
)
877-
thread.queue = "Last Exception Backtrace"
877+
thread.name = "Last Exception Backtrace"
878878
self.parse_frames(thread, json_last_exc_bts)
879879
self.crashlog.threads.append(thread)
880880

@@ -1174,11 +1174,13 @@ def parse_normal(self, line):
11741174
self.thread = self.crashlog.Thread(
11751175
idx, True, self.crashlog.process_arch
11761176
)
1177+
self.thread.name = "Application Specific Backtrace"
11771178
elif line.startswith("Last Exception Backtrace:"): # iOS
11781179
self.parse_mode = self.CrashLogParseMode.THREAD
11791180
self.app_specific_backtrace = True
11801181
idx = 1
11811182
self.thread = self.crashlog.Thread(idx, True, self.crashlog.process_arch)
1183+
self.thread.name = "Last Exception Backtrace"
11821184
self.crashlog.info_lines.append(line.strip())
11831185

11841186
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
@@ -173,10 +173,7 @@ def __init__(self, process, args, crashlog_thread):
173173
self.backing_thread = crashlog_thread
174174
self.idx = self.backing_thread.index
175175
self.tid = self.backing_thread.id
176-
if self.backing_thread.app_specific_backtrace:
177-
self.name = "Application Specific Backtrace"
178-
else:
179-
self.name = self.backing_thread.name
176+
self.name = self.backing_thread.name
180177
self.queue = self.backing_thread.queue
181178
self.has_crashed = self.originating_process.crashed_thread_idx == self.idx
182179
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)