46 { 5,
"Waiting - Queue" },
47 { 6,
"Waiting - Semaphore" },
48 { 7,
"Waiting - Event flag" },
49 { 8,
"Waiting - Memory" },
50 { 9,
"Waiting - Memory" },
51 { 10,
"Waiting - I/O" },
52 { 11,
"Waiting - Filesystem" },
53 { 12,
"Waiting - Network" },
54 { 13,
"Waiting - Mutex" },
57 #define THREADX_NUM_STATES ARRAY_SIZE(threadx_thread_states)
59 #define ARM926EJS_REGISTERS_SIZE_SOLICITED (11 * 4)
81 #define ARM926EJS_REGISTERS_SIZE_INTERRUPT (17 * 4)
105 .stack_growth_direction = -1,
106 .num_output_registers = 17,
111 .stack_growth_direction = -1,
112 .num_output_registers = 17,
188 "_tx_thread_current_ptr",
189 "_tx_thread_created_ptr",
190 "_tx_thread_created_count",
208 if (
param->fn_get_stacking_info)
209 return param->fn_get_stacking_info(
rtos, stack_ptr);
211 return param->stacking_info + 0;
223 if (
param->fn_is_thread_id_valid)
224 return param->fn_is_thread_id_valid(
rtos, thread_id);
226 return (thread_id != 0);
240 LOG_ERROR(
"Error reading stack data from ThreadX thread: stack_ptr=0x%" PRIx64, stack_ptr);
246 return param->stacking_info + 0;
249 return param->stacking_info + 1;
255 return (thread_id != 0 && thread_id != 1);
262 int thread_list_size = 0;
279 LOG_ERROR(
"Don't have the number of threads in ThreadX");
287 (uint8_t *)&thread_list_size);
290 LOG_ERROR(
"Could not read ThreadX thread count from target");
304 LOG_ERROR(
"Could not read ThreadX current thread from target");
312 char tmp_str[] =
"Current Execution";
329 if (thread_list_size == 0) {
340 int64_t thread_ptr = 0;
343 param->pointer_width,
344 (uint8_t *)&thread_ptr);
346 LOG_ERROR(
"Could not read ThreadX thread location from target");
351 int64_t prev_thread_ptr = 0;
352 while ((thread_ptr != prev_thread_ptr) && (tasks_found < thread_list_size)) {
354 #define THREADX_THREAD_NAME_STR_SIZE (200)
357 int64_t name_ptr = 0;
364 thread_ptr +
param->thread_name_offset,
365 param->pointer_width,
366 (uint8_t *)&name_ptr);
368 LOG_ERROR(
"Could not read ThreadX thread name pointer from target");
381 (uint8_t *)&tmp_str);
383 LOG_ERROR(
"Error reading thread name from ThreadX target");
389 if (tmp_str[0] ==
'\x00')
390 strcpy(tmp_str,
"No Name");
393 malloc(strlen(tmp_str)+1);
397 int64_t thread_status = 0;
399 thread_ptr +
param->thread_state_offset,
401 (uint8_t *)&thread_status);
403 LOG_ERROR(
"Error reading thread state from ThreadX target");
412 const char *state_desc;
416 state_desc =
"Unknown state";
425 prev_thread_ptr = thread_ptr;
430 prev_thread_ptr +
param->thread_next_offset,
431 param->pointer_width,
432 (uint8_t *) &thread_ptr);
434 LOG_ERROR(
"Error reading next thread pointer in ThreadX thread list");
445 struct rtos_reg **reg_list,
int *num_regs)
462 int64_t stack_ptr = 0;
464 thread_id +
param->thread_stack_offset,
465 param->pointer_width,
466 (uint8_t *)&stack_ptr);
468 LOG_ERROR(
"Error reading stack frame from ThreadX thread");
472 LOG_INFO(
"thread: 0x%" PRIx64
", stack_ptr=0x%" PRIx64, (uint64_t)thread_id, (uint64_t)stack_ptr);
474 if (stack_ptr == 0) {
475 LOG_ERROR(
"null stack pointer in thread");
483 LOG_ERROR(
"Unknown stacking info for thread id=0x%" PRIx64, (uint64_t)thread_id);
493 *symbol_list = calloc(
519 static int threadx_get_thread_detail(
struct rtos *
rtos,
526 #define THREADX_THREAD_NAME_STR_SIZE (200)
549 int64_t name_ptr = 0;
552 thread_id +
param->thread_name_offset,
553 param->pointer_width,
554 (uint8_t *)&name_ptr);
556 LOG_ERROR(
"Could not read ThreadX thread name pointer from target");
564 (uint8_t *)&tmp_str);
566 LOG_ERROR(
"Error reading thread name from ThreadX target");
571 if (tmp_str[0] ==
'\x00')
572 strcpy(tmp_str,
"No Name");
577 int64_t thread_status = 0;
580 thread_id +
param->thread_state_offset,
582 (uint8_t *)&thread_status);
584 LOG_ERROR(
"Error reading thread state from ThreadX target");
597 state_desc =
"Unknown state";
618 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)
static struct aice_port_param_s param
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.
const char * name
Name of this type of target.
struct target_type * type
unsigned char thread_state_offset
unsigned char pointer_width
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)
static const char * target_name(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.