[Lldb-commits] [lldb] 9a44eed - [lldb/crashlog] Skip non-crashed threads in batch mode

Med Ismail Bennani via lldb-commits lldb-commits at lists.llvm.org
Fri Aug 18 12:51:03 PDT 2023


Author: Med Ismail Bennani
Date: 2023-08-18T20:50:39+01:00
New Revision: 9a44eedb842d03b0e4d24f8dcc57a49e1a9cc1ac

URL: https://github.com/llvm/llvm-project/commit/9a44eedb842d03b0e4d24f8dcc57a49e1a9cc1ac
DIFF: https://github.com/llvm/llvm-project/commit/9a44eedb842d03b0e4d24f8dcc57a49e1a9cc1ac.diff

LOG: [lldb/crashlog] Skip non-crashed threads in batch mode

When using the `crashlog` command in batch mode, most users only care
about the crashed thread and end up having to scroll past all the
non-crashed threads, which is not a good user experience.

Now that `-c|--crashed-only` is set by default, we should also apply
that behavior for batch mode: Only the crashed thread and "Application
Specific Backtrace" threads will be shown to the user in batch mode.

The user will still have the ability to show all the threads if they use
`--no-crashed-only` which will parse the symbols from the report, or
with `-a|--load-all-images` which will fetch binaries and debug info
from the build record and symbolicate every thread.

rdar://106329893

Differential Revision: https://reviews.llvm.org/D157852

Signed-off-by: Med Ismail Bennani <ismail at bennani.ma>

Added: 
    

Modified: 
    lldb/examples/python/crashlog.py

Removed: 
    


################################################################################
diff  --git a/lldb/examples/python/crashlog.py b/lldb/examples/python/crashlog.py
index 080062be5374dc..5f6b84ff795eb8 100755
--- a/lldb/examples/python/crashlog.py
+++ b/lldb/examples/python/crashlog.py
@@ -949,6 +949,7 @@ def parse(self):
                                 self.thread.reason += (
                                     " (%s)" % self.crashlog.thread_exception_data
                                 )
+                            self.thread.crashed = True
                         if self.app_specific_backtrace:
                             self.crashlog.backtraces.append(self.thread)
                         else:
@@ -1437,6 +1438,10 @@ def add_module(image, target, obj_dir):
             print()
 
     for thread in crash_log.threads:
+        if options.crashed_only and not (
+            thread.crashed or thread.app_specific_backtrace
+        ):
+            continue
         thread.dump_symbolicated(crash_log, options)
         print()
 


        


More information about the lldb-commits mailing list