Skip to content

Commit df1e1c2

Browse files
Merge branch 'task/make_task_snapshot_public' into 'master'
refactor(freertos): Make task snapshot debug API public Closes IDF-10038 and IDF-8143 See merge request espressif/esp-idf!41871
2 parents 37855ef + bb0f072 commit df1e1c2

File tree

16 files changed

+65
-44
lines changed

16 files changed

+65
-44
lines changed

components/esp_gdbstub/private_include/esp_gdbstub_common.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#ifdef CONFIG_ESP_GDBSTUB_SUPPORT_TASKS
1717
#include "freertos/FreeRTOS.h"
1818
#include "freertos/task.h"
19-
#include "esp_private/freertos_debug.h"
19+
#include "freertos/freertos_debug.h"
2020
#endif // CONFIG_ESP_GDBSTUB_SUPPORT_TASKS
2121

2222
/* Internal error codes used by the routines that parse the incoming gdb packet */

components/esp_gdbstub/src/port/riscv/gdbstub_riscv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#include "rv_decode.h"
1414
#include "sdkconfig.h"
1515
#include "esp_private/crosscore_int.h"
16-
#include "esp_private/freertos_debug.h"
16+
#include "freertos/freertos_debug.h"
1717
#include "freertos/portmacro.h"
1818
#include "freertos/FreeRTOS.h"
1919
#include "freertos/FreeRTOSConfig.h"

components/esp_system/port/arch/riscv/debug_helpers.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include "sdkconfig.h"
1010
#include "freertos/FreeRTOS.h"
1111
#include "freertos/task.h"
12-
#include "esp_private/freertos_debug.h"
12+
#include "freertos/freertos_debug.h"
1313
#include "esp_err.h"
1414
#include "esp_private/esp_system_attr.h"
1515
#include "esp_private/esp_cpu_internal.h"

components/esp_system/port/arch/xtensa/debug_helpers.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#include "esp_debug_helpers.h"
1717
#include "esp_cpu_utils.h"
1818
#include "esp_private/panic_internal.h"
19-
#include "esp_private/freertos_debug.h"
19+
#include "freertos/freertos_debug.h"
2020
#include "esp_rom_sys.h"
2121
#include "xtensa_context.h"
2222
#include "freertos/FreeRTOS.h"

components/esp_system/task_wdt/task_wdt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#include "sdkconfig.h"
1313
#include "freertos/FreeRTOS.h"
1414
#include "freertos/task.h"
15-
#include "esp_private/freertos_debug.h"
15+
#include "freertos/freertos_debug.h"
1616
#include "esp_err.h"
1717
#include "esp_attr.h"
1818
#include "esp_check.h"

components/espcoredump/include_core_dump/esp_core_dump_common.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#define ESP_CORE_DUMP_COMMON_H_
88

99
#include "freertos/FreeRTOS.h"
10-
#include "esp_private/freertos_debug.h"
10+
#include "freertos/freertos_debug.h"
1111
#include "esp_app_format.h"
1212
#include "esp_core_dump_types.h"
1313

components/espcoredump/src/core_dump_common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include <stdbool.h>
1010
#include "soc/soc_memory_layout.h"
1111
#include "freertos/FreeRTOS.h"
12-
#include "esp_private/freertos_debug.h"
12+
#include "freertos/freertos_debug.h"
1313
#include "esp_rom_sys.h"
1414
#include "esp_core_dump_port.h"
1515
#include "esp_core_dump_common.h"

components/freertos/Kconfig

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -639,21 +639,6 @@ menu "FreeRTOS"
639639
help
640640
Hidden option, gets selected by CONFIG_ESP_DEBUG_OCDAWARE
641641

642-
config FREERTOS_ENABLE_TASK_SNAPSHOT
643-
# Invisible option that is always enabled. Task Snapshot APIs are now private thus are always enabled. This
644-
# option is kept here in case any user code conditionally depends on this option.
645-
# Todo: Remove in v6.0 (IDF-8143)
646-
bool
647-
default y
648-
649-
config FREERTOS_PLACE_SNAPSHOT_FUNS_INTO_FLASH
650-
# Invisible option that is always enabled. Task Snapshot APIs are now private API thus are always placed into
651-
# flash by default. This option is kept here in case any user code conditionally depends on this option.
652-
# Todo: Remove in v6.0 (IDF-8143)
653-
bool
654-
default y
655-
depends on !ESP_PANIC_HANDLER_IRAM
656-
657642
config FREERTOS_NUMBER_OF_CORES
658643
# Invisible option to configure the number of cores on which FreeRTOS runs
659644
# Todo: Unhide this option and deprecate CONFIG_FREERTOS_UNICORE (IDF-9156)

components/freertos/esp_additions/freertos_tasks_c_additions.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@
99
#include "esp_heap_caps.h"
1010
#include "esp_compiler.h"
1111
#include "freertos/idf_additions.h"
12-
#if CONFIG_FREERTOS_ENABLE_TASK_SNAPSHOT
13-
#include "esp_private/freertos_debug.h"
14-
#endif /* CONFIG_FREERTOS_ENABLE_TASK_SNAPSHOT */
12+
#include "freertos/freertos_debug.h"
1513
#include "esp_private/freertos_idf_additions_priv.h"
1614

1715
/**

components/freertos/esp_additions/include/esp_private/freertos_debug.h renamed to components/freertos/esp_additions/include/freertos/freertos_debug.h

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -11,7 +11,9 @@
1111
#include "freertos/task.h"
1212

1313
/*
14-
* This header contains private API used by various ESP-IDF debugging features (e.g., esp_gdbstub).
14+
* This header contains public API for FreeRTOS debugging features including task snapshots.
15+
* These APIs are used by ESP-IDF debugging features (e.g., esp_gdbstub, core dump) and
16+
* external frameworks (e.g., ESP Insights) for debugging and monitoring purposes.
1517
*/
1618

1719
/* *INDENT-OFF* */
@@ -71,7 +73,9 @@ int xTaskGetNext( TaskIterator_t * xIterator );
7173
* - This function is used by the panic handler to get the snapshot of a particular task.
7274
*
7375
* @note This function should only be called when FreeRTOS is no longer running (e.g., during a panic) as this function
74-
* does not acquire any locks.
76+
* does not acquire any locks. For safe usage with scheduler running, use vTaskSuspendAll() before calling
77+
* this function and xTaskResumeAll() after.
78+
*
7579
* @param[in] pxTask Task's handle
7680
* @param[out] pxTaskSnapshot Snapshot of the task
7781
* @return pdTRUE if operation was successful else pdFALSE
@@ -85,11 +89,13 @@ BaseType_t vTaskGetSnapshot( TaskHandle_t pxTask,
8589
* - This function is used by the panic handler to get a snapshot of all tasks in the system
8690
*
8791
* @note This function should only be called when FreeRTOS is no longer running (e.g., during a panic) as this function
88-
* does not acquire any locks.
92+
* does not acquire any locks. For safe usage with scheduler running, use vTaskSuspendAll() before calling
93+
* this function and xTaskResumeAll() after.
94+
*
8995
* @param[out] pxTaskSnapshotArray Array of TaskSnapshot_t structures filled by this function
9096
* @param[in] uxArrayLength Length of the provided array
9197
* @param[out] pxTCBSize Size of the a task's TCB structure (can be set to NULL)
92-
* @return UBaseType_t
98+
* @return UBaseType_t Number of task snapshots filled in the array
9399
*/
94100
UBaseType_t uxTaskGetSnapshotAll( TaskSnapshot_t * const pxTaskSnapshotArray,
95101
const UBaseType_t uxArrayLength,

0 commit comments

Comments
 (0)