From: OpenOCD-Gerrit <ope...@us...> - 2022-08-08 20:48:42
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via df75bbd53620c3a59e9fd3cfd0aaeae26ab795af (commit) from 3865c411eebf01192ee347a1bd5c201c97ed23a6 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit df75bbd53620c3a59e9fd3cfd0aaeae26ab795af Author: Frank Dischner <fra...@gm...> Date: Sun Apr 17 21:24:28 2022 -0500 FreeRTOS: Always show current execution before scheduler is started Previously, if the target was halted before the FreeRTOS scheduler was started but after at least one thread was created, then the current thread would be set to whichever thread had the highest priority. In addition to being misleading, because that thread is not actually running, it can cause issues with gdb. For instance, breaking somewhere before the first thread is created will show the current execution as the current thread, but stepping over a line that creates a thread will cause the current thread to switch to the newly created thread and the current execution to disappear. The sudden disappearance of the current execution thread seems to confuse some versions of gdb. With this change, the value of xSchedulerRunning is checked to determine whether the scheduler has been started. If it hasn't, then a fake 'current execution' thread is always created and made the current thread. Signed-off-by: Frank Dischner <fra...@gm...> Change-Id: Ide0fe7d9ffb9fac95cee4c805735f434c7c4934d Reviewed-on: https://review.openocd.org/c/openocd/+/6935 Tested-by: jenkins Reviewed-by: Asier Llano <asi...@gm...> Reviewed-by: Tomas Vanek <va...@fb...> diff --git a/src/rtos/FreeRTOS.c b/src/rtos/FreeRTOS.c index 5f779ef70..afea9db90 100644 --- a/src/rtos/FreeRTOS.c +++ b/src/rtos/FreeRTOS.c @@ -116,6 +116,7 @@ enum freertos_symbol_values { FREERTOS_VAL_X_SUSPENDED_TASK_LIST = 8, FREERTOS_VAL_UX_CURRENT_NUMBER_OF_TASKS = 9, FREERTOS_VAL_UX_TOP_USED_PRIORITY = 10, + FREERTOS_VAL_X_SCHEDULER_RUNNING = 11, }; struct symbols { @@ -135,6 +136,7 @@ static const struct symbols freertos_symbol_list[] = { { "xSuspendedTaskList", true }, /* Only if INCLUDE_vTaskSuspend */ { "uxCurrentNumberOfTasks", false }, { "uxTopUsedPriority", true }, /* Unavailable since v7.5.3 */ + { "xSchedulerRunning", false }, { NULL, false } }; @@ -194,7 +196,20 @@ static int freertos_update_threads(struct rtos *rtos) rtos->symbols[FREERTOS_VAL_PX_CURRENT_TCB].address, rtos->current_thread); - if ((thread_list_size == 0) || (rtos->current_thread == 0)) { + /* read scheduler running */ + uint32_t scheduler_running; + retval = target_read_u32(rtos->target, + rtos->symbols[FREERTOS_VAL_X_SCHEDULER_RUNNING].address, + &scheduler_running); + if (retval != ERROR_OK) { + LOG_ERROR("Error reading FreeRTOS scheduler state"); + return retval; + } + LOG_DEBUG("FreeRTOS: Read xSchedulerRunning at 0x%" PRIx64 ", value 0x%" PRIx32, + rtos->symbols[FREERTOS_VAL_X_SCHEDULER_RUNNING].address, + scheduler_running); + + if ((thread_list_size == 0) || (rtos->current_thread == 0) || (scheduler_running != 1)) { /* Either : No RTOS threads - there is always at least the current execution though */ /* OR : No current thread - all threads suspended - show the current execution * of idling */ ----------------------------------------------------------------------- Summary of changes: src/rtos/FreeRTOS.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) hooks/post-receive -- Main OpenOCD repository |