[Lldb-commits] [PATCH] D90414: [lldb] Ignore binary data in crashlog

Jonas Devlieghere via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Oct 29 12:00:17 PDT 2020


JDevlieghere created this revision.
JDevlieghere added reviewers: aprantl, jasonmolenda.
Herald added a project: LLDB.
JDevlieghere requested review of this revision.

Skip the instruction stream section in the crashlog section.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D90414

Files:
  lldb/examples/python/crashlog.py


Index: lldb/examples/python/crashlog.py
===================================================================
--- lldb/examples/python/crashlog.py
+++ lldb/examples/python/crashlog.py
@@ -92,12 +92,14 @@
 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,7 +471,11 @@
                         thread_idx = int(thread_state_match.group(1))
                         parse_mode = PARSE_MODE_THREGS
                         thread = self.threads[thread_idx]
-                    else:
+                        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
@@ -477,6 +483,7 @@
                             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
                     continue
@@ -539,6 +546,8 @@
                     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):


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D90414.301702.patch
Type: text/x-patch
Size: 2104 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20201029/fb4c763f/attachment.bin>


More information about the lldb-commits mailing list