From fe4cc9169d57360c4bd39a70c2dec4a58a40d4f1 Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Thu, 9 Mar 2023 13:51:03 +0100 Subject: [PATCH] cpu/native: define ARCHITECTURE_BREAKPOINT() --- cpu/native/include/architecture_arch.h | 8 ++++++++ cpu/native/native_cpu.c | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/cpu/native/include/architecture_arch.h b/cpu/native/include/architecture_arch.h index ef3ebf2fa5..1a9f7ae06d 100644 --- a/cpu/native/include/architecture_arch.h +++ b/cpu/native/include/architecture_arch.h @@ -24,9 +24,17 @@ extern "C" { #endif +/** + * @brief raise SIGTRAP + * + * We must not include signal.h directly into RIOT application namespace. + */ +void native_breakpoint(void); + /* Doc is provided centrally in architecture.h, hide this from Doxygen */ #ifndef DOXYGEN #define ARCHITECTURE_WORD_BITS (32U) +#define ARCHITECTURE_BREAKPOINT(v) native_breakpoint() #endif /* DOXYGEN */ #ifdef __cplusplus diff --git a/cpu/native/native_cpu.c b/cpu/native/native_cpu.c index 7e0cf5aaa5..5e9e96875a 100644 --- a/cpu/native/native_cpu.c +++ b/cpu/native/native_cpu.c @@ -99,6 +99,11 @@ int thread_isr_stack_usage(void) return -1; } +void native_breakpoint(void) +{ + raise(SIGTRAP); +} + static inline void *align_stack(uintptr_t start, int *stacksize) { const size_t alignment = sizeof(uintptr_t);