diff --git a/include/nuttx/panic_notifier.h b/include/nuttx/panic_notifier.h index 525e68dd4fb..a3679d9c494 100644 --- a/include/nuttx/panic_notifier.h +++ b/include/nuttx/panic_notifier.h @@ -46,8 +46,11 @@ enum panic_type_e struct panic_notifier_s { - FAR struct tcb_s *rtcb; - FAR void *regs; + FAR struct tcb_s *rtcb; + FAR void *regs; + FAR const char *msg; + FAR const char *filename; + int linenum; }; /**************************************************************************** diff --git a/sched/misc/assert.c b/sched/misc/assert.c index 74c1c231b1e..478f42beef8 100644 --- a/sched/misc/assert.c +++ b/sched/misc/assert.c @@ -570,10 +570,6 @@ void _assert(FAR const char *filename, int linenum, regs = g_last_regs; } - /* Flush any buffered SYSLOG data (from prior to the assertion) */ - - syslog_flush(); - #if CONFIG_BOARD_RESET_ON_ASSERT < 2 if (!up_interrupt_context() && (rtcb->flags & TCB_FLAG_TTYPE_MASK) != TCB_FLAG_TTYPE_KERNEL) @@ -584,9 +580,16 @@ void _assert(FAR const char *filename, int linenum, notifier_data.rtcb = rtcb; notifier_data.regs = regs; + notifier_data.filename = filename; + notifier_data.linenum = linenum; + notifier_data.msg = msg; panic_notifier_call_chain(fatal ? PANIC_KERNEL : PANIC_TASK, ¬ifier_data); + /* Flush any buffered SYSLOG data (from prior to the assertion) */ + + syslog_flush(); + uname(&name); _alert("Current Version: %s %s %s %s %s\n", name.sysname, name.nodename,