Skip to content

[lldb] Determine the main binary in JSON crashlogs #3944

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 15, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions lldb/examples/python/crashlog.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,12 @@ def dump(self):
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:
Expand Down Expand Up @@ -437,6 +443,7 @@ def parse(self):
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]
Expand Down Expand Up @@ -487,6 +494,11 @@ def parse_images(self, json_images):
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:
Expand Down