diff --git a/arch/arm/src/armv6-m/arm_assert.c b/arch/arm/src/armv6-m/arm_assert.c index 048959ef1e7..16e76763bfd 100644 --- a/arch/arm/src/armv6-m/arm_assert.c +++ b/arch/arm/src/armv6-m/arm_assert.c @@ -88,51 +88,13 @@ static void up_stackdump(uint32_t sp, uint32_t stack_top) # define up_stackdump(sp,stack_top) #endif -/**************************************************************************** - * Name: up_taskdump - ****************************************************************************/ - -#ifdef CONFIG_STACK_COLORATION -static void up_taskdump(FAR struct tcb_s *tcb, FAR void *arg) -{ - /* Dump interesting properties of this task */ - -#if CONFIG_TASK_NAME_SIZE > 0 - _alert("%s: PID=%d Stack Used=%lu of %lu\n", - tcb->name, tcb->pid, (unsigned long)up_check_tcbstack(tcb), - (unsigned long)tcb->adj_stack_size); -#else - _alert("PID: %d Stack Used=%lu of %lu\n", - tcb->pid, (unsigned long)up_check_tcbstack(tcb), - (unsigned long)tcb->adj_stack_size); -#endif -} -#endif - -/**************************************************************************** - * Name: up_showtasks - ****************************************************************************/ - -#ifdef CONFIG_STACK_COLORATION -static inline void up_showtasks(void) -{ - /* Dump interesting properties of each task in the crash environment */ - - nxsched_foreach(up_taskdump, NULL); -} -#else -# define up_showtasks() -#endif - /**************************************************************************** * Name: up_registerdump ****************************************************************************/ #ifdef CONFIG_ARCH_STACKDUMP -static inline void up_registerdump(void) +static inline void up_registerdump(FAR volatile uint32_t *regs) { - volatile uint32_t *regs = CURRENT_REGS; - /* Are user registers available from interrupt processing? */ if (regs == NULL) @@ -160,7 +122,60 @@ static inline void up_registerdump(void) #endif } #else -# define up_registerdump() +# define up_registerdump(regs) +#endif + +/**************************************************************************** + * Name: up_taskdump + ****************************************************************************/ + +#if defined(CONFIG_STACK_COLORATION) || defined(CONFIG_SCHED_BACKTRACE) +static void up_taskdump(FAR struct tcb_s *tcb, FAR void *arg) +{ + /* Dump interesting properties of this task */ + + _alert( +#if CONFIG_TASK_NAME_SIZE > 0 + "%s: " +#endif + "PID=%d " +#ifdef CONFIG_STACK_COLORATION + "Stack Used=%lu of %lu\n", +#else + "Stack=%lu\n", +#endif +#if CONFIG_TASK_NAME_SIZE > 0 + tcb->name, +#endif + tcb->pid, +#ifdef CONFIG_STACK_COLORATION + (unsigned long)up_check_tcbstack(tcb), +#endif + (unsigned long)tcb->adj_stack_size); + + /* Show back trace */ + +#ifdef CONFIG_SCHED_BACKTRACE + sched_dumpstack(tcb->pid); +#endif + + /* Dump the registers */ + + up_registerdump(tcb->xcp.regs); +} + +/**************************************************************************** + * Name: up_showtasks + ****************************************************************************/ + +static inline void up_showtasks(void) +{ + /* Dump interesting properties of each task in the crash environment */ + + nxsched_foreach(up_taskdump, NULL); +} +#else +# define up_showtasks() #endif /**************************************************************************** @@ -203,9 +218,15 @@ static void up_dumpstate(void) uint32_t istacksize; #endif + /* Show back trace */ + +#ifdef CONFIG_SCHED_BACKTRACE + sched_dumpstack(rtcb->pid); +#endif + /* Dump the registers (if available) */ - up_registerdump(); + up_registerdump(CURRENT_REGS); /* Get the limits on the user stack memory */ diff --git a/arch/arm/src/armv7-a/arm_assert.c b/arch/arm/src/armv7-a/arm_assert.c index 65129cf296f..2388c207c87 100644 --- a/arch/arm/src/armv7-a/arm_assert.c +++ b/arch/arm/src/armv7-a/arm_assert.c @@ -91,50 +91,13 @@ static void up_stackdump(uint32_t sp, uint32_t stack_top) # define up_stackdump(sp,stack_top) #endif -/**************************************************************************** - * Name: up_taskdump - ****************************************************************************/ - -#ifdef CONFIG_STACK_COLORATION -static void up_taskdump(FAR struct tcb_s *tcb, FAR void *arg) -{ - /* Dump interesting properties of this task */ - -#if CONFIG_TASK_NAME_SIZE > 0 - _alert("%s: PID=%d Stack Used=%lu of %lu\n", - tcb->name, tcb->pid, (unsigned long)up_check_tcbstack(tcb), - (unsigned long)tcb->adj_stack_size); -#else - _alert("PID: %d Stack Used=%lu of %lu\n", - tcb->pid, (unsigned long)up_check_tcbstack(tcb), - (unsigned long)tcb->adj_stack_size); -#endif -} -#endif - -/**************************************************************************** - * Name: up_showtasks - ****************************************************************************/ - -#ifdef CONFIG_STACK_COLORATION -static inline void up_showtasks(void) -{ - /* Dump interesting properties of each task in the crash environment */ - - nxsched_foreach(up_taskdump, NULL); -} -#else -# define up_showtasks() -#endif - /**************************************************************************** * Name: up_registerdump ****************************************************************************/ #ifdef CONFIG_ARCH_STACKDUMP -static inline void up_registerdump(void) +static inline void up_registerdump(FAR volatile uint32_t *regs) { - volatile uint32_t *regs = CURRENT_REGS; int reg; /* Are user registers available from interrupt processing? */ @@ -160,7 +123,60 @@ static inline void up_registerdump(void) _alert("CPSR: %08x\n", regs[REG_CPSR]); } #else -# define up_registerdump() +# define up_registerdump(regs) +#endif + +/**************************************************************************** + * Name: up_taskdump + ****************************************************************************/ + +#if defined(CONFIG_STACK_COLORATION) || defined(CONFIG_SCHED_BACKTRACE) +static void up_taskdump(FAR struct tcb_s *tcb, FAR void *arg) +{ + /* Dump interesting properties of this task */ + + _alert( +#if CONFIG_TASK_NAME_SIZE > 0 + "%s: " +#endif + "PID=%d " +#ifdef CONFIG_STACK_COLORATION + "Stack Used=%lu of %lu\n", +#else + "Stack=%lu\n", +#endif +#if CONFIG_TASK_NAME_SIZE > 0 + tcb->name, +#endif + tcb->pid, +#ifdef CONFIG_STACK_COLORATION + (unsigned long)up_check_tcbstack(tcb), +#endif + (unsigned long)tcb->adj_stack_size); + + /* Show back trace */ + +#ifdef CONFIG_SCHED_BACKTRACE + sched_dumpstack(tcb->pid); +#endif + + /* Dump the registers */ + + up_registerdump(tcb->xcp.regs); +} + +/**************************************************************************** + * Name: up_showtasks + ****************************************************************************/ + +static inline void up_showtasks(void) +{ + /* Dump interesting properties of each task in the crash environment */ + + nxsched_foreach(up_taskdump, NULL); +} +#else +# define up_showtasks() #endif /**************************************************************************** @@ -206,9 +222,15 @@ static void up_dumpstate(void) uint32_t kstackbase = 0; #endif + /* Show back trace */ + +#ifdef CONFIG_SCHED_BACKTRACE + sched_dumpstack(rtcb->pid); +#endif + /* Dump the CPU registers (if available) */ - up_registerdump(); + up_registerdump(CURRENT_REGS); /* Get the limits on the user stack memory */ diff --git a/arch/arm/src/armv7-m/arm_assert.c b/arch/arm/src/armv7-m/arm_assert.c index 6a6524587e9..c317d8d3e96 100644 --- a/arch/arm/src/armv7-m/arm_assert.c +++ b/arch/arm/src/armv7-m/arm_assert.c @@ -91,51 +91,13 @@ static void up_stackdump(uint32_t sp, uint32_t stack_top) # define up_stackdump(sp,stack_top) #endif -/**************************************************************************** - * Name: up_taskdump - ****************************************************************************/ - -#ifdef CONFIG_STACK_COLORATION -static void up_taskdump(FAR struct tcb_s *tcb, FAR void *arg) -{ - /* Dump interesting properties of this task */ - -#if CONFIG_TASK_NAME_SIZE > 0 - _alert("%s: PID=%d Stack Used=%lu of %lu\n", - tcb->name, tcb->pid, (unsigned long)up_check_tcbstack(tcb), - (unsigned long)tcb->adj_stack_size); -#else - _alert("PID: %d Stack Used=%lu of %lu\n", - tcb->pid, (unsigned long)up_check_tcbstack(tcb), - (unsigned long)tcb->adj_stack_size); -#endif -} -#endif - -/**************************************************************************** - * Name: up_showtasks - ****************************************************************************/ - -#ifdef CONFIG_STACK_COLORATION -static inline void up_showtasks(void) -{ - /* Dump interesting properties of each task in the crash environment */ - - nxsched_foreach(up_taskdump, NULL); -} -#else -# define up_showtasks() -#endif - /**************************************************************************** * Name: up_registerdump ****************************************************************************/ #ifdef CONFIG_ARCH_STACKDUMP -static inline void up_registerdump(void) +static inline void up_registerdump(FAR volatile uint32_t *regs) { - volatile uint32_t *regs = CURRENT_REGS; - /* Are user registers available from interrupt processing? */ if (regs == NULL) @@ -168,7 +130,60 @@ static inline void up_registerdump(void) #endif } #else -# define up_registerdump() +# define up_registerdump(regs) +#endif + +/**************************************************************************** + * Name: up_taskdump + ****************************************************************************/ + +#if defined(CONFIG_STACK_COLORATION) || defined(CONFIG_SCHED_BACKTRACE) +static void up_taskdump(FAR struct tcb_s *tcb, FAR void *arg) +{ + /* Dump interesting properties of this task */ + + _alert( +#if CONFIG_TASK_NAME_SIZE > 0 + "%s: " +#endif + "PID=%d " +#ifdef CONFIG_STACK_COLORATION + "Stack Used=%lu of %lu\n", +#else + "Stack=%lu\n", +#endif +#if CONFIG_TASK_NAME_SIZE > 0 + tcb->name, +#endif + tcb->pid, +#ifdef CONFIG_STACK_COLORATION + (unsigned long)up_check_tcbstack(tcb), +#endif + (unsigned long)tcb->adj_stack_size); + + /* Show back trace */ + +#ifdef CONFIG_SCHED_BACKTRACE + sched_dumpstack(tcb->pid); +#endif + + /* Dump the registers */ + + up_registerdump(tcb->xcp.regs); +} + +/**************************************************************************** + * Name: up_showtasks + ****************************************************************************/ + +static inline void up_showtasks(void) +{ + /* Dump interesting properties of each task in the crash environment */ + + nxsched_foreach(up_taskdump, NULL); +} +#else +# define up_showtasks() #endif /**************************************************************************** @@ -211,9 +226,15 @@ static void up_dumpstate(void) uint32_t istacksize; #endif + /* Show back trace */ + +#ifdef CONFIG_SCHED_BACKTRACE + sched_dumpstack(rtcb->pid); +#endif + /* Dump the registers (if available) */ - up_registerdump(); + up_registerdump(CURRENT_REGS); /* Get the limits on the user stack memory */ diff --git a/arch/arm/src/armv7-r/arm_assert.c b/arch/arm/src/armv7-r/arm_assert.c index 9d6e6abd89f..7742c4d2263 100644 --- a/arch/arm/src/armv7-r/arm_assert.c +++ b/arch/arm/src/armv7-r/arm_assert.c @@ -88,50 +88,13 @@ static void up_stackdump(uint32_t sp, uint32_t stack_top) # define up_stackdump(sp,stack_top) #endif -/**************************************************************************** - * Name: up_taskdump - ****************************************************************************/ - -#ifdef CONFIG_STACK_COLORATION -static void up_taskdump(FAR struct tcb_s *tcb, FAR void *arg) -{ - /* Dump interesting properties of this task */ - -#if CONFIG_TASK_NAME_SIZE > 0 - _alert("%s: PID=%d Stack Used=%lu of %lu\n", - tcb->name, tcb->pid, (unsigned long)up_check_tcbstack(tcb), - (unsigned long)tcb->adj_stack_size); -#else - _alert("PID: %d Stack Used=%lu of %lu\n", - tcb->pid, (unsigned long)up_check_tcbstack(tcb), - (unsigned long)tcb->adj_stack_size); -#endif -} -#endif - -/**************************************************************************** - * Name: up_showtasks - ****************************************************************************/ - -#ifdef CONFIG_STACK_COLORATION -static inline void up_showtasks(void) -{ - /* Dump interesting properties of each task in the crash environment */ - - nxsched_foreach(up_taskdump, NULL); -} -#else -# define up_showtasks() -#endif - /**************************************************************************** * Name: up_registerdump ****************************************************************************/ #ifdef CONFIG_ARCH_STACKDUMP -static inline void up_registerdump(void) +static inline void up_registerdump(FAR volatile uint32_t *regs) { - volatile uint32_t *regs = CURRENT_REGS; int reg; /* Are user registers available from interrupt processing? */ @@ -157,7 +120,60 @@ static inline void up_registerdump(void) _alert("CPSR: %08x\n", regs[REG_CPSR]); } #else -# define up_registerdump() +# define up_registerdump(regs) +#endif + +/**************************************************************************** + * Name: up_taskdump + ****************************************************************************/ + +#if defined(CONFIG_STACK_COLORATION) || defined(CONFIG_SCHED_BACKTRACE) +static void up_taskdump(FAR struct tcb_s *tcb, FAR void *arg) +{ + /* Dump interesting properties of this task */ + + _alert( +#if CONFIG_TASK_NAME_SIZE > 0 + "%s: " +#endif + "PID=%d " +#ifdef CONFIG_STACK_COLORATION + "Stack Used=%lu of %lu\n", +#else + "Stack=%lu\n", +#endif +#if CONFIG_TASK_NAME_SIZE > 0 + tcb->name, +#endif + tcb->pid, +#ifdef CONFIG_STACK_COLORATION + (unsigned long)up_check_tcbstack(tcb), +#endif + (unsigned long)tcb->adj_stack_size); + + /* Show back trace */ + +#ifdef CONFIG_SCHED_BACKTRACE + sched_dumpstack(tcb->pid); +#endif + + /* Dump the registers */ + + up_registerdump(tcb->xcp.regs); +} + +/**************************************************************************** + * Name: up_showtasks + ****************************************************************************/ + +static inline void up_showtasks(void) +{ + /* Dump interesting properties of each task in the crash environment */ + + nxsched_foreach(up_taskdump, NULL); +} +#else +# define up_showtasks() #endif /**************************************************************************** @@ -203,9 +219,15 @@ static void up_dumpstate(void) uint32_t kstackbase = 0; #endif + /* Show back trace */ + +#ifdef CONFIG_SCHED_BACKTRACE + sched_dumpstack(rtcb->pid); +#endif + /* Dump the registers (if available) */ - up_registerdump(); + up_registerdump(CURRENT_REGS); /* Get the limits on the user stack memory */ diff --git a/arch/arm/src/armv8-m/arm_assert.c b/arch/arm/src/armv8-m/arm_assert.c index 4a3ba2b0207..7cf43bd3af5 100644 --- a/arch/arm/src/armv8-m/arm_assert.c +++ b/arch/arm/src/armv8-m/arm_assert.c @@ -91,51 +91,13 @@ static void up_stackdump(uint32_t sp, uint32_t stack_top) # define up_stackdump(sp,stack_top) #endif -/**************************************************************************** - * Name: up_taskdump - ****************************************************************************/ - -#ifdef CONFIG_STACK_COLORATION -static void up_taskdump(FAR struct tcb_s *tcb, FAR void *arg) -{ - /* Dump interesting properties of this task */ - -#if CONFIG_TASK_NAME_SIZE > 0 - _alert("%s: PID=%d Stack Used=%lu of %lu\n", - tcb->name, tcb->pid, (unsigned long)up_check_tcbstack(tcb), - (unsigned long)tcb->adj_stack_size); -#else - _alert("PID: %d Stack Used=%lu of %lu\n", - tcb->pid, (unsigned long)up_check_tcbstack(tcb), - (unsigned long)tcb->adj_stack_size); -#endif -} -#endif - -/**************************************************************************** - * Name: up_showtasks - ****************************************************************************/ - -#ifdef CONFIG_STACK_COLORATION -static inline void up_showtasks(void) -{ - /* Dump interesting properties of each task in the crash environment */ - - nxsched_foreach(up_taskdump, NULL); -} -#else -# define up_showtasks() -#endif - /**************************************************************************** * Name: up_registerdump ****************************************************************************/ #ifdef CONFIG_ARCH_STACKDUMP -static inline void up_registerdump(void) +static inline void up_registerdump(FAR volatile uint32_t *regs) { - volatile uint32_t *regs = CURRENT_REGS; - /* Are user registers available from interrupt processing? */ if (regs == NULL) @@ -168,7 +130,60 @@ static inline void up_registerdump(void) #endif } #else -# define up_registerdump() +# define up_registerdump(regs) +#endif + +/**************************************************************************** + * Name: up_taskdump + ****************************************************************************/ + +#if defined(CONFIG_STACK_COLORATION) || defined(CONFIG_SCHED_BACKTRACE) +static void up_taskdump(FAR struct tcb_s *tcb, FAR void *arg) +{ + /* Dump interesting properties of this task */ + + _alert( +#if CONFIG_TASK_NAME_SIZE > 0 + "%s: " +#endif + "PID=%d " +#ifdef CONFIG_STACK_COLORATION + "Stack Used=%lu of %lu\n", +#else + "Stack=%lu\n", +#endif +#if CONFIG_TASK_NAME_SIZE > 0 + tcb->name, +#endif + tcb->pid, +#ifdef CONFIG_STACK_COLORATION + (unsigned long)up_check_tcbstack(tcb), +#endif + (unsigned long)tcb->adj_stack_size); + + /* Show back trace */ + +#ifdef CONFIG_SCHED_BACKTRACE + sched_dumpstack(tcb->pid); +#endif + + /* Dump the registers */ + + up_registerdump(tcb->xcp.regs); +} + +/**************************************************************************** + * Name: up_showtasks + ****************************************************************************/ + +static inline void up_showtasks(void) +{ + /* Dump interesting properties of each task in the crash environment */ + + nxsched_foreach(up_taskdump, NULL); +} +#else +# define up_showtasks() #endif /**************************************************************************** @@ -211,9 +226,15 @@ static void up_dumpstate(void) uint32_t istacksize; #endif + /* Show back trace */ + +#ifdef CONFIG_SCHED_BACKTRACE + sched_dumpstack(rtcb->pid); +#endif + /* Dump the registers (if available) */ - up_registerdump(); + up_registerdump(CURRENT_REGS); /* Get the limits on the user stack memory */