Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[lldb/crashlog] Always load Application Specific Backtrace Thread images #94259

Merged

Conversation

medismailben
Copy link
Member

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

@llvmbot llvmbot added the lldb label Jun 3, 2024
@llvmbot
Copy link
Member

llvmbot commented Jun 3, 2024

@llvm/pr-subscribers-lldb

Author: Med Ismail Bennani (medismailben)

Changes

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


Full diff: https://github.com/llvm/llvm-project/pull/94259.diff

2 Files Affected:

  • (modified) lldb/examples/python/crashlog.py (+6-4)
  • (modified) lldb/examples/python/crashlog_scripted_process.py (+1-4)
diff --git a/lldb/examples/python/crashlog.py b/lldb/examples/python/crashlog.py
index 641b2e64d53b1..6d5a1a74818de 100755
--- a/lldb/examples/python/crashlog.py
+++ b/lldb/examples/python/crashlog.py
@@ -545,9 +545,9 @@ def load_images(self, options, loaded_images=None):
             for image in self.images:
                 image.resolve = True
         elif options.crashed_only:
+            images_to_load = []
             for thread in self.threads:
-                if thread.did_crash():
-                    images_to_load = []
+                if thread.did_crash() or thread.app_specific_backtrace:
                     for ident in thread.idents:
                         for image in self.find_images_with_identifier(ident):
                             image.resolve = True
@@ -858,7 +858,7 @@ def parse_app_specific_backtraces(self, json_app_specific_bts):
         thread = self.crashlog.Thread(
             len(self.crashlog.threads), True, self.crashlog.process_arch
         )
-        thread.queue = "Application Specific Backtrace"
+        thread.name = "Application Specific Backtrace"
         if self.parse_asi_backtrace(thread, json_app_specific_bts[0]):
             self.crashlog.threads.append(thread)
         else:
@@ -868,7 +868,7 @@ def parse_last_exception_backtraces(self, json_last_exc_bts):
         thread = self.crashlog.Thread(
             len(self.crashlog.threads), True, self.crashlog.process_arch
         )
-        thread.queue = "Last Exception Backtrace"
+        thread.name = "Last Exception Backtrace"
         self.parse_frames(thread, json_last_exc_bts)
         self.crashlog.threads.append(thread)
 
@@ -1168,11 +1168,13 @@ def parse_normal(self, line):
                 self.thread = self.crashlog.Thread(
                     idx, True, self.crashlog.process_arch
                 )
+                self.thread.name = "Application Specific Backtrace"
         elif line.startswith("Last Exception Backtrace:"):  # iOS
             self.parse_mode = self.CrashLogParseMode.THREAD
             self.app_specific_backtrace = True
             idx = 1
             self.thread = self.crashlog.Thread(idx, True, self.crashlog.process_arch)
+            self.thread.name = "Last Exception Backtrace"
         self.crashlog.info_lines.append(line.strip())
 
     def parse_thread(self, line):
diff --git a/lldb/examples/python/crashlog_scripted_process.py b/lldb/examples/python/crashlog_scripted_process.py
index 26c5c37b7371d..4bc816e333a69 100644
--- a/lldb/examples/python/crashlog_scripted_process.py
+++ b/lldb/examples/python/crashlog_scripted_process.py
@@ -165,10 +165,7 @@ def __init__(self, process, args, crashlog_thread):
         self.backing_thread = crashlog_thread
         self.idx = self.backing_thread.index
         self.tid = self.backing_thread.id
-        if self.backing_thread.app_specific_backtrace:
-            self.name = "Application Specific Backtrace"
-        else:
-            self.name = self.backing_thread.name
+        self.name = self.backing_thread.name
         self.queue = self.backing_thread.queue
         self.has_crashed = self.originating_process.crashed_thread_idx == self.idx
         self.create_stackframes()

Copy link
Member

@JDevlieghere JDevlieghere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Can we test the new behavior?

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 <ismail@bennani.ma>
@medismailben medismailben force-pushed the crashlog-load-last-exception-backtrace branch from f5e231b to d7bd20e Compare June 5, 2024 06:41
@medismailben medismailben merged commit 86dddbe into llvm:main Jun 6, 2024
5 checks passed
medismailben added a commit to medismailben/llvm-project that referenced this pull request Jun 11, 2024
…ges (llvm#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 <ismail@bennani.ma>
(cherry picked from commit 86dddbe)
JDevlieghere added a commit to swiftlang/llvm-project that referenced this pull request Jun 20, 2024
[lldb/crashlog] Always load Application Specific Backtrace Thread images (llvm#94259)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants