diff options
-rw-r--r-- | src/rtos/hwthread.c | 30 | ||||
-rw-r--r-- | src/rtos/rtos.c | 1 | ||||
-rw-r--r-- | src/rtos/rtos.h | 3 | ||||
-rw-r--r-- | src/server/gdb_server.c | 5 | ||||
-rw-r--r-- | src/target/riscv/riscv.c | 17 |
5 files changed, 6 insertions, 50 deletions
diff --git a/src/rtos/hwthread.c b/src/rtos/hwthread.c index caa3f72..cb8fb20 100644 --- a/src/rtos/hwthread.c +++ b/src/rtos/hwthread.c @@ -37,7 +37,7 @@ static int hwthread_get_thread_reg_list(struct rtos *rtos, int64_t thread_id, struct rtos_reg **reg_list, int *num_regs); static int hwthread_get_symbol_list_to_lookup(symbol_table_elem_t *symbol_list[]); static int hwthread_smp_init(struct target *target); -int hwthread_set_reg(struct rtos *rtos, int reg_num, uint8_t *reg_value); +int hwthread_set_reg(struct rtos *rtos, uint32_t reg_num, uint8_t *reg_value); #define HW_THREAD_NAME_STR_SIZE (32) @@ -91,9 +91,6 @@ static int hwthread_update_threads(struct rtos *rtos) int64_t current_thread = 0; enum target_debug_reason current_reason = DBG_REASON_UNDEFINED; - LOG_DEBUG("current_thread=%i", (int)rtos->current_thread); - LOG_DEBUG("current_threadid=%i", (int)rtos->current_threadid); - if (rtos == NULL) return ERROR_FAIL; @@ -112,22 +109,6 @@ static int hwthread_update_threads(struct rtos *rtos) } else thread_list_size = 1; -#if 0 - if (thread_list_size == rtos->thread_count) { - /* Nothing changed. Exit early. - * This is important because if we do recreate the data, we potentially - * change what the current thread is, which can lead to trouble because - * this function is sometimes called when single stepping - * (gdb_handle_vcont_packet), and the current thread should not be - * changed as part of that. */ - /* TODO: Do we need to confirm that all the "threads" are really the - * same? Is it even possible to change the number of configured - * targets and SMP groups after this function is called the first time? - */ - return ERROR_OK; - } -#endif - /* Wipe out previous thread details if any, but preserve threadid. */ int64_t current_threadid = rtos->current_threadid; rtos_free_threadlist(rtos); @@ -201,8 +182,6 @@ static int hwthread_update_threads(struct rtos *rtos) } threads_found++; - LOG_DEBUG(">>> tid=%ld, debug_reason=%d, current_thread=%ld, current_reason=%d", - tid, curr->debug_reason, current_thread, current_reason); } } else { hwthread_fill_thread(rtos, target, threads_found); @@ -220,8 +199,6 @@ static int hwthread_update_threads(struct rtos *rtos) else rtos->current_thread = threadid_from_target(target); - LOG_DEBUG("current_thread=%i", (int)rtos->current_thread); - LOG_DEBUG("current_threadid=%i", (int)rtos->current_threadid); return 0; } @@ -287,7 +264,6 @@ static int hwthread_get_thread_reg_list(struct rtos *rtos, int64_t thread_id, static int hwthread_get_thread_reg(struct rtos *rtos, int64_t thread_id, uint32_t reg_num, struct rtos_reg *rtos_reg) { - LOG_DEBUG(">>> thread %ld, reg %d", thread_id, reg_num); if (rtos == NULL) return ERROR_FAIL; @@ -316,7 +292,7 @@ static int hwthread_get_thread_reg(struct rtos *rtos, int64_t thread_id, return ERROR_OK; } -int hwthread_set_reg(struct rtos *rtos, int reg_num, uint8_t *reg_value) +int hwthread_set_reg(struct rtos *rtos, uint32_t reg_num, uint8_t *reg_value) { if (rtos == NULL) return ERROR_FAIL; @@ -368,8 +344,6 @@ static int hwthread_thread_packet(struct connection *connection, const char *pac struct target *curr = NULL; int64_t current_threadid; - LOG_DEBUG(">>> %s", packet); - if (packet[0] == 'H' && packet[1] == 'g') { /* Never reached, because this case is handled by rtos_thread_packet(). */ sscanf(packet, "Hg%16" SCNx64, ¤t_threadid); diff --git a/src/rtos/rtos.c b/src/rtos/rtos.c index a5b7fdb..8b9eb4c 100644 --- a/src/rtos/rtos.c +++ b/src/rtos/rtos.c @@ -552,7 +552,6 @@ int rtos_set_reg(struct connection *connection, int reg_num, { struct target *target = get_target_from_connection(connection); int64_t current_threadid = target->rtos->current_threadid; - LOG_DEBUG(">>> thread %ld, reg %d", current_threadid, reg_num); if ((target->rtos != NULL) && (target->rtos->type->set_reg != NULL) && (current_threadid != -1) && diff --git a/src/rtos/rtos.h b/src/rtos/rtos.h index 001837f..81829b1 100644 --- a/src/rtos/rtos.h +++ b/src/rtos/rtos.h @@ -82,8 +82,7 @@ struct rtos_type { int (*get_symbol_list_to_lookup)(symbol_table_elem_t *symbol_list[]); int (*clean)(struct target *target); char * (*ps_command)(struct target *target); - // TODO: int or uint32_t for reg_num? - int (*set_reg)(struct rtos *rtos, int reg_num, uint8_t *reg_value); + int (*set_reg)(struct rtos *rtos, uint32_t reg_num, uint8_t *reg_value); }; struct stack_register_offset { diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c index 2772e7a..503a435 100644 --- a/src/server/gdb_server.c +++ b/src/server/gdb_server.c @@ -144,7 +144,6 @@ static char gdb_running_type; static int gdb_last_signal(struct target *target) { - LOG_DEBUG(">>> [%d] debug_reason=%d", target->coreid, target->debug_reason); switch (target->debug_reason) { case DBG_REASON_DBGRQ: return 0x2; /* SIGINT */ @@ -747,8 +746,6 @@ static void gdb_signal_reply(struct target *target, struct connection *connectio signal_var = 0x2; } else signal_var = gdb_last_signal(ct); - LOG_DEBUG(">>> ctrl_c=%d, signal_var=%d", gdb_connection->ctrl_c, - signal_var); stop_reason[0] = '\0'; if (ct->debug_reason == DBG_REASON_WATCHPOINT) { @@ -780,7 +777,6 @@ static void gdb_signal_reply(struct target *target, struct connection *connectio if (target->rtos != NULL) snprintf(current_thread, sizeof(current_thread), "thread:%" PRIx64 ";", target->rtos->current_thread); - LOG_DEBUG(">>> signal_var=%d", signal_var); sig_reply_len = snprintf(sig_reply, sizeof(sig_reply), "T%2.2x%s%s", signal_var, stop_reason, current_thread); @@ -3185,7 +3181,6 @@ static int gdb_input_inner(struct connection *connection) } if (packet_size > 0) { - LOG_DEBUG(">>> current_threadid=%ld", target->rtos ? target->rtos->current_threadid : 1234); retval = ERROR_OK; switch (packet[0]) { case 'T': /* Is thread alive? */ diff --git a/src/target/riscv/riscv.c b/src/target/riscv/riscv.c index f4a37ad..6ba6127 100644 --- a/src/target/riscv/riscv.c +++ b/src/target/riscv/riscv.c @@ -267,7 +267,6 @@ static int riscv_init_target(struct command_context *cmd_ctx, riscv_semihosting_init(target); target->debug_reason = DBG_REASON_DBGRQ; - LOG_DEBUG(">>> [%d] debug_reason=%d", target->coreid, target->debug_reason); return ERROR_OK; } @@ -991,13 +990,9 @@ static int riscv_get_gdb_reg_list(struct target *target, target->reg_cache->reg_list[i].size > 0); (*reg_list)[i] = &target->reg_cache->reg_list[i]; if (read && !target->reg_cache->reg_list[i].valid) { - // TODO: Confirm that this function is supposed to actually read - // registers. I'm just adding this because maybe - // hwthread_get_thread_reg_list() expects it. - - // This function gets called from - // gdb_target_description_supported(), and we end up failing in - // that case. Allow failures for now. + /* This function gets called from + * gdb_target_description_supported(), and we end up failing in + * that case. Allow failures for now. */ if (target->reg_cache->reg_list[i].type->get( &target->reg_cache->reg_list[i]) != ERROR_OK) read = false; @@ -1204,7 +1199,6 @@ int set_debug_reason(struct target *target, int hartid) case RISCV_HALT_ERROR: return ERROR_FAIL; } - LOG_DEBUG(">>> [%d] debug_reason=%d", target->coreid, target->debug_reason); return ERROR_OK; } @@ -1368,7 +1362,6 @@ int riscv_openocd_halt(struct target *target) target->state = TARGET_HALTED; target->debug_reason = DBG_REASON_DBGRQ; - LOG_DEBUG(">>> [%d] debug_reason=%d", target->coreid, target->debug_reason); target_call_event_callbacks(target, TARGET_EVENT_HALTED); return result; } @@ -1457,7 +1450,6 @@ int riscv_openocd_step( target_call_event_callbacks(target, TARGET_EVENT_RESUMED); target->state = TARGET_HALTED; target->debug_reason = DBG_REASON_SINGLESTEP; - LOG_DEBUG(">>> [%d] debug_reason=%d", target->coreid, target->debug_reason); target_call_event_callbacks(target, TARGET_EVENT_HALTED); return out; } @@ -2171,7 +2163,6 @@ int riscv_set_current_hartid(struct target *target, int hartid) /* This might get called during init, in which case we shouldn't be * setting up the register cache. */ - //if (target_was_examined(target) && hartid != previous_hartid) if (target_was_examined(target) && riscv_rtos_enabled(target)) riscv_invalidate_register_cache(target); @@ -2182,8 +2173,6 @@ void riscv_invalidate_register_cache(struct target *target) { RISCV_INFO(r); - LOG_DEBUG(">>>"); - register_cache_invalidate(target->reg_cache); for (size_t i = 0; i < target->reg_cache->num_regs; ++i) { struct reg *reg = &target->reg_cache->reg_list[i]; |