From 301500dff6bd53e64257898cac939b24f56befac Mon Sep 17 00:00:00 2001 From: Willem Melching Date: Wed, 24 Mar 2021 16:11:53 +0100 Subject: [PATCH] Upload android tombstones (#20459) * upload android tombstones * remove comment --- selfdrive/tombstoned.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/selfdrive/tombstoned.py b/selfdrive/tombstoned.py index e9ec73b7f..404d71416 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)