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:
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 */
|
||||
|
@ -332,18 +332,16 @@ int rx65n_sbram_int(void)
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_RX65N_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)
|
||||
{
|
||||
struct fullcontext *pdump ;
|
||||
struct fullcontext *pdump;
|
||||
pdump = (struct fullcontext *)&g_sdata;
|
||||
struct tcb_s *rtcb;
|
||||
int rv;
|
||||
|
||||
enter_critical_section();
|
||||
|
||||
rtcb = (struct tcb_s *)tcb;
|
||||
|
||||
/* Zero out everything */
|
||||
|
||||
memset((uint8_t *)pdump, 0, sizeof(struct fullcontext));
|
||||
@ -377,10 +375,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
|
||||
@ -389,7 +387,7 @@ void board_crashdump(uintptr_t currentsp, void *tcb,
|
||||
|
||||
if (g_current_regs)
|
||||
{
|
||||
pdump->info.stacks.interrupt.sp = currentsp;
|
||||
pdump->info.stacks.interrupt.sp = sp;
|
||||
pdump->info.flags |= (REGS_PRESENT | USERSTACK_PRESENT | \
|
||||
INTSTACK_PRESENT);
|
||||
memcpy((uint8_t *)pdump->info.regs, (void *)g_current_regs,
|
||||
@ -401,12 +399,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 */
|
||||
|
@ -330,18 +330,16 @@ int rx65n_sbram_int(void)
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_RX65N_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)
|
||||
{
|
||||
struct fullcontext *pdump ;
|
||||
struct fullcontext *pdump;
|
||||
pdump = (struct fullcontext *)&g_sdata;
|
||||
struct tcb_s *rtcb;
|
||||
int rv;
|
||||
|
||||
enter_critical_section();
|
||||
|
||||
rtcb = (struct tcb_s *)tcb;
|
||||
|
||||
/* Zero out everything */
|
||||
|
||||
memset((uint8_t *)pdump, 0, sizeof(struct fullcontext));
|
||||
@ -375,10 +373,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
|
||||
@ -387,7 +385,7 @@ void board_crashdump(uintptr_t currentsp, void *tcb,
|
||||
|
||||
if (g_current_regs)
|
||||
{
|
||||
pdump->info.stacks.interrupt.sp = currentsp;
|
||||
pdump->info.stacks.interrupt.sp = sp;
|
||||
pdump->info.flags |= (REGS_PRESENT | USERSTACK_PRESENT | \
|
||||
INTSTACK_PRESENT);
|
||||
memcpy((uint8_t *)pdump->info.regs, (void *)g_current_regs,
|
||||
@ -399,12 +397,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 */
|
||||
|
@ -802,9 +802,10 @@ int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg);
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_BOARD_CRASHDUMP
|
||||
void board_crashdump(uintptr_t currentsp, FAR void *tcb,
|
||||
FAR const char *filename,
|
||||
int lineno);
|
||||
struct tcb_s;
|
||||
void board_crashdump(uintptr_t sp, FAR struct tcb_s *tcb,
|
||||
FAR const char *filename, int lineno,
|
||||
FAR const char *msg);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -525,7 +525,7 @@ void _assert(FAR const char *filename, int linenum, FAR const char *msg)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BOARD_CRASHDUMP
|
||||
board_crashdump(up_getsp(), rtcb, filename, linenum);
|
||||
board_crashdump(up_getsp(), rtcb, filename, linenum, msg);
|
||||
#endif
|
||||
|
||||
/* Flush any buffered SYSLOG data */
|
||||
|
Loading…
Reference in New Issue
Block a user