Last active
November 1, 2021 15:44
-
-
Save vaussard/581d62032670f118947edb2b503a18c4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define zephyr_show_thread | |
printf "State=%d; ", ((struct k_thread *)$arg0)->base.thread_state | |
printf "Prio=%d; ", ((struct k_thread *)$arg0)->base.prio | |
printf "Entry=%p; ", ((struct k_thread *)$arg0)->entry.pEntry | |
printf "PC=%p; ", *(((struct k_thread *)$arg0)->callee_saved.psp + 20) | |
printf "LR=%p; ", *(((struct k_thread *)$arg0)->callee_saved.psp + 24) | |
printf "PSP=%p; ", ((struct k_thread *)$arg0)->callee_saved.psp + 32 | |
set $stack_start = ((struct k_thread *)$arg0)->stack_info.start | |
set $stack_size = ((struct k_thread *)$arg0)->stack_info.size | |
printf "Stack: %p <- %p (%u bytes)", $stack_start, $stack_start + $stack_size, $stack_size | |
end | |
define zephyr_list_threads | |
set $current_thread = _kernel.threads | |
set $idx = 0 | |
while ($current_thread != 0) | |
printf "Thread %02d (%p) ", $idx, $current_thread | |
zephyr_show_thread $current_thread | |
if ($current_thread == _kernel->current) | |
printf " <- RUNNING" | |
end | |
printf "\n" | |
set $PC = *(((struct k_thread *)$current_thread)->callee_saved.psp + 20) | |
printf "\t" | |
info line *$PC | |
set $idx = $idx + 1 | |
set $current_thread = $current_thread->next_thread | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Enable
CONFIG_THREAD_MONITOR
andCONFIG_THREAD_STACK_INFO
Then run "zephyr_list_threads"