Index: lldb/examples/python/crashlog.py =================================================================== --- lldb/examples/python/crashlog.py +++ lldb/examples/python/crashlog.py @@ -449,6 +449,8 @@ self.parse_images(self.data['usedImages']) self.parse_main_image(self.data) self.parse_threads(self.data['threads']) + if 'asiBacktraces' in self.data: + self.parse_app_specific_backtraces(self.data['asiBacktraces']) self.parse_errors(self.data) thread = self.crashlog.threads[self.crashlog.crashed_thread_idx] reason = self.parse_crash_reason(self.data['exception']) @@ -560,6 +562,37 @@ self.crashlog.threads.append(thread) idx += 1 + def parse_app_specific_backtraces(self, json_app_specific_bts): + def parse_asi_backtrace(self, thread, bt): + frame_regex = re.compile(r'^([0-9]+)' r'\s' # id + r'+(.+?)' r'\s+' # img_name + r'(0x[0-9a-fA-F]{7}[0-9a-fA-F]+)' # addr + r' +(.*)' # offs + ) + + for line in bt.split('\n'): + frame_match = frame_regex.search(line) + if not frame_match: + print("error: Couldn't parse Application Specific Backtrace.") + return False + + (frame_id, frame_img_name, + frame_addr, frame_ofs) = frame_match.groups() + + thread.add_ident(frame_img_name) + if frame_img_name not in self.crashlog.idents: + self.crashlog.idents.append(frame_img_name) + thread.frames.append(self.crashlog.Frame(int(frame_id), int( + frame_addr, 0), frame_ofs)) + + return True + + for idx, backtrace in enumerate(json_app_specific_bts): + thread = self.crashlog.Thread(idx, True) + thread.queue = "Application Specific Backtraces" + if parse_asi_backtrace(self, thread, backtrace): + self.crashlog.threads.append(thread) + def parse_thread_registers(self, json_thread_state, prefix=None): registers = dict() for key, state in json_thread_state.items(): Index: lldb/examples/python/scripted_process/crashlog_scripted_process.py =================================================================== --- lldb/examples/python/scripted_process/crashlog_scripted_process.py +++ lldb/examples/python/scripted_process/crashlog_scripted_process.py @@ -140,6 +140,8 @@ self.idx = self.backing_thread.index self.tid = self.backing_thread.id self.name = self.backing_thread.name + if self.backing_thread.app_specific_backtrace: + self.name = "Application Specific Backtrace - " + str(self.idx) self.queue = self.backing_thread.queue self.has_crashed = (self.scripted_process.crashed_thread_idx == self.idx) self.create_stackframes()