[Lldb-commits] [lldb] 5b17b6d - [lldb] Ignore binary data in crashlog

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Fri Oct 30 09:17:52 PDT 2020


Author: Jonas Devlieghere
Date: 2020-10-30T09:17:45-07:00
New Revision: 5b17b6d924d25bb98332462bdbd4b59333864c0b

URL: https://github.com/llvm/llvm-project/commit/5b17b6d924d25bb98332462bdbd4b59333864c0b
DIFF: https://github.com/llvm/llvm-project/commit/5b17b6d924d25bb98332462bdbd4b59333864c0b.diff

LOG: [lldb] Ignore binary data in crashlog

Skip the instruction stream section in the crashlog section.

Differential revision: https://reviews.llvm.org/D90414

Added: 
    

Modified: 
    lldb/examples/python/crashlog.py

Removed: 
    


################################################################################
diff  --git a/lldb/examples/python/crashlog.py b/lldb/examples/python/crashlog.py
index c9494d708d22..e1cde1131c55 100755
--- a/lldb/examples/python/crashlog.py
+++ b/lldb/examples/python/crashlog.py
@@ -92,12 +92,14 @@ def read_plist(s):
 PARSE_MODE_IMAGES = 2
 PARSE_MODE_THREGS = 3
 PARSE_MODE_SYSTEM = 4
+PARSE_MODE_INSTRS = 5
 
 
 class CrashLog(symbolication.Symbolicator):
     """Class that does parses darwin crash logs"""
     parent_process_regex = re.compile('^Parent Process:\s*(.*)\[(\d+)\]')
     thread_state_regex = re.compile('^Thread ([0-9]+) crashed with')
+    thread_instrs_regex = re.compile('^Thread ([0-9]+) instruction stream')
     thread_regex = re.compile('^Thread ([0-9]+)([^:]*):(.*)')
     app_backtrace_regex = re.compile(
         '^Application Specific Backtrace ([0-9]+)([^:]*):(.*)')
@@ -469,13 +471,18 @@ def __init__(self, path, verbose):
                         thread_idx = int(thread_state_match.group(1))
                         parse_mode = PARSE_MODE_THREGS
                         thread = self.threads[thread_idx]
-                    else:
-                        thread_match = self.thread_regex.search(line)
-                        if thread_match:
-                            app_specific_backtrace = False
-                            parse_mode = PARSE_MODE_THREAD
-                            thread_idx = int(thread_match.group(1))
-                            thread = CrashLog.Thread(thread_idx, False)
+                        continue
+                    thread_insts_match  = self.thread_instrs_regex.search(line)
+                    if thread_insts_match:
+                        parse_mode = PARSE_MODE_INSTRS
+                        continue
+                    thread_match = self.thread_regex.search(line)
+                    if thread_match:
+                        app_specific_backtrace = False
+                        parse_mode = PARSE_MODE_THREAD
+                        thread_idx = int(thread_match.group(1))
+                        thread = CrashLog.Thread(thread_idx, False)
+                        continue
                     continue
                 elif line.startswith('Binary Images:'):
                     parse_mode = PARSE_MODE_IMAGES
@@ -539,6 +546,8 @@ def __init__(self, path, verbose):
                     thread.registers[reg.strip()] = int(value, 0)
             elif parse_mode == PARSE_MODE_SYSTEM:
                 self.system_profile.append(line)
+            elif parse_mode == PARSE_MODE_INSTRS:
+                pass
         f.close()
 
     def dump(self):


        


More information about the lldb-commits mailing list