diff --git a/selfdrive/tombstoned.py b/selfdrive/tombstoned.py index e9ec73b7fd..404d714165 100755 --- a/selfdrive/tombstoned.py +++ b/selfdrive/tombstoned.py @@ -93,6 +93,12 @@ def report_tombstone_android(fn, client): if name_idx >= 0: message = message[name_idx:] + executable = "" + start_exe_idx = message.find('>>> ') + end_exe_idx = message.find(' <<<') + if start_exe_idx >= 0 and end_exe_idx >= 0: + executable = message[start_exe_idx + 4:end_exe_idx] + # Cut off fault addr fault_idx = message.find(', fault addr') if fault_idx >= 0: @@ -100,6 +106,17 @@ def report_tombstone_android(fn, client): sentry_report(client, fn, message, contents) + # Copy crashlog to upload folder + clean_path = executable.replace('./', '').replace('/', '_') + date = datetime.datetime.now().strftime("%Y-%m-%d--%H-%M-%S") + + new_fn = f"{date}_{commit[:8]}_{safe_fn(clean_path)}"[:MAX_TOMBSTONE_FN_LEN] + + crashlog_dir = os.path.join(ROOT, "crash") + mkdirs_exists_ok(crashlog_dir) + + shutil.copy(fn, os.path.join(crashlog_dir, new_fn)) + def report_tombstone_apport(fn, client): f_size = os.path.getsize(fn)