24 #define EXTRAINFO_SIZE 256
41 #define TCBINFO_TARGET_SIZE 22
59 {
"g_readytorun",
false },
60 {
"g_pidhash",
false },
61 {
"g_npidhash",
false },
62 {
"g_tcbinfo",
false },
63 {
"g_reg_offs",
false},
87 .target_name =
"hla_target",
91 .target_name =
"esp32",
95 .target_name =
"esp32s2",
99 .target_name =
"esp32s3",
103 .target_name =
"esp32c3",
160 uint32_t pidhashaddr, npidhash, tcbaddr;
178 LOG_ERROR(
"Failed to read g_npidhash: ret = %d", ret);
182 LOG_DEBUG(
"Hash table size (g_npidhash) = %" PRId32, npidhash);
186 LOG_ERROR(
"Failed to read g_pidhash address: ret = %d", ret);
190 LOG_DEBUG(
"Hash table address (g_pidhash) = %" PRIx32, pidhashaddr);
192 uint8_t *pidhash = malloc(npidhash *
PTR_WIDTH);
200 LOG_ERROR(
"Failed to read tcbhash: ret = %d", ret);
210 LOG_ERROR(
"Failed to read tcbinfo: ret = %d", ret);
228 LOG_ERROR(
"Failed to read g_readytorun: ret = %d", ret);
233 uint32_t thread_count = 0;
235 for (
unsigned int i = 0; i < npidhash; i++) {
243 LOG_ERROR(
"Failed to read PID of TCB@0x%x from pidhash[%d]: ret = %d",
250 LOG_ERROR(
"Failed to read state of TCB@0x%x from pidhash[%d]: ret = %d",
257 if (!new_thread_details) {
262 struct thread_detail *thread = &new_thread_details[thread_count];
290 LOG_ERROR(
"Failed to read thread's name: ret = %d", ret);
306 struct rtos_reg **reg_list,
int *num_regs)
308 struct reg **gdb_reg_list;
315 LOG_ERROR(
"target_get_gdb_reg_list failed %d", ret);
319 *reg_list = calloc(*num_regs,
sizeof(
struct rtos_reg));
321 LOG_ERROR(
"Failed to alloc memory for %d", *num_regs);
326 for (
int i = 0; i < *num_regs; i++) {
327 (*reg_list)[i].number = gdb_reg_list[i]->
number;
328 (*reg_list)[i].size = gdb_reg_list[i]->
size;
329 memcpy((*reg_list)[i].
value, gdb_reg_list[i]->
value, ((*reg_list)[i].
size + 7) / 8);
338 struct rtos_reg **reg_list,
int *num_regs)
346 LOG_ERROR(
"Can't find a way to get stacking info");
354 LOG_ERROR(
"Failed to read registers' offset: ret = %d", ret);
360 LOG_ERROR(
"Failed to read registers' address: ret = %d", ret);
368 struct rtos_reg **reg_list,
int *num_regs)
static struct esp_usb_jtag * priv
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 int nuttx_get_symbol_list_to_lookup(struct symbol_table_elem *symbol_list[])
static const struct symbols nuttx_symbol_list[]
static bool nuttx_detect_rtos(struct target *target)
static int nuttx_getregs_fromstack(struct rtos *rtos, int64_t thread_id, struct rtos_reg **reg_list, int *num_regs)
static int nuttx_create(struct target *target)
static int nuttx_update_threads(struct rtos *rtos)
static int nuttx_smp_init(struct target *target)
#define TCBINFO_TARGET_SIZE
const struct rtos_type nuttx_rtos
static const struct nuttx_params nuttx_params_list[]
static char * task_state_str[]
static target_addr_t target_buffer_get_addr(struct target *target, const uint8_t *buffer)
static int nuttx_getreg_current_thread(struct rtos *rtos, struct rtos_reg **reg_list, int *num_regs)
static int nuttx_get_thread_reg_list(struct rtos *rtos, int64_t thread_id, struct rtos_reg **reg_list, int *num_regs)
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 nuttx_esp32s2_stacking
const struct rtos_register_stacking nuttx_riscv_stacking
const struct rtos_register_stacking nuttx_esp32s3_stacking
const struct rtos_register_stacking nuttx_esp32_stacking
const struct rtos_register_stacking nuttx_stacking_cortex_m
size_t size
Size of the control block search area.
const struct rtos_register_stacking * stacking
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.
uint64_t target_buffer_get_u64(struct target *target, const uint8_t *buffer)
int target_read_buffer(struct target *target, target_addr_t address, uint32_t size, uint8_t *buffer)
int target_read_u8(struct target *target, target_addr_t address, uint8_t *value)
int target_get_gdb_reg_list(struct target *target, struct reg **reg_list[], int *reg_list_size, enum target_register_class reg_class)
Obtain the registers for GDB.
int target_read_u16(struct target *target, target_addr_t address, uint16_t *value)
int target_read_u32(struct target *target, target_addr_t address, uint32_t *value)
uint16_t target_buffer_get_u16(struct target *target, const uint8_t *buffer)
uint32_t target_buffer_get_u32(struct target *target, const uint8_t *buffer)
const char * target_type_name(const struct target *target)
Get the target type name.
#define ARRAY_SIZE(x)
Compute the number of elements of a variable length array.