24 struct rtos_reg **reg_list,
int *num_regs);
33 #define HW_THREAD_NAME_STR_SIZE (32)
80 int threads_found = 0;
81 int thread_list_size = 0;
107 thread_list_size = 1;
112 if (current_threadid <= thread_list_size)
115 LOG_WARNING(
"SMP node change, disconnect GDB from core/thread %" PRId64,
134 switch (current_reason) {
230 struct rtos_reg **rtos_reg_list,
int *rtos_reg_list_size)
245 struct reg **reg_list;
252 for (
int i = 0; i < reg_list_size; i++) {
253 if (!reg_list[i] || reg_list[i]->
exist ==
false || reg_list[i]->
hidden)
257 *rtos_reg_list_size = j;
258 *rtos_reg_list = calloc(*rtos_reg_list_size,
sizeof(
struct rtos_reg));
259 if (!*rtos_reg_list) {
265 for (
int i = 0; i < reg_list_size; i++) {
266 if (!reg_list[i] || reg_list[i]->
exist ==
false || reg_list[i]->
hidden)
268 if (!reg_list[i]->
valid) {
269 retval = reg_list[i]->
type->
get(reg_list[i]);
273 free(*rtos_reg_list);
277 (*rtos_reg_list)[j].number = reg_list[i]->
number;
278 (*rtos_reg_list)[j].size = reg_list[i]->
size;
279 memcpy((*rtos_reg_list)[j].
value, reg_list[i]->
value,
298 LOG_ERROR(
"Couldn't find RTOS thread for id %" PRId64
".", thread_id);
309 LOG_ERROR(
"Couldn't find register %" PRIu32
" in thread %" PRId64
".", reg_num,
319 unsigned bytes = (
reg->
size + 7) / 8;
348 (*symbol_list)[0].symbol_name =
NULL;
376 int64_t current_threadid;
378 if (packet[0] ==
'H' && packet[1] ==
'g') {
379 sscanf(packet,
"Hg%16" SCNx64, ¤t_threadid);
381 if (current_threadid > 0) {
383 LOG_ERROR(
"hwthread: cannot find thread id %"PRId64, current_threadid);
389 if (current_threadid == 0 || current_threadid == -1)
403 LOG_INFO(
"Hardware thread awareness created");
int gdb_put_packet(struct connection *connection, char *buffer, int len)
static struct target * get_target_from_connection(struct connection *connection)
static int hwthread_create(struct target *target)
static int hwthread_thread_packet(struct connection *connection, const char *packet, int packet_size)
static bool hwthread_detect_rtos(struct target *target)
static int hwthread_read_buffer(struct rtos *rtos, target_addr_t address, uint32_t size, uint8_t *buffer)
int rtos_thread_packet(struct connection *connection, const char *packet, int packet_size)
#define HW_THREAD_NAME_STR_SIZE
static int hwthread_update_threads(struct rtos *rtos)
static int hwthread_set_reg(struct rtos *rtos, uint32_t reg_num, uint8_t *reg_value)
static int hwthread_get_symbol_list_to_lookup(struct symbol_table_elem *symbol_list[])
static int hwthread_write_buffer(struct rtos *rtos, target_addr_t address, uint32_t size, const uint8_t *buffer)
const struct rtos_type hwthread_rtos
static int hwthread_get_thread_reg(struct rtos *rtos, int64_t thread_id, uint32_t reg_num, struct rtos_reg *rtos_reg)
static int hwthread_get_thread_reg_list(struct rtos *rtos, int64_t thread_id, struct rtos_reg **reg_list, int *num_regs)
static struct target * hwthread_find_thread(struct target *target, int64_t thread_id)
static threadid_t threadid_from_target(const struct target *target)
static int hwthread_fill_thread(struct rtos *rtos, struct target *curr, int thread_num)
static int hwthread_target_for_threadid(struct connection *connection, int64_t thread_id, struct target **p_target)
static int hwthread_smp_init(struct target *target)
The JTAG interface can be implemented with a software or hardware fifo.
#define LOG_WARNING(expr ...)
#define LOG_ERROR(expr ...)
#define LOG_INFO(expr ...)
#define LOG_DEBUG(expr ...)
struct reg * register_get_by_number(struct reg_cache *first, uint32_t reg_num, bool search_all)
void rtos_free_threadlist(struct rtos *rtos)
size_t size
Size of the control block search area.
#define foreach_smp_target(pos, head)
int(* get)(struct reg *reg)
int(* set)(struct reg *reg, uint8_t *buf)
const struct reg_arch_type * type
int(* gdb_thread_packet)(struct connection *connection, char const *packet, int packet_size)
struct thread_detail * thread_details
void * rtos_specific_params
int(* gdb_target_for_threadid)(struct connection *connection, int64_t thread_id, struct target **p_target)
threadid_t current_thread
Table should be terminated by an element with NULL in symbol_name.
enum target_debug_reason debug_reason
struct reg_cache * reg_cache
struct list_head * smp_targets
int target_write_buffer(struct target *target, target_addr_t address, uint32_t size, const uint8_t *buffer)
int target_read_buffer(struct target *target, target_addr_t address, uint32_t size, uint8_t *buffer)
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.
const char * debug_reason_name(struct target *t)
static const char * target_name(struct target *target)
Returns the instance-specific name of the specified target.
static bool target_was_examined(struct target *target)
#define DIV_ROUND_UP(m, n)
Rounds m up to the nearest multiple of n using division.