-
Notifications
You must be signed in to change notification settings - Fork 7.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature] esp_backtrace_print() should support printing all tasks (IDFGH-8215) #9708
Comments
Hi @chipweinberger , We don't have any plan to add this feature currently. However, on
It will return a snapshot of all the tasks currently in the system, as snapshot consists of a TCB and a top of the stack. When pointing to a halted task, the top of the stack contains an Finally, this will let you populate an |
Wow thank you for the detailed response @o-marshmallow. I'll give this a shot, after I switch to v5.0! This is great. |
@o-marshmallow and if a PR were to be submitted? |
It would be very useful to have this as an easy-to-use public API as I also have a task that is blocking on a mutex and I can't find where it is. |
That is exactly my use case as well. I wrote a couple freertos wrappers to detect threads blocked 15+ seconds on a mutex, and print out the stack trace of the owner when it took the mutex, and the deadlocked task backtrace. @o-marshmallow , @igrr Espressif should add a native version of this tool as a KConfig.
|
Guys, does anyone know how to populate a |
Found out. Maybe it'll be helpful for someone.
|
@redgreenloko if you implement this please open a PR! |
I've implemented it. esp_debug_helpers.c
|
PR: #11575 |
@o-marshmallow awesome!! thank you! =) |
This commit adds esp_backtrace_print_all_tasks() which prints the backtraces of all tasks at runtime. Closes espressif#9708 CLoses espressif#11575 [Omar Chebib: Prevent task switching while printing backtraces of tasks.] [Omar Chebib: Ensure all task stacks are flushed from register to RAM.] [Omar Chebib: Removed esp_task_snapshot_to_backtrace_frame() as task snapshot is private API.] [Omar Chebib: Added test case for esp_backtrace_print_all_tasks().] Signed-off-by: Omar Chebib <[email protected]> (cherry picked from commit 3686689) # Conflicts: # components/esp_system/port/arch/xtensa/debug_helpers.c # components/esp_system/test_apps/esp_system_unity_tests/main/test_backtrace.c # components/freertos/esp_additions/freertos_tasks_c_additions.h # components/freertos/esp_additions/include/esp_private/freertos_debug.h
This commit adds esp_backtrace_print_all_tasks() which prints the backtraces of all tasks at runtime. Closes espressif#9708 CLoses espressif#11575 [Omar Chebib: Prevent task switching while printing backtraces of tasks.] [Omar Chebib: Ensure all task stacks are flushed from register to RAM.] [Omar Chebib: Removed esp_task_snapshot_to_backtrace_frame() as task snapshot is private API.] [Omar Chebib: Added test case for esp_backtrace_print_all_tasks().] Signed-off-by: Omar Chebib <[email protected]> (cherry picked from commit 3686689) # Conflicts: # components/esp_system/port/arch/xtensa/debug_helpers.c # components/esp_system/test_apps/esp_system_unity_tests/main/test_backtrace.c # components/freertos/esp_additions/freertos_tasks_c_additions.h # components/freertos/esp_additions/include/esp_private/freertos_debug.h
This commit adds esp_backtrace_print_all_tasks() which prints the backtraces of all tasks at runtime. Closes espressif#9708 CLoses espressif#11575 [Omar Chebib: Prevent task switching while printing backtraces of tasks.] [Omar Chebib: Ensure all task stacks are flushed from register to RAM.] [Omar Chebib: Removed esp_task_snapshot_to_backtrace_frame() as task snapshot is private API.] [Omar Chebib: Added test case for esp_backtrace_print_all_tasks().] Signed-off-by: Omar Chebib <[email protected]> (cherry picked from commit 3686689) # Conflicts: # components/esp_system/port/arch/xtensa/debug_helpers.c # components/esp_system/test_apps/esp_system_unity_tests/main/test_backtrace.c # components/freertos/esp_additions/freertos_tasks_c_additions.h # components/freertos/esp_additions/include/esp_private/freertos_debug.h
This commit adds esp_backtrace_print_all_tasks() which prints the backtraces of all tasks at runtime. Closes espressif#9708 CLoses espressif#11575 [Omar Chebib: Prevent task switching while printing backtraces of tasks.] [Omar Chebib: Ensure all task stacks are flushed from register to RAM.] [Omar Chebib: Removed esp_task_snapshot_to_backtrace_frame() as task snapshot is private API.] [Omar Chebib: Added test case for esp_backtrace_print_all_tasks().] Signed-off-by: Omar Chebib <[email protected]> (cherry picked from commit 3686689) (cherry picked from commit ed19aae)
ESP-IDF v4.4.2
My product has a lot of debug features. I like having debug commands I can call at will.
I just hit a rare task deadlock, but had no ability to print out the backtrace of all tasks.
esp_backtrace_print(
) only supports printing the current task.Is there any way to print the backtrace of all apps while the program is running?
I've considered:
vTaskGetInfo returns
pxStackBase
, but we actually needpxStackTop
, which I don't see a way to get.The text was updated successfully, but these errors were encountered: