Skip to content
Permalink
Browse files

arch: arm: print thread name in z_NanoFatalErrorHandler()

In z_NanoFatalErrorHandler() we want to print the name
of the thread that has faulted, when building with
CONFIG_THREAD_NAME. This commit adds this functionality
for the Arm architecture.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
  • Loading branch information...
ioannisg authored and nashif committed May 20, 2019
1 parent 04ccd40 commit d5481055f2b767911af60f246a089087ec33792b
Showing with 14 additions and 2 deletions.
  1. +14 −2 arch/arm/core/fatal.c
@@ -47,6 +47,10 @@
void z_NanoFatalErrorHandler(unsigned int reason,
const NANO_ESF *pEsf)
{
#ifdef CONFIG_THREAD_NAME
const char *thread_name = k_thread_name_get(k_current_get());
#endif

LOG_PANIC();

switch (reason) {
@@ -77,9 +81,17 @@ void z_NanoFatalErrorHandler(unsigned int reason,
printk("**** Unknown Fatal Error %d! ****\n", reason);
break;
}
printk("Current thread ID = %p\n"
printk("Current thread ID = %p"
#ifdef CONFIG_THREAD_NAME
" (%s)"
#endif
"\n"
"Faulting instruction address = 0x%x\n",
k_current_get(), pEsf->basic.pc);
k_current_get(),
#ifdef CONFIG_THREAD_NAME
thread_name ? thread_name : "unknown",
#endif
pEsf->basic.pc);

/*
* Now that the error has been reported, call the user implemented

0 comments on commit d548105

Please sign in to comment.
You can’t perform that action at this time.