Skip to content
Browse files

arch: x86: fatal: If possible, print thread name in crash dump

It's relatively hard to figure out what thread a crash happens in
from the crash dump. E.g, it's usually not immediately possible to
find it out from linker map due to the fact that static symbols are
not there (

So, try to do it as easy if possible, by just printing thread name
in a dump, if thread names are enabled at all.

Signed-off-by: Paul Sokolovsky <>
  • Loading branch information...
pfalcon authored and andrewboie committed Mar 7, 2019
1 parent ea1f7fb commit ec1ffc8bcf4ffb91458a9f31ab9a0768fc78be91
Showing with 12 additions and 1 deletion.
  1. +12 −1 arch/x86/core/fatal.c
@@ -137,6 +137,10 @@ static void unwind_stack(u32_t base_ptr, u16_t cs)
FUNC_NORETURN void z_NanoFatalErrorHandler(unsigned int reason,
const NANO_ESF *pEsf)
const char *thread_name = k_thread_name_get(k_current_get());


@@ -184,7 +188,11 @@ FUNC_NORETURN void z_NanoFatalErrorHandler(unsigned int reason,

printk("Current thread ID = %p\n"
printk("Current thread ID = %p"
" (%s)"
"eax: 0x%08x, ebx: 0x%08x, ecx: 0x%08x, edx: 0x%08x\n"
"esi: 0x%08x, edi: 0x%08x, ebp: 0x%08x, esp: 0x%08x\n"
"eflags: 0x%08x cs: 0x%04x\n"
@@ -193,6 +201,9 @@ FUNC_NORETURN void z_NanoFatalErrorHandler(unsigned int reason,
"eip: 0x%08x\n",
thread_name ? thread_name : "unknown",
pEsf->eax, pEsf->ebx, pEsf->ecx, pEsf->edx,
pEsf->esi, pEsf->edi, pEsf->ebp, pEsf->esp,
pEsf->eflags, pEsf->cs & 0xFFFFU, pEsf->eip);

0 comments on commit ec1ffc8

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