You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ma...@apache.org on 2021/06/02 23:27:35 UTC

[incubator-nuttx] branch master updated: arch: Flush syslog buffer for sim and x86_64 arch

This is an automated email from the ASF dual-hosted git repository.

masayuki pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 281921b  arch: Flush syslog buffer for sim and x86_64 arch
281921b is described below

commit 281921bcf9d63088ac335de9ed0c43dbe997cd74
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Wed Jun 2 21:31:43 2021 +0800

    arch: Flush syslog buffer for sim and x86_64 arch
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 arch/sim/src/sim/up_assert.c       | 13 +++++++++++++
 arch/x86_64/src/common/up_assert.c | 12 ++++++++++++
 2 files changed, 25 insertions(+)

diff --git a/arch/sim/src/sim/up_assert.c b/arch/sim/src/sim/up_assert.c
index 1b725ec..a017aad 100644
--- a/arch/sim/src/sim/up_assert.c
+++ b/arch/sim/src/sim/up_assert.c
@@ -26,6 +26,7 @@
 #include <sched/sched.h>
 #include <stdlib.h>
 #include <syslog.h>
+#include <nuttx/syslog/syslog.h>
 #include <nuttx/board.h>
 #include "up_internal.h"
 
@@ -68,6 +69,10 @@
 
 void up_assert(const char *filename, int line)
 {
+  /* Flush any buffered SYSLOG data (from prior to the assertion) */
+
+  syslog_flush();
+
   /* Show the location of the failed assertion */
 
 #ifdef CONFIG_SMP
@@ -78,12 +83,20 @@ void up_assert(const char *filename, int line)
           filename, line);
 #endif
 
+  /* Flush any buffered SYSLOG data (from the above) */
+
+  syslog_flush();
+
   /* Allow for any board/configuration specific crash information */
 
 #ifdef CONFIG_BOARD_CRASHDUMP
   board_crashdump(sim_getsp(), this_task(), filename, line);
 #endif
 
+  /* Flush any buffered SYSLOG data */
+
+  syslog_flush();
+
   if (CURRENT_REGS || (running_task())->flink == NULL)
     {
       /* Exit the simulation */
diff --git a/arch/x86_64/src/common/up_assert.c b/arch/x86_64/src/common/up_assert.c
index 88f5a72..615968f 100644
--- a/arch/x86_64/src/common/up_assert.c
+++ b/arch/x86_64/src/common/up_assert.c
@@ -205,6 +205,10 @@ static void up_dumpstate(void)
 
 static void _up_assert(void)
 {
+  /* Flush any buffered SYSLOG data */
+
+  syslog_flush();
+
   /* Are we in an interrupt handler or the idle task? */
 
   if (g_current_regs || (running_task())->flink == NULL)
@@ -249,6 +253,10 @@ void up_assert(const char *filename, int lineno)
 
   board_autoled_on(LED_ASSERTION);
 
+  /* Flush any buffered SYSLOG data (from prior to the assertion) */
+
+  syslog_flush();
+
 #if CONFIG_TASK_NAME_SIZE > 0 && defined(CONFIG_DEBUG_ALERT)
   _alert("Assertion failed at file:%s line: %d task: %s\n",
         filename, lineno, rtcb->name);
@@ -259,6 +267,10 @@ void up_assert(const char *filename, int lineno)
 
   up_dumpstate();
 
+  /* Flush any buffered SYSLOG data (from the above) */
+
+  syslog_flush();
+
 #ifdef CONFIG_BOARD_CRASHDUMP
   board_crashdump(x64_getsp(), this_task(), filename, lineno);
 #endif