23 struct rtos_reg **reg_list,
int *num_regs);
32 #define HW_THREAD_NAME_STR_SIZE (32)
46 assert(0 &&
"Target is not found in it's own SMP group!");
87 int threads_found = 0;
88 int thread_list_size = 0;
114 thread_list_size = 1;
119 if (current_threadid <= thread_list_size)
122 LOG_WARNING(
"SMP node change, disconnect GDB from core/thread %" PRId64,
140 switch (current_reason) {
226 if (thread_id == tid)
234 struct rtos_reg **rtos_reg_list,
int *rtos_reg_list_size)
249 struct reg **reg_list;
256 for (
int i = 0; i < reg_list_size; i++) {
257 if (!reg_list[i] || !reg_list[i]->
exist || reg_list[i]->
hidden)
261 *rtos_reg_list_size = j;
262 *rtos_reg_list = calloc(*rtos_reg_list_size,
sizeof(
struct rtos_reg));
263 if (!*rtos_reg_list) {
269 for (
int i = 0; i < reg_list_size; i++) {
270 if (!reg_list[i] || !reg_list[i]->
exist || reg_list[i]->
hidden)
272 if (!reg_list[i]->
valid) {
273 retval = reg_list[i]->
type->
get(reg_list[i]);
277 free(*rtos_reg_list);
281 (*rtos_reg_list)[j].number = reg_list[i]->
number;
282 (*rtos_reg_list)[j].size = reg_list[i]->
size;
283 memcpy((*rtos_reg_list)[j].
value, reg_list[i]->
value,
302 LOG_ERROR(
"Couldn't find RTOS thread for id %" PRId64
".", thread_id);
313 LOG_ERROR(
"Couldn't find register %" PRIu32
" in thread %" PRId64
".", reg_num,
323 unsigned int bytes = (
reg->
size + 7) / 8;
352 (*symbol_list)[0].symbol_name =
NULL;
380 int64_t current_threadid;
382 if (packet[0] ==
'H' && packet[1] ==
'g') {
383 sscanf(packet,
"Hg%16" SCNx64, ¤t_threadid);
385 if (current_threadid > 0) {
387 LOG_ERROR(
"hwthread: cannot find thread id %"PRId64, current_threadid);
392 }
else if (current_threadid == 0 || current_threadid == -1) {
407 LOG_INFO(
"Hardware thread awareness created");
int gdb_put_packet(struct connection *connection, const 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)
#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)
static struct target * hwthread_find_thread(struct target *target, threadid_t thread_id)
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 threadid_t threadid_from_target(const struct target *target)
static int hwthread_target_for_threadid(struct connection *connection, int64_t thread_id, struct target **p_target)
static int hwthread_fill_thread(struct rtos *rtos, struct target *curr, int thread_num, threadid_t tid)
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_TARGET_ERROR(target, fmt_str,...)
#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)
int rtos_thread_packet(struct connection *connection, char const *packet, int packet_size)
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(const struct target *t)
static bool target_was_examined(const struct target *target)
static const char * target_name(const struct target *target)
Returns the instance-specific name of the specified target.
#define DIV_ROUND_UP(m, n)
Rounds m up to the nearest multiple of n using division.