45 { 5,
"Waiting - Queue" },
46 { 6,
"Waiting - Semaphore" },
47 { 7,
"Waiting - Event flag" },
48 { 8,
"Waiting - Memory" },
49 { 9,
"Waiting - Memory" },
50 { 10,
"Waiting - I/O" },
51 { 11,
"Waiting - Filesystem" },
52 { 12,
"Waiting - Network" },
53 { 13,
"Waiting - Mutex" },
56 #define THREADX_NUM_STATES ARRAY_SIZE(threadx_thread_states)
58 #define ARM926EJS_REGISTERS_SIZE_SOLICITED (11 * 4)
80 #define ARM926EJS_REGISTERS_SIZE_INTERRUPT (17 * 4)
104 .stack_growth_direction = -1,
105 .num_output_registers = 17,
110 .stack_growth_direction = -1,
111 .num_output_registers = 17,
187 "_tx_thread_current_ptr",
188 "_tx_thread_created_ptr",
189 "_tx_thread_created_count",
225 return (thread_id != 0);
239 LOG_ERROR(
"Error reading stack data from ThreadX thread: stack_ptr=0x%" PRIx64, stack_ptr);
254 return (thread_id != 0 && thread_id != 1);
261 int thread_list_size = 0;
278 LOG_ERROR(
"Don't have the number of threads in ThreadX");
286 (uint8_t *)&thread_list_size);
289 LOG_ERROR(
"Could not read ThreadX thread count from target");
303 LOG_ERROR(
"Could not read ThreadX current thread from target");
311 char tmp_str[] =
"Current Execution";
328 if (thread_list_size == 0) {
339 int64_t thread_ptr = 0;
343 (uint8_t *)&thread_ptr);
345 LOG_ERROR(
"Could not read ThreadX thread location from target");
350 int64_t prev_thread_ptr = 0;
351 while ((thread_ptr != prev_thread_ptr) && (tasks_found < thread_list_size)) {
353 #define THREADX_THREAD_NAME_STR_SIZE (200)
356 int64_t name_ptr = 0;
365 (uint8_t *)&name_ptr);
367 LOG_ERROR(
"Could not read ThreadX thread name pointer from target");
380 (uint8_t *)&tmp_str);
382 LOG_ERROR(
"Error reading thread name from ThreadX target");
388 if (tmp_str[0] ==
'\x00')
389 strcpy(tmp_str,
"No Name");
392 malloc(strlen(tmp_str)+1);
396 int64_t thread_status = 0;
400 (uint8_t *)&thread_status);
402 LOG_ERROR(
"Error reading thread state from ThreadX target");
411 const char *state_desc;
415 state_desc =
"Unknown state";
424 prev_thread_ptr = thread_ptr;
431 (uint8_t *) &thread_ptr);
433 LOG_ERROR(
"Error reading next thread pointer in ThreadX thread list");
444 struct rtos_reg **reg_list,
int *num_regs)
461 int64_t stack_ptr = 0;
465 (uint8_t *)&stack_ptr);
467 LOG_ERROR(
"Error reading stack frame from ThreadX thread");
471 LOG_INFO(
"thread: 0x%" PRIx64
", stack_ptr=0x%" PRIx64, (uint64_t)thread_id, (uint64_t)stack_ptr);
473 if (stack_ptr == 0) {
474 LOG_ERROR(
"null stack pointer in thread");
482 LOG_ERROR(
"Unknown stacking info for thread id=0x%" PRIx64, (uint64_t)thread_id);
492 *symbol_list = calloc(
518 static int threadx_get_thread_detail(
struct rtos *
rtos,
525 #define THREADX_THREAD_NAME_STR_SIZE (200)
548 int64_t name_ptr = 0;
553 (uint8_t *)&name_ptr);
555 LOG_ERROR(
"Could not read ThreadX thread name pointer from target");
563 (uint8_t *)&tmp_str);
565 LOG_ERROR(
"Error reading thread name from ThreadX target");
570 if (tmp_str[0] ==
'\x00')
571 strcpy(tmp_str,
"No Name");
576 int64_t thread_status = 0;
581 (uint8_t *)&thread_status);
583 LOG_ERROR(
"Error reading thread state from ThreadX target");
596 state_desc =
"Unknown state";
617 LOG_ERROR(
"Could not find target in ThreadX compatibility list");
static const struct rtos_register_stacking * get_stacking_info(const struct rtos *rtos, int64_t stack_ptr)
static const struct threadx_params threadx_params_list[]
#define ARM926EJS_REGISTERS_SIZE_SOLICITED
#define THREADX_THREAD_NAME_STR_SIZE
static int threadx_create(struct target *target)
static const struct rtos_register_stacking * get_stacking_info_arm926ejs(const struct rtos *rtos, int64_t stack_ptr)
static const char *const threadx_symbol_list[]
#define ARM926EJS_REGISTERS_SIZE_INTERRUPT
const struct rtos_type threadx_rtos
static bool threadx_detect_rtos(struct target *target)
static const struct rtos_register_stacking rtos_threadx_arm926ejs_stacking[]
static const struct stack_register_offset rtos_threadx_arm926ejs_stack_offsets_solicited[]
static int threadx_get_thread_reg_list(struct rtos *rtos, int64_t thread_id, struct rtos_reg **reg_list, int *num_regs)
static int threadx_get_symbol_list_to_lookup(struct symbol_table_elem *symbol_list[])
static int is_thread_id_valid_arm926ejs(const struct rtos *rtos, int64_t thread_id)
static int threadx_update_threads(struct rtos *rtos)
@ THREADX_VAL_TX_THREAD_CREATED_PTR
@ THREADX_VAL_TX_THREAD_CURRENT_PTR
@ THREADX_VAL_TX_THREAD_CREATED_COUNT
static const struct threadx_thread_state threadx_thread_states[]
static const struct stack_register_offset rtos_threadx_arm926ejs_stack_offsets_interrupt[]
#define THREADX_NUM_STATES
static int is_thread_id_valid(const struct rtos *rtos, int64_t thread_id)
The JTAG interface can be implemented with a software or hardware fifo.
#define LOG_ERROR(expr ...)
#define LOG_INFO(expr ...)
#define LOG_DEBUG(expr ...)
static const struct rtos_register_stacking * stacking_info
int rtos_generic_stack_read(struct target *target, const struct rtos_register_stacking *stacking, int64_t stack_ptr, struct rtos_reg **reg_list, int *num_regs)
void rtos_free_threadlist(struct rtos *rtos)
const struct rtos_register_stacking rtos_standard_cortex_m3_stacking
const struct rtos_register_stacking rtos_standard_cortex_r4_stacking
unsigned char stack_registers_size
struct thread_detail * thread_details
struct symbol_table_elem * symbols
void * rtos_specific_params
threadid_t current_thread
Table should be terminated by an element with NULL in symbol_name.
unsigned char thread_state_offset
unsigned char pointer_width
const struct rtos_register_stacking *(* fn_get_stacking_info)(const struct rtos *rtos, int64_t stack_ptr)
const struct rtos_register_stacking * stacking_info
unsigned char thread_next_offset
int(* fn_is_thread_id_valid)(const struct rtos *rtos, int64_t thread_id)
unsigned char thread_stack_offset
unsigned char thread_name_offset
int target_read_buffer(struct target *target, target_addr_t address, uint32_t size, uint8_t *buffer)
const char * target_type_name(const struct target *target)
Get the target type name.
static const char * target_name(const struct target *target)
Returns the instance-specific name of the specified target.
#define ARRAY_SIZE(x)
Compute the number of elements of a variable length array.