X-Git-Url: https://review.openocd.org/gitweb?a=blobdiff_plain;f=src%2Frtos%2Frtos.c;h=1cb6958c0102dbac8ec2e0d61843f857432f8801;hb=27b073a9411bdcb3a2f525ff070747afbff384cb;hp=cdd37608ed446156ca409fd61405b8427b170ab3;hpb=164c543799a6bda0c4a6011f43d825930b36c7fe;p=openocd.git diff --git a/src/rtos/rtos.c b/src/rtos/rtos.c index cdd37608ed..1cb6958c01 100644 --- a/src/rtos/rtos.c +++ b/src/rtos/rtos.c @@ -46,7 +46,7 @@ static struct rtos_type *rtos_types[] = { NULL }; -int rtos_thread_packet(struct connection *connection, char *packet, int packet_size); +int rtos_thread_packet(struct connection *connection, const char *packet, int packet_size); int rtos_smp_init(struct target *target) { @@ -138,7 +138,7 @@ int rtos_create(Jim_GetOptInfo *goi, struct target *target) return JIM_ERR; } -int gdb_thread_packet(struct connection *connection, char *packet, int packet_size) +int gdb_thread_packet(struct connection *connection, char const *packet, int packet_size) { struct target *target = get_target_from_connection(connection); if (target->rtos == NULL) @@ -186,7 +186,7 @@ static char *next_symbol(struct rtos *os, char *cur_symbol, uint64_t cur_addr) * * rtos_qsymbol() returns 1 if an RTOS has been detected, or 0 otherwise. */ -int rtos_qsymbol(struct connection *connection, char *packet, int packet_size) +int rtos_qsymbol(struct connection *connection, char const *packet, int packet_size) { int rtos_detected = 0; uint64_t addr = 0; @@ -254,7 +254,7 @@ done: return rtos_detected; } -int rtos_thread_packet(struct connection *connection, char *packet, int packet_size) +int rtos_thread_packet(struct connection *connection, char const *packet, int packet_size) { struct target *target = get_target_from_connection(connection); @@ -344,7 +344,7 @@ int rtos_thread_packet(struct connection *connection, char *packet, int packet_s free(out_str); } } else - gdb_put_packet(connection, "", 0); + gdb_put_packet(connection, "l", 1); return ERROR_OK; } else if (strncmp(packet, "qsThreadInfo", 12) == 0) { @@ -513,3 +513,20 @@ int rtos_update_threads(struct target *target) target->rtos->type->update_threads(target->rtos); return ERROR_OK; } + +void rtos_free_threadlist(struct rtos *rtos) +{ + if (rtos->thread_details) { + int j; + + for (j = 0; j < rtos->thread_count; j++) { + struct thread_detail *current_thread = &rtos->thread_details[j]; + free(current_thread->display_str); + free(current_thread->thread_name_str); + free(current_thread->extra_info_str); + } + free(rtos->thread_details); + rtos->thread_details = NULL; + rtos->thread_count = 0; + } +}