File indexing completed on 2025-05-11 08:24:15
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031 #ifndef _RTEMS_DEBUGGER_THREADS_h
0032 #define _RTEMS_DEBUGGER_THREADS_h
0033
0034 #include <rtems/debugger/rtems-debugger-server.h>
0035
0036 #include <rtems/score/thread.h>
0037
0038 #include "rtems-debugger-block.h"
0039
0040 #ifdef __cplusplus
0041 extern "C" {
0042 #endif
0043
0044
0045
0046
0047 #define RTEMS_DEBUGGER_THREAD_NAME_SIZE (5)
0048
0049
0050
0051
0052 #define RTEMS_DEBUGGER_THREAD_BLOCK_SIZE (32)
0053
0054
0055
0056
0057 #define RTEMS_DEBUGGER_THREAD_FLAG_EXCEPTION (1 << 0)
0058 #define RTEMS_DEBUGGER_THREAD_FLAG_REG_VALID (1 << 1)
0059 #define RTEMS_DEBUGGER_THREAD_FLAG_REG_DIRTY (1 << 2)
0060 #define RTEMS_DEBUGGER_THREAD_FLAG_CONTINUE (1 << 3)
0061 #define RTEMS_DEBUGGER_THREAD_FLAG_STEP (1 << 4)
0062 #define RTEMS_DEBUGGER_THREAD_FLAG_STEPPING (1 << 5)
0063 #define RTEMS_DEBUGGER_THREAD_FLAG_INTS_DISABLED (1 << 6)
0064
0065 #define RTEMS_DEBUGGER_THREAD_FLAG_TARGET_BASE (24)
0066 #define RTEMS_DEBUGGER_THREAD_FLAG_TARGET_MASK (0xff << RTEMS_DEBUGGER_THREAD_FLAG_TARGET_BASE)
0067
0068
0069
0070
0071 #define RTEMS_DEBUGGER_THREAD_FLAG_RESUME \
0072 (RTEMS_DEBUGGER_THREAD_FLAG_CONTINUE | \
0073 RTEMS_DEBUGGER_THREAD_FLAG_STEP | \
0074 RTEMS_DEBUGGER_THREAD_FLAG_STEPPING)
0075
0076
0077
0078
0079 #define RTEMS_DEBUGGER_THREAD_FLAG_STEP_INSTR \
0080 (RTEMS_DEBUGGER_THREAD_FLAG_STEP | \
0081 RTEMS_DEBUGGER_THREAD_FLAG_STEPPING)
0082
0083
0084
0085
0086 typedef struct rtems_debugger_thread
0087 {
0088 uint32_t flags;
0089 const char name[RTEMS_DEBUGGER_THREAD_NAME_SIZE];
0090 Thread_Control* tcb;
0091 rtems_id id;
0092 int cpu;
0093 uint8_t* registers;
0094 int signal;
0095 void* frame;
0096 } rtems_debugger_thread;
0097
0098
0099
0100
0101
0102 typedef struct rtems_debugger_thread_stepper
0103 {
0104 rtems_debugger_thread* thread;
0105 uintptr_t start;
0106 uintptr_t end;
0107 } rtems_debugger_thread_stepper;
0108
0109
0110
0111
0112 struct rtems_debugger_threads
0113 {
0114 rtems_debugger_block current;
0115 rtems_debugger_block registers;
0116 rtems_debugger_block excludes;
0117 rtems_debugger_block stopped;
0118 rtems_debugger_block steppers;
0119 size_t next;
0120 int selector_gen;
0121 int selector_cont;
0122 };
0123
0124
0125
0126
0127 extern int rtems_debugger_thread_create(void);
0128
0129
0130
0131
0132 extern int rtems_debugger_thread_destroy(void);
0133
0134
0135
0136
0137 extern int rtems_debugger_thread_find_index(rtems_id id);
0138
0139
0140
0141
0142 extern int rtems_debugger_thread_system_suspend(void);
0143
0144
0145
0146
0147 extern int rtems_debugger_thread_system_resume(bool detaching);
0148
0149
0150
0151
0152 extern int rtems_debugger_thread_continue_all(void);
0153
0154
0155
0156
0157 extern int rtems_debugger_thread_continue(rtems_debugger_thread* thread);
0158
0159
0160
0161
0162 extern int rtems_debugger_thread_step(rtems_debugger_thread* thread);
0163
0164
0165
0166
0167 extern int rtems_debugger_thread_stepping(rtems_debugger_thread* thread,
0168 uintptr_t start,
0169 uintptr_t end);
0170
0171
0172
0173
0174
0175 extern const rtems_debugger_thread_stepper*
0176 rtems_debugger_thread_is_stepping(rtems_id id, uintptr_t pc);
0177
0178
0179
0180
0181 extern int rtems_debugger_thread_current_priority(rtems_debugger_thread* thread);
0182
0183
0184
0185
0186 extern int rtems_debugger_thread_real_priority(rtems_debugger_thread* thread);
0187
0188
0189
0190
0191 extern int rtems_debugger_thread_state(rtems_debugger_thread* thread);
0192
0193
0194
0195
0196
0197
0198
0199
0200
0201 extern int rtems_debugger_thread_state_str(rtems_debugger_thread* thread,
0202 char* buffer,
0203 size_t size);
0204
0205
0206
0207
0208 extern unsigned long rtems_debugger_thread_stack_size(rtems_debugger_thread* thread);
0209
0210
0211
0212
0213 extern void* rtems_debugger_thread_stack_area(rtems_debugger_thread* thread);
0214
0215
0216
0217
0218
0219 static inline bool
0220 rtems_debugger_thread_flag(rtems_debugger_thread* thread, uint32_t mask)
0221 {
0222 return (thread->flags & mask) != 0;
0223 }
0224
0225
0226
0227
0228 static inline rtems_debugger_thread*
0229 rtems_debugger_thread_current(rtems_debugger_threads* threads)
0230 {
0231 return threads->current.block;
0232 }
0233
0234
0235
0236
0237 static inline uint8_t*
0238 rtems_debugger_thread_registers(rtems_debugger_threads* threads)
0239 {
0240 return threads->registers.block;
0241 }
0242
0243
0244
0245
0246 static inline rtems_id*
0247 rtems_debugger_thread_excludes(rtems_debugger_threads* threads)
0248 {
0249 return threads->excludes.block;
0250 }
0251
0252
0253
0254
0255 static inline rtems_id*
0256 rtems_debugger_thread_stopped(rtems_debugger_threads* threads)
0257 {
0258 return threads->stopped.block;
0259 }
0260
0261
0262
0263
0264 static inline rtems_debugger_thread_stepper*
0265 rtems_debugger_thread_steppers(rtems_debugger_threads* threads)
0266 {
0267 return threads->steppers.block;
0268 }
0269
0270 #ifdef __cplusplus
0271 }
0272 #endif
0273
0274 #endif