mirror of
https://github.com/apache/nuttx.git
synced 2026-06-04 14:53:47 +08:00
board: Pass the assertion expression to board_crashdump too
continue the follow work:
commit 43e7b13697
Author: Xiang Xiao <xiaoxiang@xiaomi.com>
Date: Sun Jan 22 19:31:32 2023 +0800
assert: Log the assertion expression in case of fail
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
committed by
Alan Carvalho de Assis
parent
be10056702
commit
99e89809d7
@@ -98,15 +98,14 @@ static void copy_reverse(stack_word_t *dest, stack_word_t *src, int size)
|
||||
* Name: board_crashdump
|
||||
****************************************************************************/
|
||||
|
||||
void board_crashdump(uintptr_t currentsp, void *tcb,
|
||||
const char *filename, int lineno)
|
||||
void board_crashdump(uintptr_t sp, struct tcb_s *tcb,
|
||||
const char *filename, int lineno,
|
||||
const char *msg)
|
||||
{
|
||||
struct tcb_s *rtcb;
|
||||
fullcontext_t *pdump;
|
||||
|
||||
enter_critical_section();
|
||||
|
||||
rtcb = (struct tcb_s *)tcb;
|
||||
#ifdef CONFIG_CXD56_BACKUPLOG
|
||||
pdump = up_backuplog_alloc("crash", sizeof(fullcontext_t));
|
||||
#else
|
||||
@@ -151,10 +150,10 @@ void board_crashdump(uintptr_t currentsp, void *tcb,
|
||||
/* Save Context */
|
||||
|
||||
#if CONFIG_TASK_NAME_SIZE > 0
|
||||
strlcpy(pdump->info.name, rtcb->name, sizeof(pdump->info.name));
|
||||
strlcpy(pdump->info.name, tcb->name, sizeof(pdump->info.name));
|
||||
#endif
|
||||
|
||||
pdump->info.pid = rtcb->pid;
|
||||
pdump->info.pid = tcb->pid;
|
||||
|
||||
/* If current_regs is not NULL then we are in an interrupt context
|
||||
* and the user context is in current_regs else we are running in
|
||||
@@ -164,7 +163,7 @@ void board_crashdump(uintptr_t currentsp, void *tcb,
|
||||
if (CURRENT_REGS)
|
||||
{
|
||||
#if CONFIG_ARCH_INTERRUPTSTACK > 3
|
||||
pdump->info.stacks.interrupt.sp = currentsp;
|
||||
pdump->info.stacks.interrupt.sp = sp;
|
||||
#endif
|
||||
pdump->info.flags |= (REGS_PRESENT | USERSTACK_PRESENT | \
|
||||
INTSTACK_PRESENT);
|
||||
@@ -177,12 +176,12 @@ void board_crashdump(uintptr_t currentsp, void *tcb,
|
||||
/* users context */
|
||||
|
||||
pdump->info.flags |= USERSTACK_PRESENT;
|
||||
pdump->info.stacks.user.sp = currentsp;
|
||||
pdump->info.stacks.user.sp = sp;
|
||||
}
|
||||
|
||||
pdump->info.stacks.user.top = (uint32_t)rtcb->stack_base_ptr +
|
||||
rtcb->adj_stack_size;
|
||||
pdump->info.stacks.user.size = (uint32_t)rtcb->adj_stack_size;
|
||||
pdump->info.stacks.user.top = (uint32_t)tcb->stack_base_ptr +
|
||||
tcb->adj_stack_size;
|
||||
pdump->info.stacks.user.size = (uint32_t)tcb->adj_stack_size;
|
||||
|
||||
#if CONFIG_ARCH_INTERRUPTSTACK > 3
|
||||
/* Get the limits on the interrupt stack memory */
|
||||
|
||||
@@ -379,17 +379,15 @@ int stm32_bbsram_int(void)
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_STM32F4_SAVE_CRASHDUMP)
|
||||
void board_crashdump(uintptr_t currentsp, void *tcb,
|
||||
const char *filename, int lineno)
|
||||
void board_crashdump(uintptr_t sp, struct tcb_s *tcb,
|
||||
const char *filename, int lineno,
|
||||
const char *msg)
|
||||
{
|
||||
fullcontext_t *pdump = (fullcontext_t *)&g_sdata;
|
||||
struct tcb_s *rtcb;
|
||||
int rv;
|
||||
|
||||
enter_critical_section();
|
||||
|
||||
rtcb = (struct tcb_s *)tcb;
|
||||
|
||||
/* Zero out everything */
|
||||
|
||||
memset(pdump, 0, sizeof(fullcontext_t));
|
||||
@@ -423,10 +421,10 @@ void board_crashdump(uintptr_t currentsp, void *tcb,
|
||||
/* Save Context */
|
||||
|
||||
#if CONFIG_TASK_NAME_SIZE > 0
|
||||
strlcpy(pdump->info.name, rtcb->name, sizeof(pdump->info.name));
|
||||
strlcpy(pdump->info.name, tcb->name, sizeof(pdump->info.name));
|
||||
#endif
|
||||
|
||||
pdump->info.pid = rtcb->pid;
|
||||
pdump->info.pid = tcb->pid;
|
||||
|
||||
/* If current_regs is not NULL then we are in an interrupt context
|
||||
* and the user context is in current_regs else we are running in
|
||||
@@ -435,7 +433,7 @@ void board_crashdump(uintptr_t currentsp, void *tcb,
|
||||
|
||||
if (CURRENT_REGS)
|
||||
{
|
||||
pdump->info.stacks.interrupt.sp = currentsp;
|
||||
pdump->info.stacks.interrupt.sp = sp;
|
||||
pdump->info.flags |= (REGS_PRESENT | USERSTACK_PRESENT | \
|
||||
INTSTACK_PRESENT);
|
||||
memcpy(pdump->info.regs, (void *)CURRENT_REGS,
|
||||
@@ -447,12 +445,12 @@ void board_crashdump(uintptr_t currentsp, void *tcb,
|
||||
/* users context */
|
||||
|
||||
pdump->info.flags |= USERSTACK_PRESENT;
|
||||
pdump->info.stacks.user.sp = currentsp;
|
||||
pdump->info.stacks.user.sp = sp;
|
||||
}
|
||||
|
||||
pdump->info.stacks.user.top = (uint32_t)rtcb->stack_base_ptr +
|
||||
rtcb->adj_stack_size;
|
||||
pdump->info.stacks.user.size = (uint32_t)rtcb->adj_stack_size;
|
||||
pdump->info.stacks.user.top = (uint32_t)tcb->stack_base_ptr +
|
||||
tcb->adj_stack_size;
|
||||
pdump->info.stacks.user.size = (uint32_t)tcb->adj_stack_size;
|
||||
|
||||
#if CONFIG_ARCH_INTERRUPTSTACK > 3
|
||||
/* Get the limits on the interrupt stack memory */
|
||||
|
||||
@@ -379,17 +379,15 @@ int stm32_bbsram_int(void)
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_STM32F7_SAVE_CRASHDUMP)
|
||||
void board_crashdump(uintptr_t currentsp, void *tcb,
|
||||
const char *filename, int lineno)
|
||||
void board_crashdump(uintptr_t sp, struct tcb_s *tcb,
|
||||
const char *filename, int lineno,
|
||||
const char *msg)
|
||||
{
|
||||
fullcontext_t *pdump = (fullcontext_t *)&g_sdata;
|
||||
struct tcb_s *rtcb;
|
||||
int rv;
|
||||
|
||||
enter_critical_section();
|
||||
|
||||
rtcb = (struct tcb_s *)tcb;
|
||||
|
||||
/* Zero out everything */
|
||||
|
||||
memset(pdump, 0, sizeof(fullcontext_t));
|
||||
@@ -423,10 +421,10 @@ void board_crashdump(uintptr_t currentsp, void *tcb,
|
||||
/* Save Context */
|
||||
|
||||
#if CONFIG_TASK_NAME_SIZE > 0
|
||||
strlcpy(pdump->info.name, rtcb->name, sizeof(pdump->info.name));
|
||||
strlcpy(pdump->info.name, tcb->name, sizeof(pdump->info.name));
|
||||
#endif
|
||||
|
||||
pdump->info.pid = rtcb->pid;
|
||||
pdump->info.pid = tcb->pid;
|
||||
|
||||
/* If current_regs is not NULL then we are in an interrupt context
|
||||
* and the user context is in current_regs else we are running in
|
||||
@@ -435,7 +433,7 @@ void board_crashdump(uintptr_t currentsp, void *tcb,
|
||||
|
||||
if (CURRENT_REGS)
|
||||
{
|
||||
pdump->info.stacks.interrupt.sp = currentsp;
|
||||
pdump->info.stacks.interrupt.sp = sp;
|
||||
pdump->info.flags |= (REGS_PRESENT | USERSTACK_PRESENT | \
|
||||
INTSTACK_PRESENT);
|
||||
memcpy(pdump->info.regs, (void *)CURRENT_REGS,
|
||||
@@ -447,12 +445,12 @@ void board_crashdump(uintptr_t currentsp, void *tcb,
|
||||
/* users context */
|
||||
|
||||
pdump->info.flags |= USERSTACK_PRESENT;
|
||||
pdump->info.stacks.user.sp = currentsp;
|
||||
pdump->info.stacks.user.sp = sp;
|
||||
}
|
||||
|
||||
pdump->info.stacks.user.top = (uint32_t)rtcb->stack_base_ptr +
|
||||
rtcb->adj_stack_size;
|
||||
pdump->info.stacks.user.size = (uint32_t)rtcb->adj_stack_size;
|
||||
pdump->info.stacks.user.top = (uint32_t)tcb->stack_base_ptr +
|
||||
tcb->adj_stack_size;
|
||||
pdump->info.stacks.user.size = (uint32_t)tcb->adj_stack_size;
|
||||
|
||||
#if CONFIG_ARCH_INTERRUPTSTACK > 3
|
||||
/* Get the limits on the interrupt stack memory */
|
||||
|
||||
Reference in New Issue
Block a user