mirror of
https://github.com/apache/nuttx.git
synced 2026-05-31 14:27:37 +08:00
assert: add panic notifier data for notify more information
Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
This commit is contained in:
@@ -140,10 +140,6 @@
|
|||||||
|
|
||||||
#define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
|
#define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Included Files
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Data
|
* Public Data
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
|
|
||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
#include <nuttx/notifier.h>
|
#include <nuttx/notifier.h>
|
||||||
|
#include <nuttx/sched.h>
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
@@ -41,6 +42,14 @@ enum panic_type_e
|
|||||||
PANIC_KERNEL_FINAL = 2,
|
PANIC_KERNEL_FINAL = 2,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* Notifier data for panic */
|
||||||
|
|
||||||
|
struct panic_notifier_s
|
||||||
|
{
|
||||||
|
FAR struct tcb_s *rtcb;
|
||||||
|
FAR void *regs;
|
||||||
|
};
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Function
|
* Public Function
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|||||||
+6
-2
@@ -553,6 +553,7 @@ void _assert(FAR const char *filename, int linenum,
|
|||||||
FAR const char *msg, FAR void *regs)
|
FAR const char *msg, FAR void *regs)
|
||||||
{
|
{
|
||||||
FAR struct tcb_s *rtcb = running_task();
|
FAR struct tcb_s *rtcb = running_task();
|
||||||
|
struct panic_notifier_s notifier_data;
|
||||||
struct utsname name;
|
struct utsname name;
|
||||||
bool fatal = true;
|
bool fatal = true;
|
||||||
int flags;
|
int flags;
|
||||||
@@ -581,7 +582,10 @@ void _assert(FAR const char *filename, int linenum,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
panic_notifier_call_chain(fatal ? PANIC_KERNEL : PANIC_TASK, rtcb);
|
notifier_data.rtcb = rtcb;
|
||||||
|
notifier_data.regs = regs;
|
||||||
|
panic_notifier_call_chain(fatal ? PANIC_KERNEL : PANIC_TASK,
|
||||||
|
¬ifier_data);
|
||||||
|
|
||||||
uname(&name);
|
uname(&name);
|
||||||
_alert("Current Version: %s %s %s %s %s\n",
|
_alert("Current Version: %s %s %s %s %s\n",
|
||||||
@@ -658,7 +662,7 @@ void _assert(FAR const char *filename, int linenum,
|
|||||||
/* Flush any buffered SYSLOG data */
|
/* Flush any buffered SYSLOG data */
|
||||||
|
|
||||||
syslog_flush();
|
syslog_flush();
|
||||||
panic_notifier_call_chain(PANIC_KERNEL_FINAL, rtcb);
|
panic_notifier_call_chain(PANIC_KERNEL_FINAL, ¬ifier_data);
|
||||||
|
|
||||||
reboot_notifier_call_chain(SYS_HALT, NULL);
|
reboot_notifier_call_chain(SYS_HALT, NULL);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user