aboutsummaryrefslogtreecommitdiff
path: root/src/rtos/hwthread.c
diff options
context:
space:
mode:
authorMarc Schink <dev@zapb.de>2024-12-07 10:53:56 +0100
committerTomas Vanek <vanekt@fbl.cz>2025-02-11 11:53:59 +0000
commit7f2db80ebc168d74a56dc8b76be5355ee4878be6 (patch)
treecf5fdd8fc9e0e965dac193c26dda63e051407393 /src/rtos/hwthread.c
parenteb6f2745b7d9924d0dddeab91c1743867c4e812c (diff)
downloadriscv-openocd-7f2db80ebc168d74a56dc8b76be5355ee4878be6.zip
riscv-openocd-7f2db80ebc168d74a56dc8b76be5355ee4878be6.tar.gz
riscv-openocd-7f2db80ebc168d74a56dc8b76be5355ee4878be6.tar.bz2
rtos/hwthread: Use LOG_TARGET_xxx()
Use LOG_TARGET_xxx() to indicate which target the message belongs to. While at it, fix some coding style issues. Change-Id: Iac0296498557a689468a4a19d0bc64f03178a0d0 Signed-off-by: Marc Schink <dev@zapb.de> Reviewed-on: https://review.openocd.org/c/openocd/+/8727 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Tested-by: jenkins
Diffstat (limited to 'src/rtos/hwthread.c')
-rw-r--r--src/rtos/hwthread.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/src/rtos/hwthread.c b/src/rtos/hwthread.c
index c9f1a17..6332bd8 100644
--- a/src/rtos/hwthread.c
+++ b/src/rtos/hwthread.c
@@ -119,7 +119,7 @@ static int hwthread_update_threads(struct rtos *rtos)
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 */
@@ -204,7 +204,8 @@ static int hwthread_update_threads(struct rtos *rtos)
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;
}
@@ -270,7 +271,8 @@ static int hwthread_get_thread_reg_list(struct rtos *rtos, int64_t thread_id,
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;
@@ -297,7 +299,8 @@ static int hwthread_get_thread_reg(struct rtos *rtos, int64_t thread_id,
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;
}
@@ -308,8 +311,8 @@ static int hwthread_get_thread_reg(struct rtos *rtos, int64_t thread_id,
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;
}
@@ -372,17 +375,17 @@ static bool hwthread_detect_rtos(struct target *target)
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, &current_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;
}
@@ -402,7 +405,7 @@ static int hwthread_thread_packet(struct connection *connection, const char *pac
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;