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/01/17 03:04:18 UTC

[nuttx] 01/02: assert: add uname info to assert message

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 4de931737354fc395e985195098fc8855738e3ba
Author: ligd <li...@xiaomi.com>
AuthorDate: Fri Dec 30 14:17:32 2022 +0800

    assert: add uname info to assert message
    
    Signed-off-by: ligd <li...@xiaomi.com>
---
 sched/misc/assert.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/sched/misc/assert.c b/sched/misc/assert.c
index 11700194a4..d6afe4bb67 100644
--- a/sched/misc/assert.c
+++ b/sched/misc/assert.c
@@ -38,6 +38,7 @@
 #include <debug.h>
 #include <stdio.h>
 #include <stdint.h>
+#include <sys/utsname.h>
 
 #include "irq/irq.h"
 #include "sched/sched.h"
@@ -439,6 +440,7 @@ static void show_tasks(void)
 void _assert(FAR const char *filename, int linenum)
 {
   FAR struct tcb_s *rtcb = running_task();
+  struct utsname name;
   bool fatal = false;
 
   /* Flush any buffered SYSLOG data (from prior to the assertion) */
@@ -457,6 +459,11 @@ void _assert(FAR const char *filename, int linenum)
 
   panic_notifier_call_chain(fatal ? PANIC_KERNEL : PANIC_TASK, rtcb);
 
+  uname(&name);
+  _alert("Current Version: %s %s %s %s %s\n",
+          name.sysname, name.nodename,
+          name.release, name.version, name.machine);
+
 #ifdef CONFIG_SMP
 #  if CONFIG_TASK_NAME_SIZE > 0
   _alert("Assertion failed CPU%d at file: %s:%d task: %s %p\n",