aboutsummaryrefslogtreecommitdiff
path: root/lldb/examples/python/crashlog.py
diff options
context:
space:
mode:
authorMed Ismail Bennani <medismail.bennani@gmail.com>2022-03-24 17:19:33 -0700
committerMed Ismail Bennani <medismail.bennani@gmail.com>2022-03-25 14:59:50 -0700
commit12301d616fbcd3bbc78664221256404123a0935f (patch)
tree3d187b1015b2322c8ebc6b1f8a2cf68f5e98c15b /lldb/examples/python/crashlog.py
parentafaefb671fe12e7788d3e8de6b6193b935fbf16c (diff)
downloadllvm-12301d616fbcd3bbc78664221256404123a0935f.zip
llvm-12301d616fbcd3bbc78664221256404123a0935f.tar.gz
llvm-12301d616fbcd3bbc78664221256404123a0935f.tar.bz2
[lldb/crashlog] Parse thread fields and pass it to crashlog scripted process
Previously, the ScriptedThread used the thread index as the thread id. This patch parses the crashlog json to extract the actual thread "id" value, and passes this information to the Crashlog ScriptedProcess blueprint, to create a higher fidelity ScriptedThreaad. It also updates the blueprint to show the thread name and thread queue. Finally, this patch updates the interactive crashlog test to reflect these changes. rdar://90327854 Differential Revision: https://reviews.llvm.org/D122422 Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Diffstat (limited to 'lldb/examples/python/crashlog.py')
-rwxr-xr-xlldb/examples/python/crashlog.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/lldb/examples/python/crashlog.py b/lldb/examples/python/crashlog.py
index aad58c5..e0bd52d 100755
--- a/lldb/examples/python/crashlog.py
+++ b/lldb/examples/python/crashlog.py
@@ -76,10 +76,12 @@ class CrashLog(symbolication.Symbolicator):
def __init__(self, index, app_specific_backtrace):
self.index = index
+ self.id = index
self.frames = list()
self.idents = list()
self.registers = dict()
self.reason = None
+ self.name = None
self.queue = None
self.crashed = False
self.app_specific_backtrace = app_specific_backtrace
@@ -521,14 +523,18 @@ class JSONCrashLogParser:
for json_thread in json_threads:
thread = self.crashlog.Thread(idx, False)
if 'name' in json_thread:
+ thread.name = json_thread['name']
thread.reason = json_thread['name']
+ if 'id' in json_thread:
+ thread.id = int(json_thread['id'])
if json_thread.get('triggered', False):
self.crashlog.crashed_thread_idx = idx
thread.crashed = True
if 'threadState' in json_thread:
thread.registers = self.parse_thread_registers(
json_thread['threadState'])
- thread.queue = json_thread.get('queue')
+ if 'queue' in json_thread:
+ thread.queue = json_thread.get('queue')
self.parse_frames(thread, json_thread.get('frames', []))
self.crashlog.threads.append(thread)
idx += 1