diff options
author | Ricardo Quesada <ricardoq@google.com> | 2022-11-14 11:14:53 -0800 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-11-14 20:52:37 +0000 |
commit | ad9884a51b42b5ac3013132fced17b9e1835edd9 (patch) | |
tree | 0ca58424adb569768365368e6b30573cac1431b5 /util | |
parent | f9d615394061964989e92dc6ed0f5124a9f4d2f1 (diff) | |
download | chrome-ec-ad9884a51b42b5ac3013132fced17b9e1835edd9.tar.gz |
util: add support for LR and PC in crash reports
Some crash reports (E.G: Coral) contain LR and PC valid registers.
This CL uses them, when available, to process the PC symbol.
BUG=b:259112884
TEST=crash_analyzer.py lite -m coral_113.map -f dumps_coral/
It correctly found the PC for the crashes.
BRANCH=none
Change-Id: I9d02a090bb4bf37dc18128cdec75e52fecb81fde
Signed-off-by: ricardoq@chromium.org
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4022249
Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'util')
-rwxr-xr-x | util/crash_analyzer.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/util/crash_analyzer.py b/util/crash_analyzer.py index c2e07face2..552ed9c46c 100755 --- a/util/crash_analyzer.py +++ b/util/crash_analyzer.py @@ -124,7 +124,18 @@ def cm0_parse(match) -> dict: regs["ipsr"] = values[22] regs["cause"] = get_crash_cause(values[6]) # r4 - regs["symbol"] = get_symbol(values[7]) # r5 + # Heuristics: try link register, then PC, then what is believed to be PC. + # When analyzing watchdogs, we try to be as close as possible to the caller + # function that caused the watchdog. + # That's why we prioritize LR (return address) over PC. + if regs["lr"] != -1: + regs["symbol"] = get_symbol(regs["lr"]) + elif regs["pc"] != -1: + regs["symbol"] = get_symbol(regs["pc"]) + else: + # Otherwise, if both LR and PC are empty, most probably + # PC is in R5. + regs["symbol"] = get_symbol(values[7]) # r5 return regs |