You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2023/08/03 10:17:31 UTC
[nuttx] 04/05: assert: add more information to panic notifier
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 3aa2aa4703b95dbc7fe2287ff755e3b5e3d752d9
Author: zhangyuan21 <zh...@xiaomi.com>
AuthorDate: Sat Jun 17 09:29:42 2023 +0800
assert: add more information to panic notifier
Signed-off-by: zhangyuan21 <zh...@xiaomi.com>
---
include/nuttx/panic_notifier.h | 7 +++++--
sched/misc/assert.c | 11 +++++++----
2 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/include/nuttx/panic_notifier.h b/include/nuttx/panic_notifier.h
index 525e68dd4f..a3679d9c49 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 74c1c231b1..478f42beef 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,