From 45dd7fa9ad9069377237de829d6eebf306f2527c Mon Sep 17 00:00:00 2001 From: Marek Matej Date: Fri, 14 Nov 2025 21:45:05 +0000 Subject: [PATCH] xtensa: debug: enable xtensa thread awareness Enable stack offset switching for Xtensa targets if arch_switch is used. Signed-off-by: Marek Matej --- subsys/debug/thread_info.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/subsys/debug/thread_info.c b/subsys/debug/thread_info.c index 78be9940f7b..704f43d3339 100644 --- a/subsys/debug/thread_info.c +++ b/subsys/debug/thread_info.c @@ -86,12 +86,16 @@ const size_t _kernel_thread_info_offsets[] = { [THREAD_INFO_OFFSET_T_STACK_PTR] = offsetof(struct k_thread, callee_saved.thread_status), #elif defined(CONFIG_XTENSA) - /* Xtensa does not store stack pointers inside thread objects. - * The registers are saved in thread stack where there is - * no fixed location for this to work. So mark this as - * unimplemented to avoid the #warning below. - */ +/* Xtensa does not store stack pointers inside thread objects. + * The registers are saved in thread stack where there is + * no fixed location for this to work. It needs arch_switch in + * order to work on Xtensa. + */ +#ifdef CONFIG_USE_SWITCH + [THREAD_INFO_OFFSET_T_STACK_PTR] = offsetof(struct k_thread, switch_handle), +#else [THREAD_INFO_OFFSET_T_STACK_PTR] = THREAD_INFO_UNIMPLEMENTED, +#endif #elif defined(CONFIG_RX) /* RX doesn't store *anything* inside thread objects yet */ [THREAD_INFO_OFFSET_T_STACK_PTR] = THREAD_INFO_UNIMPLEMENTED,