assert: add panic notifier data for notify more information
Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
This commit is contained in:
parent
ef48dec9f9
commit
bfab486611
|
@ -140,10 +140,6 @@
|
|||
|
||||
#define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/notifier.h>
|
||||
#include <nuttx/sched.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
|
@ -41,6 +42,14 @@ enum panic_type_e
|
|||
PANIC_KERNEL_FINAL = 2,
|
||||
};
|
||||
|
||||
/* Notifier data for panic */
|
||||
|
||||
struct panic_notifier_s
|
||||
{
|
||||
FAR struct tcb_s *rtcb;
|
||||
FAR void *regs;
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function
|
||||
****************************************************************************/
|
||||
|
|
|
@ -553,6 +553,7 @@ void _assert(FAR const char *filename, int linenum,
|
|||
FAR const char *msg, FAR void *regs)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = running_task();
|
||||
struct panic_notifier_s notifier_data;
|
||||
struct utsname name;
|
||||
bool fatal = true;
|
||||
int flags;
|
||||
|
@ -581,7 +582,10 @@ void _assert(FAR const char *filename, int linenum,
|
|||
}
|
||||
#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);
|
||||
_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 */
|
||||
|
||||
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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue