Skip to content

Commit a5b6215

Browse files
MaureenHelmnashif
authored andcommitted
debug: openocd: Add floating point context to openocd offsets
Adds preemptive and cooperative floating point contexts to the openocd offsets array for arm and x86 architectures. Signed-off-by: Maureen Helm <[email protected]>
1 parent 1b2ca67 commit a5b6215

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

subsys/debug/openocd.c

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
#include <kernel_structs.h>
88

9+
#define OPENOCD_UNIMPLEMENTED 0xffffffff
10+
911
#if defined(CONFIG_OPENOCD_SUPPORT) && defined(CONFIG_THREAD_MONITOR)
1012
enum {
1113
OPENOCD_OFFSET_VERSION,
@@ -18,6 +20,9 @@ enum {
1820
OPENOCD_OFFSET_T_PRIO,
1921
OPENOCD_OFFSET_T_STACK_PTR,
2022
OPENOCD_OFFSET_T_NAME,
23+
OPENOCD_OFFSET_T_ARCH,
24+
OPENOCD_OFFSET_T_PREEMPT_FLOAT,
25+
OPENOCD_OFFSET_T_COOP_FLOAT,
2126
};
2227

2328
/* Forward-compatibility notes: 1) Increment OPENOCD_OFFSET_VERSION element
@@ -53,16 +58,29 @@ size_t _kernel_openocd_offsets[] = {
5358
[OPENOCD_OFFSET_T_STACK_PTR] = offsetof(struct k_thread,
5459
callee_saved.sp),
5560
#else
56-
/* Use 0xffffffff as a special value so that OpenOCD knows that
57-
* obtaining the stack pointer is not possible on this particular
58-
* architecture.
61+
/* Use a special value so that OpenOCD knows that obtaining the stack
62+
* pointer is not possible on this particular architecture.
5963
*/
6064
#warning Please define OPENOCD_OFFSET_T_STACK_PTR for this architecture
61-
[OPENOCD_OFFSET_T_STACK_PTR] = 0xffffffff,
65+
[OPENOCD_OFFSET_T_STACK_PTR] = OPENOCD_UNIMPLEMENTED,
6266
#endif
6367
/* Version 0 ends */
6468

6569
[OPENOCD_OFFSET_T_NAME] = offsetof(struct k_thread, name),
70+
[OPENOCD_OFFSET_T_ARCH] = offsetof(struct k_thread, arch),
71+
#if defined(CONFIG_FLOAT) && defined(CONFIG_ARM)
72+
[OPENOCD_OFFSET_T_PREEMPT_FLOAT] = offsetof(struct _thread_arch,
73+
preempt_float),
74+
[OPENOCD_OFFSET_T_COOP_FLOAT] = OPENOCD_UNIMPLEMENTED,
75+
#elif defined(CONFIG_FLOAT) && defined(CONFIG_X86)
76+
[OPENOCD_OFFSET_T_PREEMPT_FLOAT] = offsetof(struct _thread_arch,
77+
preempFloatReg),
78+
[OPENOCD_OFFSET_T_COOP_FLOAT] = offsetof(struct _thread_arch,
79+
coopFloatReg),
80+
#else
81+
[OPENOCD_OFFSET_T_PREEMPT_FLOAT] = OPENOCD_UNIMPLEMENTED,
82+
[OPENOCD_OFFSET_T_COOP_FLOAT] = OPENOCD_UNIMPLEMENTED,
83+
#endif
6684
};
6785

6886
__attribute__((used, section(".openocd_dbg")))

0 commit comments

Comments
 (0)