syslog: Enable is partial, crippled version of syslog_flush(); arch/: Call syslog_flush() from assertion handling logic.

This commit is contained in:
Gregory Nutt
2018-06-07 16:28:41 -06:00
parent 2d50a2833e
commit a94e3284b3
18 changed files with 224 additions and 17 deletions
+12
View File
@@ -282,6 +282,10 @@ static void up_dumpstate(void)
static void _up_assert(int errorcode) noreturn_function; static void _up_assert(int errorcode) noreturn_function;
static void _up_assert(int errorcode) static void _up_assert(int errorcode)
{ {
/* Flush any buffered SYSLOG data */
(void)syslog_flush();
/* Are we in an interrupt handler or the idle task? */ /* Are we in an interrupt handler or the idle task? */
if (CURRENT_REGS || this_task()->pid == 0) if (CURRENT_REGS || this_task()->pid == 0)
@@ -319,6 +323,10 @@ void up_assert(const uint8_t *filename, int lineno)
board_autoled_on(LED_ASSERTION); board_autoled_on(LED_ASSERTION);
/* Flush any buffered SYSLOG data (prior to the assertion) */
(void)syslog_flush();
#if CONFIG_TASK_NAME_SIZE > 0 #if CONFIG_TASK_NAME_SIZE > 0
_alert("Assertion failed at file:%s line: %d task: %s\n", _alert("Assertion failed at file:%s line: %d task: %s\n",
filename, lineno, rtcb->name); filename, lineno, rtcb->name);
@@ -329,6 +337,10 @@ void up_assert(const uint8_t *filename, int lineno)
up_dumpstate(); up_dumpstate();
/* Flush any buffered SYSLOG data (from the above) */
(void)syslog_flush();
#ifdef CONFIG_BOARD_CRASHDUMP #ifdef CONFIG_BOARD_CRASHDUMP
board_crashdump(up_getsp(), this_task(), filename, lineno); board_crashdump(up_getsp(), this_task(), filename, lineno);
#endif #endif
+12
View File
@@ -336,6 +336,10 @@ static void up_dumpstate(void)
static void _up_assert(int errorcode) noreturn_function; static void _up_assert(int errorcode) noreturn_function;
static void _up_assert(int errorcode) static void _up_assert(int errorcode)
{ {
/* Flush any buffered SYSLOG data */
(void)syslog_flush();
/* Are we in an interrupt handler or the idle task? */ /* Are we in an interrupt handler or the idle task? */
if (CURRENT_REGS || this_task()->pid == 0) if (CURRENT_REGS || this_task()->pid == 0)
@@ -373,6 +377,10 @@ void up_assert(const uint8_t *filename, int lineno)
board_autoled_on(LED_ASSERTION); board_autoled_on(LED_ASSERTION);
/* Flush any buffered SYSLOG data (prior to the assertion) */
(void)syslog_flush();
#if CONFIG_TASK_NAME_SIZE > 0 #if CONFIG_TASK_NAME_SIZE > 0
_alert("Assertion failed at file:%s line: %d task: %s\n", _alert("Assertion failed at file:%s line: %d task: %s\n",
filename, lineno, rtcb->name); filename, lineno, rtcb->name);
@@ -383,6 +391,10 @@ void up_assert(const uint8_t *filename, int lineno)
up_dumpstate(); up_dumpstate();
/* Flush any buffered SYSLOG data (from the above) */
(void)syslog_flush();
#ifdef CONFIG_BOARD_CRASHDUMP #ifdef CONFIG_BOARD_CRASHDUMP
board_crashdump(up_getsp(), this_task(), filename, lineno); board_crashdump(up_getsp(), this_task(), filename, lineno);
#endif #endif
+14
View File
@@ -343,6 +343,10 @@ static void up_dumpstate(void)
static void _up_assert(int errorcode) noreturn_function; static void _up_assert(int errorcode) noreturn_function;
static void _up_assert(int errorcode) static void _up_assert(int errorcode)
{ {
/* Flush any buffered SYSLOG data */
(void)syslog_flush();
/* Are we in an interrupt handler or the idle task? */ /* Are we in an interrupt handler or the idle task? */
if (CURRENT_REGS || this_task()->pid == 0) if (CURRENT_REGS || this_task()->pid == 0)
@@ -388,8 +392,13 @@ void up_assert(const uint8_t *filename, int lineno)
#if CONFIG_TASK_NAME_SIZE > 0 && defined(CONFIG_DEBUG_ALERT) #if CONFIG_TASK_NAME_SIZE > 0 && defined(CONFIG_DEBUG_ALERT)
struct tcb_s *rtcb = this_task(); struct tcb_s *rtcb = this_task();
#endif #endif
board_autoled_on(LED_ASSERTION); board_autoled_on(LED_ASSERTION);
/* Flush any buffered SYSLOG data (prior to the assertion) */
(void)syslog_flush();
#if CONFIG_TASK_NAME_SIZE > 0 #if CONFIG_TASK_NAME_SIZE > 0
_alert("Assertion failed at file:%s line: %d task: %s\n", _alert("Assertion failed at file:%s line: %d task: %s\n",
filename, lineno, rtcb->name); filename, lineno, rtcb->name);
@@ -397,8 +406,13 @@ void up_assert(const uint8_t *filename, int lineno)
_alert("Assertion failed at file:%s line: %d\n", _alert("Assertion failed at file:%s line: %d\n",
filename, lineno); filename, lineno);
#endif #endif
up_dumpstate(); up_dumpstate();
/* Flush any buffered SYSLOG data (from the above) */
(void)syslog_flush();
#ifdef CONFIG_BOARD_CRASHDUMP #ifdef CONFIG_BOARD_CRASHDUMP
board_crashdump(up_getsp(), this_task(), filename, lineno); board_crashdump(up_getsp(), this_task(), filename, lineno);
#endif #endif
+12
View File
@@ -353,6 +353,10 @@ static void up_dumpstate(void)
static void _up_assert(int errorcode) noreturn_function; static void _up_assert(int errorcode) noreturn_function;
static void _up_assert(int errorcode) static void _up_assert(int errorcode)
{ {
/* Flush any buffered SYSLOG data */
(void)syslog_flush();
/* Are we in an interrupt handler or the idle task? */ /* Are we in an interrupt handler or the idle task? */
if (CURRENT_REGS || (this_task())->pid == 0) if (CURRENT_REGS || (this_task())->pid == 0)
@@ -396,6 +400,10 @@ void up_assert(const uint8_t *filename, int lineno)
board_autoled_on(LED_ASSERTION); board_autoled_on(LED_ASSERTION);
/* Flush any buffered SYSLOG data (prior to the assertion) */
(void)syslog_flush();
#if CONFIG_TASK_NAME_SIZE > 0 #if CONFIG_TASK_NAME_SIZE > 0
_alert("Assertion failed at file:%s line: %d task: %s\n", _alert("Assertion failed at file:%s line: %d task: %s\n",
filename, lineno, rtcb->name); filename, lineno, rtcb->name);
@@ -406,6 +414,10 @@ void up_assert(const uint8_t *filename, int lineno)
up_dumpstate(); up_dumpstate();
/* Flush any buffered SYSLOG data (from the above) */
(void)syslog_flush();
#ifdef CONFIG_BOARD_CRASHDUMP #ifdef CONFIG_BOARD_CRASHDUMP
board_crashdump(up_getsp(), this_task(), filename, lineno); board_crashdump(up_getsp(), this_task(), filename, lineno);
#endif #endif
+14
View File
@@ -337,6 +337,10 @@ static void up_dumpstate(void)
static void _up_assert(int errorcode) noreturn_function; static void _up_assert(int errorcode) noreturn_function;
static void _up_assert(int errorcode) static void _up_assert(int errorcode)
{ {
/* Flush any buffered SYSLOG data */
(void)syslog_flush();
/* Are we in an interrupt handler or the idle task? */ /* Are we in an interrupt handler or the idle task? */
if (CURRENT_REGS || (this_task())->pid == 0) if (CURRENT_REGS || (this_task())->pid == 0)
@@ -371,8 +375,13 @@ void up_assert(const uint8_t *filename, int lineno)
#if CONFIG_TASK_NAME_SIZE > 0 && defined(CONFIG_DEBUG_ALERT) #if CONFIG_TASK_NAME_SIZE > 0 && defined(CONFIG_DEBUG_ALERT)
struct tcb_s *rtcb = this_task(); struct tcb_s *rtcb = this_task();
#endif #endif
board_autoled_on(LED_ASSERTION); board_autoled_on(LED_ASSERTION);
/* Flush any buffered SYSLOG data (prior to the assertion) */
(void)syslog_flush();
#if CONFIG_TASK_NAME_SIZE > 0 #if CONFIG_TASK_NAME_SIZE > 0
_alert("Assertion failed at file:%s line: %d task: %s\n", _alert("Assertion failed at file:%s line: %d task: %s\n",
filename, lineno, rtcb->name); filename, lineno, rtcb->name);
@@ -380,8 +389,13 @@ void up_assert(const uint8_t *filename, int lineno)
_alert("Assertion failed at file:%s line: %d\n", _alert("Assertion failed at file:%s line: %d\n",
filename, lineno); filename, lineno);
#endif #endif
up_dumpstate(); up_dumpstate();
/* Flush any buffered SYSLOG data (from the above) */
(void)syslog_flush();
#ifdef CONFIG_BOARD_CRASHDUMP #ifdef CONFIG_BOARD_CRASHDUMP
board_crashdump(up_getsp(), this_task(), filename, lineno); board_crashdump(up_getsp(), this_task(), filename, lineno);
#endif #endif
+12
View File
@@ -77,6 +77,10 @@
static void _up_assert(int errorcode) noreturn_function; static void _up_assert(int errorcode) noreturn_function;
static void _up_assert(int errorcode) static void _up_assert(int errorcode)
{ {
/* Flush any buffered SYSLOG data */
(void)syslog_flush();
/* Are we in an interrupt handler or the idle task? */ /* Are we in an interrupt handler or the idle task? */
if (g_current_regs || this_task()->pid == 0) if (g_current_regs || this_task()->pid == 0)
@@ -139,6 +143,10 @@ void up_assert(const uint8_t *filename, int lineno)
board_autoled_on(LED_ASSERTION); board_autoled_on(LED_ASSERTION);
/* Flush any buffered SYSLOG data (prior to the assertion) */
(void)syslog_flush();
#if CONFIG_TASK_NAME_SIZE > 0 #if CONFIG_TASK_NAME_SIZE > 0
_alert("Assertion failed at file:%s line: %d task: %s\n", _alert("Assertion failed at file:%s line: %d task: %s\n",
filename, lineno, rtcb->name); filename, lineno, rtcb->name);
@@ -149,6 +157,10 @@ void up_assert(const uint8_t *filename, int lineno)
up_dumpstate(); up_dumpstate();
/* Flush any buffered SYSLOG data (from the above) */
(void)syslog_flush();
#ifdef CONFIG_BOARD_CRASHDUMP #ifdef CONFIG_BOARD_CRASHDUMP
board_crashdump(up_getsp(), this_task(), filename, lineno); board_crashdump(up_getsp(), this_task(), filename, lineno);
#endif #endif
+13
View File
@@ -59,6 +59,7 @@
/**************************************************************************** /****************************************************************************
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
/* USB trace dumping */ /* USB trace dumping */
#ifndef CONFIG_USBDEV_TRACE #ifndef CONFIG_USBDEV_TRACE
@@ -264,6 +265,10 @@ static void up_dumpstate(void)
static void _up_assert(int errorcode) noreturn_function; static void _up_assert(int errorcode) noreturn_function;
static void _up_assert(int errorcode) static void _up_assert(int errorcode)
{ {
/* Flush any buffered SYSLOG data */
(void)syslog_flush();
/* Are we in an interrupt handler or the idle task? */ /* Are we in an interrupt handler or the idle task? */
if (g_current_regs || (this_task())->pid == 0) if (g_current_regs || (this_task())->pid == 0)
@@ -301,6 +306,10 @@ void up_assert(const uint8_t *filename, int lineno)
board_autoled_on(LED_ASSERTION); board_autoled_on(LED_ASSERTION);
/* Flush any buffered SYSLOG data (from prior to the assertion) */
(void)syslog_flush();
#if CONFIG_TASK_NAME_SIZE > 0 #if CONFIG_TASK_NAME_SIZE > 0
_alert("Assertion failed at file:%s line: %d task: %s\n", _alert("Assertion failed at file:%s line: %d task: %s\n",
filename, lineno, rtcb->name); filename, lineno, rtcb->name);
@@ -311,6 +320,10 @@ void up_assert(const uint8_t *filename, int lineno)
up_dumpstate(); up_dumpstate();
/* Flush any buffered SYSLOG data (from the above) */
(void)syslog_flush();
#ifdef CONFIG_BOARD_CRASHDUMP #ifdef CONFIG_BOARD_CRASHDUMP
board_crashdump(up_getsp(), this_task(), filename, lineno); board_crashdump(up_getsp(), this_task(), filename, lineno);
#endif #endif
+12
View File
@@ -76,6 +76,10 @@
static void _up_assert(int errorcode) noreturn_function; static void _up_assert(int errorcode) noreturn_function;
static void _up_assert(int errorcode) static void _up_assert(int errorcode)
{ {
/* Flush any buffered SYSLOG data */
(void)syslog_flush();
/* Are we in an interrupt handler or the idle task? */ /* Are we in an interrupt handler or the idle task? */
if (g_current_regs || this_task()->pid == 0) if (g_current_regs || this_task()->pid == 0)
@@ -138,6 +142,10 @@ void up_assert(const uint8_t *filename, int lineno)
board_autoled_on(LED_ASSERTION); board_autoled_on(LED_ASSERTION);
/* Flush any buffered SYSLOG data (from prior to the assertion) */
(void)syslog_flush();
#if CONFIG_TASK_NAME_SIZE > 0 #if CONFIG_TASK_NAME_SIZE > 0
_alert("Assertion failed at file:%s line: %d task: %s\n", _alert("Assertion failed at file:%s line: %d task: %s\n",
filename, lineno, rtcb->name); filename, lineno, rtcb->name);
@@ -148,6 +156,10 @@ void up_assert(const uint8_t *filename, int lineno)
up_dumpstate(); up_dumpstate();
/* Flush any buffered SYSLOG data (from the above) */
(void)syslog_flush();
#ifdef CONFIG_ARCH_USBDUMP #ifdef CONFIG_ARCH_USBDUMP
/* Dump USB trace data */ /* Dump USB trace data */
+12
View File
@@ -77,6 +77,10 @@
static void _up_assert(int errorcode) noreturn_function; static void _up_assert(int errorcode) noreturn_function;
static void _up_assert(int errorcode) static void _up_assert(int errorcode)
{ {
/* Flush any buffered SYSLOG data */
(void)syslog_flush();
/* Are we in an interrupt handler or the idle task? */ /* Are we in an interrupt handler or the idle task? */
if (g_current_regs || this_task()->pid == 0) if (g_current_regs || this_task()->pid == 0)
@@ -139,6 +143,10 @@ void up_assert(const uint8_t *filename, int lineno)
board_autoled_on(LED_ASSERTION); board_autoled_on(LED_ASSERTION);
/* Flush any buffered SYSLOG data (prior to the assertion) */
(void)syslog_flush();
#if CONFIG_TASK_NAME_SIZE > 0 #if CONFIG_TASK_NAME_SIZE > 0
_alert("Assertion failed at file:%s line: %d task: %s\n", _alert("Assertion failed at file:%s line: %d task: %s\n",
filename, lineno, rtcb->name); filename, lineno, rtcb->name);
@@ -155,6 +163,10 @@ void up_assert(const uint8_t *filename, int lineno)
(void)usbtrace_enumerate(assert_tracecallback, NULL); (void)usbtrace_enumerate(assert_tracecallback, NULL);
#endif #endif
/* Flush any buffered SYSLOG data (from the above) */
(void)syslog_flush();
#ifdef CONFIG_BOARD_CRASHDUMP #ifdef CONFIG_BOARD_CRASHDUMP
board_crashdump(up_getsp(), this_task(), filename, lineno); board_crashdump(up_getsp(), this_task(), filename, lineno);
#endif #endif
+12
View File
@@ -341,6 +341,10 @@ static void up_dumpstate(void)
static void _up_assert(int errorcode) noreturn_function; static void _up_assert(int errorcode) noreturn_function;
static void _up_assert(int errorcode) static void _up_assert(int errorcode)
{ {
/* Flush any buffered SYSLOG data */
(void)syslog_flush();
/* Are we in an interrupt handler or the idle task? */ /* Are we in an interrupt handler or the idle task? */
if (CURRENT_REGS || this_task()->pid == 0) if (CURRENT_REGS || this_task()->pid == 0)
@@ -378,6 +382,10 @@ void up_assert(const uint8_t *filename, int lineno)
board_autoled_on(LED_ASSERTION); board_autoled_on(LED_ASSERTION);
/* Flush any buffered SYSLOG data (from prior to the assertion) */
(void)syslog_flush();
#if CONFIG_TASK_NAME_SIZE > 0 #if CONFIG_TASK_NAME_SIZE > 0
_alert("Assertion failed at file:%s line: %d task: %s\n", _alert("Assertion failed at file:%s line: %d task: %s\n",
filename, lineno, rtcb->name); filename, lineno, rtcb->name);
@@ -388,6 +396,10 @@ void up_assert(const uint8_t *filename, int lineno)
up_dumpstate(); up_dumpstate();
/* Flush any buffered SYSLOG data (from the above) */
(void)syslog_flush();
#ifdef CONFIG_BOARD_CRASHDUMP #ifdef CONFIG_BOARD_CRASHDUMP
board_crashdump(up_getsp(), this_task(), filename, lineno); board_crashdump(up_getsp(), this_task(), filename, lineno);
#endif #endif
+12
View File
@@ -78,6 +78,10 @@
static void _up_assert(int errorcode) noreturn_function; static void _up_assert(int errorcode) noreturn_function;
static void _up_assert(int errorcode) static void _up_assert(int errorcode)
{ {
/* Flush any buffered SYSLOG data */
(void)syslog_flush();
/* Are we in an interrupt handler or the idle task? */ /* Are we in an interrupt handler or the idle task? */
if (g_current_regs || this_task()->pid == 0) if (g_current_regs || this_task()->pid == 0)
@@ -140,6 +144,10 @@ void up_assert(const uint8_t *filename, int lineno)
board_autoled_on(LED_ASSERTION); board_autoled_on(LED_ASSERTION);
/* Flush any buffered SYSLOG data (from prior to the assertion) */
(void)syslog_flush();
#if CONFIG_TASK_NAME_SIZE > 0 #if CONFIG_TASK_NAME_SIZE > 0
_alert("Assertion failed at file:%s line: %d task: %s\n", _alert("Assertion failed at file:%s line: %d task: %s\n",
filename, lineno, rtcb->name); filename, lineno, rtcb->name);
@@ -156,6 +164,10 @@ void up_assert(const uint8_t *filename, int lineno)
(void)usbtrace_enumerate(assert_tracecallback, NULL); (void)usbtrace_enumerate(assert_tracecallback, NULL);
#endif #endif
/* Flush any buffered SYSLOG data (from the above) */
(void)syslog_flush();
#ifdef CONFIG_BOARD_CRASHDUMP #ifdef CONFIG_BOARD_CRASHDUMP
board_crashdump(up_getsp(), this_task(), filename, lineno); board_crashdump(up_getsp(), this_task(), filename, lineno);
#endif #endif
+13
View File
@@ -59,6 +59,7 @@
/**************************************************************************** /****************************************************************************
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
/* USB trace dumping */ /* USB trace dumping */
#ifndef CONFIG_USBDEV_TRACE #ifndef CONFIG_USBDEV_TRACE
@@ -76,6 +77,10 @@
static void _up_assert(int errorcode) noreturn_function; static void _up_assert(int errorcode) noreturn_function;
static void _up_assert(int errorcode) static void _up_assert(int errorcode)
{ {
/* Flush any buffered SYSLOG data */
(void)syslog_flush();
/* Are we in an interrupt handler or the idle task? */ /* Are we in an interrupt handler or the idle task? */
if (g_current_regs || this_task()->pid == 0) if (g_current_regs || this_task()->pid == 0)
@@ -138,6 +143,10 @@ void up_assert(const uint8_t *filename, int lineno)
board_autoled_on(LED_ASSERTION); board_autoled_on(LED_ASSERTION);
/* Flush any buffered SYSLOG data (from prior to the assertion) */
(void)syslog_flush();
#if CONFIG_TASK_NAME_SIZE > 0 #if CONFIG_TASK_NAME_SIZE > 0
_alert("Assertion failed at file:%s line: %d task: %s\n", _alert("Assertion failed at file:%s line: %d task: %s\n",
filename, lineno, rtcb->name); filename, lineno, rtcb->name);
@@ -154,6 +163,10 @@ void up_assert(const uint8_t *filename, int lineno)
(void)usbtrace_enumerate(assert_tracecallback, NULL); (void)usbtrace_enumerate(assert_tracecallback, NULL);
#endif #endif
/* Flush any buffered SYSLOG data (from the above) */
(void)syslog_flush();
#ifdef CONFIG_BOARD_CRASHDUMP #ifdef CONFIG_BOARD_CRASHDUMP
board_crashdump(up_getsp(), this_task(), filename, lineno); board_crashdump(up_getsp(), this_task(), filename, lineno);
#endif #endif
+12
View File
@@ -226,6 +226,10 @@ static void up_dumpstate(void)
static void _up_assert(int errorcode) noreturn_function; static void _up_assert(int errorcode) noreturn_function;
static void _up_assert(int errorcode) static void _up_assert(int errorcode)
{ {
/* Flush any buffered SYSLOG data */
(void)syslog_flush();
/* Are we in an interrupt handler or the idle task? */ /* Are we in an interrupt handler or the idle task? */
if (g_current_regs || (this_task())->pid == 0) if (g_current_regs || (this_task())->pid == 0)
@@ -263,6 +267,10 @@ void up_assert(const uint8_t *filename, int lineno)
board_autoled_on(LED_ASSERTION); board_autoled_on(LED_ASSERTION);
/* Flush any buffered SYSLOG data (from prior to the assertion) */
(void)syslog_flush();
#if CONFIG_TASK_NAME_SIZE > 0 #if CONFIG_TASK_NAME_SIZE > 0
_alert("Assertion failed at file:%s line: %d task: %s\n", _alert("Assertion failed at file:%s line: %d task: %s\n",
filename, lineno, rtcb->name); filename, lineno, rtcb->name);
@@ -273,6 +281,10 @@ void up_assert(const uint8_t *filename, int lineno)
up_dumpstate(); up_dumpstate();
/* Flush any buffered SYSLOG data (from the above) */
(void)syslog_flush();
#ifdef CONFIG_BOARD_CRASHDUMP #ifdef CONFIG_BOARD_CRASHDUMP
board_crashdump(up_getsp(), this_task(), filename, lineno); board_crashdump(up_getsp(), this_task(), filename, lineno);
#endif #endif
+16
View File
@@ -116,6 +116,10 @@ static void xtensa_assert(int errorcode)
board_crashdump(up_getsp(), this_task(), filename, lineno); board_crashdump(up_getsp(), this_task(), filename, lineno);
#endif #endif
/* Flush any buffered SYSLOG data (from the above) */
(void)syslog_flush();
/* Are we in an interrupt handler or the idle task? */ /* Are we in an interrupt handler or the idle task? */
if (CURRENT_REGS || this_task()->pid == 0) if (CURRENT_REGS || this_task()->pid == 0)
@@ -157,6 +161,10 @@ void up_assert(const uint8_t *filename, int lineno)
board_autoled_on(LED_ASSERTION); board_autoled_on(LED_ASSERTION);
/* Flush any buffered SYSLOG data (from prior to the assertion) */
(void)syslog_flush();
#if CONFIG_TASK_NAME_SIZE > 0 #if CONFIG_TASK_NAME_SIZE > 0
_alert("Assertion failed at file:%s line: %d task: %s\n", _alert("Assertion failed at file:%s line: %d task: %s\n",
filename, lineno, rtcb->name); filename, lineno, rtcb->name);
@@ -200,6 +208,10 @@ void xtensa_panic(int xptcode, uint32_t *regs)
board_autoled_on(LED_ASSERTION); board_autoled_on(LED_ASSERTION);
/* Flush any buffered SYSLOG data (from prior to the panic) */
(void)syslog_flush();
#if CONFIG_TASK_NAME_SIZE > 0 #if CONFIG_TASK_NAME_SIZE > 0
_alert("Unhandled Exception %d task: %s\n", xptcode, rtcb->name); _alert("Unhandled Exception %d task: %s\n", xptcode, rtcb->name);
#else #else
@@ -300,6 +312,10 @@ void xtensa_user(int exccause, uint32_t *regs)
board_autoled_on(LED_ASSERTION); board_autoled_on(LED_ASSERTION);
/* Flush any buffered SYSLOG data (from prior to the error) */
(void)syslog_flush();
#if CONFIG_TASK_NAME_SIZE > 0 #if CONFIG_TASK_NAME_SIZE > 0
_alert("User Exception: EXCCAUSE=%04x task: %s\n", exccause, rtcb->name); _alert("User Exception: EXCCAUSE=%04x task: %s\n", exccause, rtcb->name);
#else #else
+12
View File
@@ -77,6 +77,10 @@
static void _up_assert(int errorcode) /* noreturn_function */ static void _up_assert(int errorcode) /* noreturn_function */
{ {
/* Flush any buffered SYSLOG data */
(void)syslog_flush();
/* Are we in an interrupt handler or the idle task? */ /* Are we in an interrupt handler or the idle task? */
if (up_interrupt_context() || this_task()->pid == 0) if (up_interrupt_context() || this_task()->pid == 0)
@@ -143,6 +147,10 @@ void up_assert(void)
board_autoled_on(LED_ASSERTION); board_autoled_on(LED_ASSERTION);
/* Flush any buffered SYSLOG data (from prior to the assertion) */
(void)syslog_flush();
#ifdef CONFIG_HAVE_FILENAME #ifdef CONFIG_HAVE_FILENAME
#if CONFIG_TASK_NAME_SIZE > 0 #if CONFIG_TASK_NAME_SIZE > 0
_alert("Assertion failed at file:%s line: %d task: %s\n", _alert("Assertion failed at file:%s line: %d task: %s\n",
@@ -168,6 +176,10 @@ void up_assert(void)
(void)usbtrace_enumerate(assert_tracecallback, NULL); (void)usbtrace_enumerate(assert_tracecallback, NULL);
#endif #endif
/* Flush any buffered SYSLOG data (from the above) */
(void)syslog_flush();
#ifdef CONFIG_BOARD_CRASHDUMP #ifdef CONFIG_BOARD_CRASHDUMP
board_crashdump(up_getsp(), this_task(), filename, lineno); board_crashdump(up_getsp(), this_task(), filename, lineno);
#endif #endif
+12
View File
@@ -76,6 +76,10 @@
static void _up_assert(int errorcode) /* noreturn_function */ static void _up_assert(int errorcode) /* noreturn_function */
{ {
/* Flush any buffered SYSLOG data */
(void)syslog_flush();
/* Are we in an interrupt handler or the idle task? */ /* Are we in an interrupt handler or the idle task? */
if (up_interrupt_context() || this_task()->pid == 0) if (up_interrupt_context() || this_task()->pid == 0)
@@ -142,6 +146,10 @@ void up_assert(void)
board_autoled_on(LED_ASSERTION); board_autoled_on(LED_ASSERTION);
/* Flush any buffered SYSLOG data (from prior to the assertion) */
(void)syslog_flush();
#ifdef CONFIG_HAVE_FILENAME #ifdef CONFIG_HAVE_FILENAME
#if CONFIG_TASK_NAME_SIZE > 0 #if CONFIG_TASK_NAME_SIZE > 0
_alert("Assertion failed at file:%s line: %d task: %s\n", _alert("Assertion failed at file:%s line: %d task: %s\n",
@@ -167,6 +175,10 @@ void up_assert(void)
(void)usbtrace_enumerate(assert_tracecallback, NULL); (void)usbtrace_enumerate(assert_tracecallback, NULL);
#endif #endif
/* Flush any buffered SYSLOG data (from the above) */
(void)syslog_flush();
#ifdef CONFIG_BOARD_CRASHDUMP #ifdef CONFIG_BOARD_CRASHDUMP
board_crashdump(up_getsp(), this_task(), filename, lineno); board_crashdump(up_getsp(), this_task(), filename, lineno);
#endif #endif
+14 -9
View File
@@ -60,6 +60,14 @@
* Interrupts are disabled at the time of the crash and this logic must * Interrupts are disabled at the time of the crash and this logic must
* perform the flush using low-level, non-interrupt driven logic. * perform the flush using low-level, non-interrupt driven logic.
* *
* REVISIT: There is an implementation problem in that if a character
* driver is the underlying device, then there is no mechanism to flush
* the data buffered in the driver with interrupts disabled.
*
* Currently, this function on (a) dumps the interrupt buffer (if the
* SYSLOG interrupt buffer is enabled), and (b) only the SYSLOG interface
* supports supports the 'sc_force()' method.
*
* Input Parameters: * Input Parameters:
* ch - The character to add to the SYSLOG (must be positive). * ch - The character to add to the SYSLOG (must be positive).
* *
@@ -69,16 +77,9 @@
* *
****************************************************************************/ ****************************************************************************/
#if 0
/* REVISIT: (1) Not yet integrated into assertion handlers and (2) there is
* an implementation problem in that if a character driver is the underlying
* device, then there is no mechanism to flush the data buffered in the
* driver with interrupts disabled.
*/
int syslog_flush(void) int syslog_flush(void)
{ {
DEBUGASSERT(g_syslog_channel != NULL && g_syslog_channel->sc_flush != NULL); DEBUGASSERT(g_syslog_channel != NULL);
#ifdef CONFIG_SYSLOG_INTBUFFER #ifdef CONFIG_SYSLOG_INTBUFFER
/* Flush any characters that may have been added to the interrupt /* Flush any characters that may have been added to the interrupt
@@ -88,8 +89,12 @@ int syslog_flush(void)
(void)syslog_flush_intbuffer(g_syslog_channel, true); (void)syslog_flush_intbuffer(g_syslog_channel, true);
#endif #endif
#if 0
/* Then flush all of the buffered output to the SYSLOG device */ /* Then flush all of the buffered output to the SYSLOG device */
DEBUGASSERT(g_syslog_channel->sc_flush != NULL);
return g_syslog_channel->sc_flush(); return g_syslog_channel->sc_flush();
} #else
return 0;
#endif #endif
}
+8 -8
View File
@@ -243,6 +243,14 @@ int syslog_file_channel(FAR const char *devpath);
* Interrupts are disabled at the time of the crash and this logic must * Interrupts are disabled at the time of the crash and this logic must
* perform the flush using low-level, non-interrupt driven logic. * perform the flush using low-level, non-interrupt driven logic.
* *
* REVISIT: There is an implementation problem in that if a character
* driver is the underlying device, then there is no mechanism to flush
* the data buffered in the driver with interrupts disabled.
*
* Currently, this function on (a) dumps the interrupt buffer (if the
* SYSLOG interrupt buffer is enabled), and (b) only the SYSLOG interface
* supports supports the 'sc_force()' method.
*
* Input Parameters: * Input Parameters:
* None * None
* *
@@ -252,15 +260,7 @@ int syslog_file_channel(FAR const char *devpath);
* *
****************************************************************************/ ****************************************************************************/
#if 0
/* REVISIT: (1) Not yet integrated into assertion handlers and (2) there is
* an implementation problem in that if a character driver is the underlying
* device, then there is no mechanism to flush the data buffered in the
* driver with interrupts disabled.
*/
int syslog_flush(void); int syslog_flush(void);
#endif
/**************************************************************************** /****************************************************************************
* Name: nx_vsyslog * Name: nx_vsyslog