aboutsummaryrefslogtreecommitdiff
path: root/lldb/examples/python/crashlog.py
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2021-04-22 11:34:47 -0700
committerJonas Devlieghere <jonas@devlieghere.com>2021-04-22 11:38:53 -0700
commita62cbd9a0211d08bace8794b435996890feb44d4 (patch)
treed8e7a08cf352f86364be8ffbe75466ca8c0e029a /lldb/examples/python/crashlog.py
parentd71ee3993fe7decab00c3083438e13f81bd49f02 (diff)
downloadllvm-a62cbd9a0211d08bace8794b435996890feb44d4.zip
llvm-a62cbd9a0211d08bace8794b435996890feb44d4.tar.gz
llvm-a62cbd9a0211d08bace8794b435996890feb44d4.tar.bz2
[lldb] Include thread name in crashlog.py output
Update the JSON parser to include the thread name in the Thread object. rdar://76677320
Diffstat (limited to 'lldb/examples/python/crashlog.py')
-rwxr-xr-xlldb/examples/python/crashlog.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/lldb/examples/python/crashlog.py b/lldb/examples/python/crashlog.py
index 1f26739..3fde19e 100755
--- a/lldb/examples/python/crashlog.py
+++ b/lldb/examples/python/crashlog.py
@@ -418,11 +418,15 @@ class JSONCrashLogParser:
self.parse_images(self.data['usedImages'])
self.parse_threads(self.data['threads'])
thread = self.crashlog.threads[self.crashlog.crashed_thread_idx]
- thread.reason = self.parse_crash_reason(self.data['exception'])
+ reason = self.parse_crash_reason(self.data['exception'])
+ if thread.reason:
+ thread.reason = '{} {}'.format(thread.reason, reason)
+ else:
+ thread.reason = reason
except (KeyError, ValueError, TypeError) as e:
- raise CrashLogParseException(
- 'Failed to parse JSON crashlog: {}: {}'.format(
- type(e).__name__, e))
+ raise CrashLogParseException(
+ 'Failed to parse JSON crashlog: {}: {}'.format(
+ type(e).__name__, e))
return self.crashlog
@@ -480,6 +484,8 @@ class JSONCrashLogParser:
idx = 0
for json_thread in json_threads:
thread = self.crashlog.Thread(idx, False)
+ if 'name' in json_thread:
+ thread.reason = json_thread['name']
if json_thread.get('triggered', False):
self.crashlog.crashed_thread_idx = idx
self.registers = self.parse_thread_registers(