Skip to content

Commit 5b17b6d

Browse files
committed
[lldb] Ignore binary data in crashlog
Skip the instruction stream section in the crashlog section. Differential revision: https://reviews.llvm.org/D90414
1 parent c44846f commit 5b17b6d

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

lldb/examples/python/crashlog.py

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,14 @@ def read_plist(s):
9292
PARSE_MODE_IMAGES = 2
9393
PARSE_MODE_THREGS = 3
9494
PARSE_MODE_SYSTEM = 4
95+
PARSE_MODE_INSTRS = 5
9596

9697

9798
class CrashLog(symbolication.Symbolicator):
9899
"""Class that does parses darwin crash logs"""
99100
parent_process_regex = re.compile('^Parent Process:\s*(.*)\[(\d+)\]')
100101
thread_state_regex = re.compile('^Thread ([0-9]+) crashed with')
102+
thread_instrs_regex = re.compile('^Thread ([0-9]+) instruction stream')
101103
thread_regex = re.compile('^Thread ([0-9]+)([^:]*):(.*)')
102104
app_backtrace_regex = re.compile(
103105
'^Application Specific Backtrace ([0-9]+)([^:]*):(.*)')
@@ -469,13 +471,18 @@ def __init__(self, path, verbose):
469471
thread_idx = int(thread_state_match.group(1))
470472
parse_mode = PARSE_MODE_THREGS
471473
thread = self.threads[thread_idx]
472-
else:
473-
thread_match = self.thread_regex.search(line)
474-
if thread_match:
475-
app_specific_backtrace = False
476-
parse_mode = PARSE_MODE_THREAD
477-
thread_idx = int(thread_match.group(1))
478-
thread = CrashLog.Thread(thread_idx, False)
474+
continue
475+
thread_insts_match = self.thread_instrs_regex.search(line)
476+
if thread_insts_match:
477+
parse_mode = PARSE_MODE_INSTRS
478+
continue
479+
thread_match = self.thread_regex.search(line)
480+
if thread_match:
481+
app_specific_backtrace = False
482+
parse_mode = PARSE_MODE_THREAD
483+
thread_idx = int(thread_match.group(1))
484+
thread = CrashLog.Thread(thread_idx, False)
485+
continue
479486
continue
480487
elif line.startswith('Binary Images:'):
481488
parse_mode = PARSE_MODE_IMAGES
@@ -539,6 +546,8 @@ def __init__(self, path, verbose):
539546
thread.registers[reg.strip()] = int(value, 0)
540547
elif parse_mode == PARSE_MODE_SYSTEM:
541548
self.system_profile.append(line)
549+
elif parse_mode == PARSE_MODE_INSTRS:
550+
pass
542551
f.close()
543552

544553
def dump(self):

0 commit comments

Comments
 (0)