if (current_threadid <= thread_list_size)
rtos->current_threadid = current_threadid;
else
- LOG_WARNING("SMP node change, disconnect GDB from core/thread %" PRId64,
+ LOG_TARGET_WARNING(target, "SMP node change, disconnect GDB from core/thread %" PRId64,
current_threadid);
/* create space for new thread details */
else
rtos->current_thread = threadid_from_target(target);
- LOG_DEBUG("%s current_thread=%i", __func__, (int)rtos->current_thread);
+ LOG_TARGET_DEBUG(target, "%s current_thread=%i", __func__,
+ (int)rtos->current_thread);
return 0;
}
if (!reg_list[i]->valid) {
retval = reg_list[i]->type->get(reg_list[i]);
if (retval != ERROR_OK) {
- LOG_ERROR("Couldn't get register %s.", reg_list[i]->name);
+ LOG_TARGET_ERROR(curr, "Couldn't get register %s",
+ reg_list[i]->name);
free(reg_list);
free(*rtos_reg_list);
return retval;
struct target *curr = hwthread_find_thread(target, thread_id);
if (!curr) {
- LOG_ERROR("Couldn't find RTOS thread for id %" PRId64 ".", thread_id);
+ LOG_TARGET_ERROR(target, "Couldn't find RTOS thread for id %" PRId64,
+ thread_id);
return ERROR_FAIL;
}
struct reg *reg = register_get_by_number(curr->reg_cache, reg_num, true);
if (!reg) {
- LOG_ERROR("Couldn't find register %" PRIu32 " in thread %" PRId64 ".", reg_num,
- thread_id);
+ LOG_TARGET_ERROR(curr, "Couldn't find register %" PRIu32 " in thread %" PRId64,
+ reg_num, thread_id);
return ERROR_FAIL;
}
static int hwthread_thread_packet(struct connection *connection, const char *packet, int packet_size)
{
- struct target *target = get_target_from_connection(connection);
-
- struct target *curr = NULL;
- int64_t current_threadid;
-
if (packet[0] == 'H' && packet[1] == 'g') {
+ int64_t current_threadid;
sscanf(packet, "Hg%16" SCNx64, ¤t_threadid);
+ struct target *target = get_target_from_connection(connection);
+
if (current_threadid > 0) {
+ struct target *curr = NULL;
if (hwthread_target_for_threadid(connection, current_threadid, &curr) != ERROR_OK) {
- LOG_ERROR("hwthread: cannot find thread id %"PRId64, current_threadid);
+ LOG_TARGET_ERROR(target, "hwthread: cannot find thread id %" PRId64,
+ current_threadid);
gdb_put_packet(connection, "E01", 3);
return ERROR_FAIL;
}
static int hwthread_create(struct target *target)
{
- LOG_INFO("Hardware thread awareness created");
+ LOG_TARGET_INFO(target, "Hardware thread awareness created");
target->rtos->rtos_specific_params = NULL;
target->rtos->current_thread = 0;