mirror of
https://github.com/espressif/esp-idf.git
synced 2026-04-27 19:13:21 +00:00
fix(gdbstub): fix task lookup by frame
This commit is contained in:
@@ -392,12 +392,23 @@ const StaticTask_t *esp_gdbstub_find_tcb_by_frame(const esp_gdbstub_frame_t *fra
|
||||
|
||||
while (xTaskGetNext(&xTaskIter) != -1) {
|
||||
StaticTask_t *tcb = (StaticTask_t *)xTaskIter.pxTaskHandle;
|
||||
if (tcb->pxDummy1 /* pxTopOfStack */ == frame) {
|
||||
/*
|
||||
* For the currently running task, pxTopOfStack is not up-to-date — it is only
|
||||
* updated on the next context switch. Therefore we cannot rely on it to match
|
||||
* the frame to a task. Instead, check if the frame lies within the task's stack.
|
||||
*/
|
||||
if ((uintptr_t)frame >= (uintptr_t)tcb->pxDummy6 /* pxStack */ &&
|
||||
(uintptr_t)frame <= (uintptr_t)tcb->pxDummy8 /* pxEndOfStack */) {
|
||||
return tcb;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL; /* Task not found. */
|
||||
/*
|
||||
* If no task stack contains the frame, it is likely allocated on the interrupt/exception
|
||||
* stack (e.g. during a panic event). In that case, return the current task handle,
|
||||
* which is the task that was running on this core when the exception occurred.
|
||||
*/
|
||||
return (const StaticTask_t *)xTaskGetCurrentTaskHandle();
|
||||
}
|
||||
|
||||
/** Send string as a het to uart */
|
||||
|
||||
@@ -93,7 +93,7 @@ static void test_fpu(void * arg)
|
||||
#if CONFIG_IDF_TARGET_ARCH_XTENSA
|
||||
__asm__ volatile ("ssi f0, %0, 0" :: "a" (&fpu_regs));
|
||||
#endif
|
||||
#if 0 // TODO IDF-15053: set CONFIG_IDF_TARGET_ARCH_RISCV
|
||||
#if CONFIG_IDF_TARGET_ARCH_RISCV
|
||||
__asm__ volatile ("fsw ft0, %0" : "=m" (fpu_regs.ft0));
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user