From 61aa2c36b6106220241b16b10fe1b8c8a73ad14b Mon Sep 17 00:00:00 2001 From: chao an Date: Wed, 15 Nov 2023 19:29:53 +0800 Subject: [PATCH] misc/assert: restore assertion registers to array of last registers Some assertions in extreme cases will cause syslog to be unable to output logs normally, so this PR will restore the input registers into the array of last registers to ensure that we can also obtain some important informations. Signed-off-by: chao an --- sched/misc/assert.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sched/misc/assert.c b/sched/misc/assert.c index f67c6b85b7..14dfa74953 100644 --- a/sched/misc/assert.c +++ b/sched/misc/assert.c @@ -581,6 +581,10 @@ void _assert(FAR const char *filename, int linenum, up_saveusercontext(g_last_regs); regs = g_last_regs; } + else + { + memcpy(g_last_regs, regs, sizeof(g_last_regs)); + } #if CONFIG_BOARD_RESET_ON_ASSERT < 2 if (!up_interrupt_context() &&