diff options
author | Adrian Prantl <aprantl@apple.com> | 2018-12-17 17:26:04 +0000 |
---|---|---|
committer | Adrian Prantl <aprantl@apple.com> | 2018-12-17 17:26:04 +0000 |
commit | 975edaf725b3bf7a88bfed834eddb08fce97e8e0 (patch) | |
tree | 072121042b26c3c56a8df3c4a66bdf6c0ecb964e /lldb/examples | |
parent | 07a262c5472df913ffe137be7e7fe8c477375123 (diff) |
Make crashlog.py work or binaries with spaces in their names
This is a little dangerous since the crashlog files aren't 100%
unambiguous, but the risk is mitigated by using a non-greedy +?
pattern.
rdar://problem/38478511
Differential Revision: https://reviews.llvm.org/D55608
Diffstat (limited to 'lldb/examples')
-rwxr-xr-x | lldb/examples/python/crashlog.py | 31 |
1 files changed, 10 insertions, 21 deletions
diff --git a/lldb/examples/python/crashlog.py b/lldb/examples/python/crashlog.py index 09f22be60d4..7eb86db7ce0 100755 --- a/lldb/examples/python/crashlog.py +++ b/lldb/examples/python/crashlog.py @@ -94,11 +94,9 @@ class CrashLog(symbolication.Symbolicator): thread_regex = re.compile('^Thread ([0-9]+)([^:]*):(.*)') app_backtrace_regex = re.compile( '^Application Specific Backtrace ([0-9]+)([^:]*):(.*)') - frame_regex = re.compile('^([0-9]+)\s+([^ ]+)\s+(0x[0-9a-fA-F]+) +(.*)') + frame_regex = re.compile('^([0-9]+)\s+(.+?)\s+(0x[0-9a-fA-F]{7}[0-9a-fA-F]+) +(.*)') image_regex_uuid = re.compile( - '(0x[0-9a-fA-F]+)[- ]+(0x[0-9a-fA-F]+) +[+]?([^ ]+) +([^<]+)<([-0-9a-fA-F]+)> (.*)') - image_regex_no_uuid = re.compile( - '(0x[0-9a-fA-F]+)[- ]+(0x[0-9a-fA-F]+) +[+]?([^ ]+) +([^/]+)/(.*)') + '(0x[0-9a-fA-F]+)[-\s]+(0x[0-9a-fA-F]+)\s+[+]?(.+?)\s+(\(.+\))?\s?(<([-0-9a-fA-F]+)>)? (.*)') empty_line_regex = re.compile('^$') class Thread: @@ -477,25 +475,16 @@ class CrashLog(symbolication.Symbolicator): elif parse_mode == PARSE_MODE_IMAGES: image_match = self.image_regex_uuid.search(line) if image_match: - image = CrashLog.DarwinImage(int(image_match.group(1), 0), - int(image_match.group(2), 0), - image_match.group(3).strip(), - image_match.group(4).strip(), - uuid.UUID(image_match.group(5)), - image_match.group(6)) + (img_lo, img_hi, img_name, img_version, + _, img_uuid, img_path) = image_match.groups() + image = CrashLog.DarwinImage(int(img_lo, 0), int(img_hi, 0), + img_name.strip(), + img_version.strip() + if img_version else "", + uuid.UUID(img_uuid), img_path) self.images.append(image) else: - image_match = self.image_regex_no_uuid.search(line) - if image_match: - image = CrashLog.DarwinImage(int(image_match.group(1), 0), - int(image_match.group(2), 0), - image_match.group(3).strip(), - image_match.group(4).strip(), - None, - image_match.group(5)) - self.images.append(image) - else: - print "error: image regex failed for: %s" % line + print "error: image regex failed for: %s" % line elif parse_mode == PARSE_MODE_THREGS: stripped_line = line.strip() |