aboutsummaryrefslogtreecommitdiff
path: root/lldb/examples/python/crashlog.py
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/examples/python/crashlog.py')
-rwxr-xr-xlldb/examples/python/crashlog.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/lldb/examples/python/crashlog.py b/lldb/examples/python/crashlog.py
index 63be066..bc57a27 100755
--- a/lldb/examples/python/crashlog.py
+++ b/lldb/examples/python/crashlog.py
@@ -351,6 +351,12 @@ class CrashLog(symbolication.Symbolicator):
for image in self.images:
image.dump(' ')
+ def set_main_image(self, identifier):
+ for i, image in enumerate(self.images):
+ if image.identifier == identifier:
+ self.images.insert(0, self.images.pop(i))
+ break
+
def find_image_with_identifier(self, identifier):
for image in self.images:
if image.identifier == identifier:
@@ -435,6 +441,7 @@ class JSONCrashLogParser:
try:
self.parse_process_info(self.data)
self.parse_images(self.data['usedImages'])
+ self.parse_main_image(self.data)
self.parse_threads(self.data['threads'])
self.parse_errors(self.data)
thread = self.crashlog.threads[self.crashlog.crashed_thread_idx]
@@ -485,6 +492,11 @@ class JSONCrashLogParser:
self.crashlog.images.append(darwin_image)
idx += 1
+ def parse_main_image(self, json_data):
+ if 'procName' in json_data:
+ proc_name = json_data['procName']
+ self.crashlog.set_main_image(proc_name)
+
def parse_frames(self, thread, json_frames):
idx = 0
for json_frame in json_frames: