mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 00:14:22 +08:00
arch/assert: flush the syslog before stack dump
flush the syslog before stack dump to avoid buffer overwrite Signed-off-by: chao.an <anchao@xiaomi.com>
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
|
||||
#include <nuttx/irq.h>
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/syslog/syslog.h>
|
||||
|
||||
#include "up_arch.h"
|
||||
#include "up_internal.h"
|
||||
@@ -67,7 +68,11 @@ static void m16c_stackdump(uint16_t sp, uint16_t stack_top)
|
||||
{
|
||||
uint16_t stack;
|
||||
|
||||
for (stack = sp & ~7; stack < stack_top; stack += 8)
|
||||
/* Flush any buffered SYSLOG data to avoid overwrite */
|
||||
|
||||
syslog_flush();
|
||||
|
||||
for (stack = sp & ~7; stack < (stack_top & ~7); stack += 8)
|
||||
{
|
||||
uint8_t *ptr = (uint8_t *)stack;
|
||||
_alert("%04x: %02x %02x %02x %02x %02x %02x %02x %02x\n",
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
|
||||
#include <nuttx/irq.h>
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/syslog/syslog.h>
|
||||
|
||||
#include "up_arch.h"
|
||||
#include "up_internal.h"
|
||||
@@ -69,7 +70,11 @@ static void rx65n_stackdump(uint16_t sp, uint16_t stack_top)
|
||||
{
|
||||
uint16_t stack;
|
||||
|
||||
for (stack = sp & ~7; stack < stack_top; stack += 8) /* check */
|
||||
/* Flush any buffered SYSLOG data to avoid overwrite */
|
||||
|
||||
syslog_flush();
|
||||
|
||||
for (stack = sp & ~7; stack < (stack_top & ~7); stack += 8) /* check */
|
||||
|
||||
{
|
||||
uint8_t *ptr = (uint8_t *)&stack;
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
#include <nuttx/irq.h>
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/syslog/syslog.h>
|
||||
|
||||
#include "up_arch.h"
|
||||
#include "up_internal.h"
|
||||
@@ -54,7 +55,11 @@ static void sh1_stackdump(uint32_t sp, uint32_t stack_top)
|
||||
{
|
||||
uint32_t stack;
|
||||
|
||||
for (stack = sp & ~0x1f; stack < stack_top; stack += 32)
|
||||
/* Flush any buffered SYSLOG data to avoid overwrite */
|
||||
|
||||
syslog_flush();
|
||||
|
||||
for (stack = sp & ~0x1f; stack < (stack_top & ~0x1f); stack += 32)
|
||||
{
|
||||
uint32_t *ptr = (uint32_t *)stack;
|
||||
_alert("%08x: %08x %08x %08x %08x %08x %08x %08x %08x\n",
|
||||
|
||||
Reference in New Issue
Block a user