Skip to content

Commit d45712a

Browse files
jplexergmarull
authored andcommitted
fw/kernel/fault_handling: generate coredump on assertion failure
Assertions now trigger a coredump before resetting, making it much easier to debug issues like heap corruption where the call stack leading to the assertion is needed. Signed-off-by: Joshua Jun <joshuajun@proton.me>
1 parent 28aff0a commit d45712a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/fw/kernel/fault_handling.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/* SPDX-FileCopyrightText: 2024 Google LLC */
22
/* SPDX-License-Identifier: Apache-2.0 */
33

4+
#include "kernel/core_dump.h"
45
#include "kernel/logging_private.h"
56
#include "process_management/process_manager.h"
67
#include "process_management/app_manager.h"
@@ -15,6 +16,7 @@
1516
#include "syscall/syscall.h"
1617
#include "syscall/syscall_internal.h"
1718
#include "system/logging.h"
19+
#include "system/reboot_reason.h"
1820
#include "syscall/syscall.h"
1921

2022
#include <util/heap.h>
@@ -140,6 +142,9 @@ static void setup_log_app_crash_info(CrashInfo crash_info) {
140142
static NORETURN kernel_fault(RebootReasonCode reason_code, uint32_t lr) {
141143
RebootReason reason = { .code = reason_code, .extra = { .value = lr } };
142144
reboot_reason_set(&reason);
145+
if (reason_code == RebootReasonCode_Assert) {
146+
core_dump_reset(false /* is_forced */);
147+
}
143148
reset_due_to_software_failure();
144149
}
145150

0 commit comments

Comments
 (0)