This is an automated email from Gerrit. "Tim Newsome <t...@sifive.com>" just uploaded a new patch set to Gerrit, which you can find at https://review.openocd.org/c/openocd/+/6872
-- gerrit commit cca2d848ade1274a428ea0d18d11b7936f9376f1 Author: Tim Newsome <t...@sifive.com> Date: Fri Jan 18 11:34:26 2019 -0800 rtos/hwthread: Only regenerate thread list if necessary. Change-Id: I244b045f84397b058cf526e3bff238cb05d8ad06 Signed-off-by: Tim Newsome <t...@sifive.com> diff --git a/src/rtos/hwthread.c b/src/rtos/hwthread.c index 7c998861f7..393428bbf5 100644 --- a/src/rtos/hwthread.c +++ b/src/rtos/hwthread.c @@ -103,9 +103,6 @@ static int hwthread_update_threads(struct rtos *rtos) target = rtos->target; - /* wipe out previous thread details if any */ - rtos_free_threadlist(rtos); - /* determine the number of "threads" */ if (target->smp) { foreach_smp_target(head, target->smp_targets) { @@ -119,6 +116,23 @@ static int hwthread_update_threads(struct rtos *rtos) } else thread_list_size = 1; + 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; + } + + /* wipe out previous thread details if any */ + rtos_free_threadlist(rtos); + /* create space for new thread details */ rtos->thread_details = malloc(sizeof(struct thread_detail) * thread_list_size); --