diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2015-03-27 10:45:39 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2015-03-27 10:45:39 -0600 |
commit | 00d8ac3ba4966f96483d6d971aba88ffd97bb3d4 (patch) | |
tree | 48b7a42e740cdc3fca4767ea52c67c9cca405e31 /nuttx | |
parent | a5a39bc63b4177aac2ad8ec3b581b20f95c3f905 (diff) | |
download | px4-nuttx-00d8ac3ba4966f96483d6d971aba88ffd97bb3d4.tar.gz px4-nuttx-00d8ac3ba4966f96483d6d971aba88ffd97bb3d4.tar.bz2 px4-nuttx-00d8ac3ba4966f96483d6d971aba88ffd97bb3d4.zip |
ARMv7-M: Add logic to dump all stack usage on a crash
Diffstat (limited to 'nuttx')
-rw-r--r-- | nuttx/arch/arm/src/armv7-m/up_assert.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/nuttx/arch/arm/src/armv7-m/up_assert.c b/nuttx/arch/arm/src/armv7-m/up_assert.c index 56c6b4457..b70a567d4 100644 --- a/nuttx/arch/arm/src/armv7-m/up_assert.c +++ b/nuttx/arch/arm/src/armv7-m/up_assert.c @@ -135,6 +135,42 @@ static void up_stackdump(uint32_t sp, uint32_t stack_base) #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 */ + +#ifdef CONFIG_PRINT_TASKNAME + lldbg("%s: PID=%d Stack Used=%lu of %lu\n", + rtcb->name, tcb->pid, (unsigned long)up_check_tcbstack(tcb), + (unsigned long)tcb->adj_stack_size); +#else + lldbg("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 */ + + sched_foreach(up_taskdump, NULL); +} +#else +# define showtasks() +#endif + +/**************************************************************************** * Name: up_registerdump ****************************************************************************/ @@ -315,6 +351,10 @@ static void up_dumpstate(void) up_registerdump(); + /* Dump the state of all tasks (if available) */ + + up_showtasks(); + #ifdef CONFIG_ARCH_USBDUMP /* Dump USB trace data */ |