25 #define EXTRAINFO_SIZE 256
43 #define TCBINFO_TARGET_SIZE 22
69 {
"g_readytorun",
false },
70 {
"g_pidhash",
false },
71 {
"g_npidhash",
false },
72 {
"g_tcbinfo",
false },
99 .target_name =
"hla_target",
104 .target_name =
"esp32",
108 .target_name =
"esp32s2",
112 .target_name =
"esp32s3",
116 .target_name =
"esp32c3",
131 LOG_ERROR(
"Could not read CPACR register to check FPU state");
135 return cpacr & 0x00F00000;
195 uint32_t pidhashaddr, npidhash, tcbaddr;
213 LOG_ERROR(
"Failed to read g_npidhash: ret = %d", ret);
217 LOG_DEBUG(
"Hash table size (g_npidhash) = %" PRId32, npidhash);
221 LOG_ERROR(
"Failed to read g_pidhash address: ret = %d", ret);
225 LOG_DEBUG(
"Hash table address (g_pidhash) = %" PRIx32, pidhashaddr);
227 uint8_t *pidhash = malloc(npidhash *
PTR_WIDTH);
235 LOG_ERROR(
"Failed to read tcbhash: ret = %d", ret);
245 LOG_ERROR(
"Failed to read tcbinfo: ret = %d", ret);
263 LOG_ERROR(
"Failed to read g_readytorun: ret = %d", ret);
268 uint32_t thread_count = 0;
270 for (
unsigned int i = 0; i < npidhash; i++) {
278 LOG_ERROR(
"Failed to read PID of TCB@0x%x from pidhash[%d]: ret = %d",
285 LOG_ERROR(
"Failed to read state of TCB@0x%x from pidhash[%d]: ret = %d",
292 if (!new_thread_details) {
297 struct thread_detail *thread = &new_thread_details[thread_count];
325 LOG_ERROR(
"Failed to read thread's name: ret = %d", ret);
341 struct rtos_reg **reg_list,
int *num_regs)
343 struct reg **gdb_reg_list;
350 LOG_ERROR(
"target_get_gdb_reg_list failed %d", ret);
354 *reg_list = calloc(*num_regs,
sizeof(
struct rtos_reg));
356 LOG_ERROR(
"Failed to alloc memory for %d", *num_regs);
361 for (
int i = 0; i < *num_regs; i++) {
362 (*reg_list)[i].number = gdb_reg_list[i]->
number;
363 (*reg_list)[i].size = gdb_reg_list[i]->
size;
364 memcpy((*reg_list)[i].
value, gdb_reg_list[i]->
value, ((*reg_list)[i].
size + 7) / 8);
373 struct rtos_reg **reg_list,
int *num_regs)
381 if (
priv->select_stackinfo) {
384 LOG_ERROR(
"Can't find a way to get stacking info");
393 LOG_ERROR(
"Failed to read registers' offset: ret = %d", ret);
399 LOG_ERROR(
"Failed to read registers' address: ret = %d", ret);
407 struct rtos_reg **reg_list,
int *num_regs)
static struct armv7m_common * target_to_armv7m(struct target *target)
static bool is_armv7m(const struct armv7m_common *armv7m)
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 cortexm_hasfpu(struct target *target)
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 const struct rtos_register_stacking * cortexm_select_stackinfo(struct target *target)
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_fpu
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.