mirror of
https://github.com/apache/nuttx.git
synced 2026-06-04 14:53:47 +08:00
debug/0 address: Add 0 address access panic configuration
Implemented using up_debugpoint_add Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
This commit is contained in:
committed by
Xiang Xiao
parent
4270235bfa
commit
bdd3869d26
@@ -2432,6 +2432,14 @@ endif # DEBUG_CORESIGHT
|
|||||||
|
|
||||||
endif # DEBUG_FEATURES
|
endif # DEBUG_FEATURES
|
||||||
|
|
||||||
|
config ARCH_PROTECT_ZERO_ADDRESS
|
||||||
|
bool "Protect address zero"
|
||||||
|
depends on ARCH_HAVE_DEBUG
|
||||||
|
default n
|
||||||
|
---help---
|
||||||
|
When the program accesses address 0, it will assert automatically.
|
||||||
|
Hardware support is required, such as ARM V8M DWT watchpoint
|
||||||
|
|
||||||
config ARCH_HAVE_STACKCHECK
|
config ARCH_HAVE_STACKCHECK
|
||||||
bool
|
bool
|
||||||
default n
|
default n
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
#include <nuttx/irq.h>
|
#include <nuttx/irq.h>
|
||||||
#include <nuttx/trace.h>
|
#include <nuttx/trace.h>
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
#include "irq/irq.h"
|
#include "irq/irq.h"
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -59,6 +60,14 @@ struct irq_info_s g_irqvector[NR_IRQS];
|
|||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef CONFIG_ARCH_PROTECT_ZERO_ADDRESS
|
||||||
|
static void zero_addr_handler(int type, FAR void *addr, size_t size,
|
||||||
|
FAR void *arg)
|
||||||
|
{
|
||||||
|
PANIC();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: irq_initialize
|
* Name: irq_initialize
|
||||||
*
|
*
|
||||||
@@ -87,5 +96,11 @@ void irq_initialize(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
up_irqinitialize();
|
up_irqinitialize();
|
||||||
|
|
||||||
|
#ifdef CONFIG_ARCH_PROTECT_ZERO_ADDRESS
|
||||||
|
up_debugpoint_add(DEBUGPOINT_WATCHPOINT_RW, 0, 0,
|
||||||
|
zero_addr_handler, NULL);
|
||||||
|
#endif
|
||||||
|
|
||||||
sched_trace_end();
|
sched_trace_end();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user