diff options
Diffstat (limited to 'libcr/coroutine.c')
-rw-r--r-- | libcr/coroutine.c | 13 |
1 files changed, 12 insertions, 1 deletions
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 |