arch: Flush syslog buffer for sim and x86_64 arch

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2021-06-02 21:31:43 +08:00 committed by Masayuki Ishikawa
parent 81e63e3a63
commit 281921bcf9
2 changed files with 25 additions and 0 deletions

View File

@ -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 */

View File

@ -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