From 9eaa70ddf2e5c50503b5e135b52b39ac7ae6f089 Mon Sep 17 00:00:00 2001 From: "Luke T. Shumaker" Date: Wed, 27 Nov 2024 15:27:52 -0700 Subject: gdb-helpers/libcr.py: Use fewer breakpoints They're at a premium on the RP2040. --- libcr/coroutine.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'libcr/coroutine.c') diff --git a/libcr/coroutine.c b/libcr/coroutine.c index 18b2b80..a4d41e8 100644 --- a/libcr/coroutine.c +++ b/libcr/coroutine.c @@ -42,6 +42,9 @@ #ifndef CONFIG_COROUTINE_VALGRIND #error config.h must define CONFIG_COROUTINE_VALGRIND (bool) #endif +#ifndef CONFIG_COROUTINE_GDB + #error config.h must define CONFIG_COROUTINE_GDB (bool) +#endif /* Implementation *************************************************************/ @@ -127,6 +130,7 @@ */ #define ALWAYS_INLINE [[gnu::always_inline]] inline +#define NEVER_INLINE [[gnu::noinline]] /* platform support ***********************************************************/ @@ -314,7 +318,14 @@ uintptr_t sp; #endif } cr_plat_jmp_buf; - static inline void _cr_plat_setjmp_pre(cr_plat_jmp_buf *env [[gnu::unused]]) { + #if CONIG_COROUTINE_GDB + NEVER_INLINE + #endif + static void _cr_plat_setjmp_pre(cr_plat_jmp_buf *env [[gnu::unused]]) { + #if CONIG_COROUTINE_GDB + /* Prevent the call from being optimized away. */ + asm (""); + #endif #if CONFIG_COROUTINE_MEASURE_STACK env->sp = cr_plat_get_sp(); #endif -- cgit v1.2.3-2-g168b