Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. define zephyr_show_thread
  2. printf "State=%d; ", ((struct k_thread *)$arg0)->base.thread_state
  3. printf "Prio=%d; ", ((struct k_thread *)$arg0)->base.prio
  4. printf "Entry=%p; ", ((struct k_thread *)$arg0)->entry.pEntry
  5. printf "PC=%p; ", *(((struct k_thread *)$arg0)->callee_saved.psp + 20)
  6. printf "PSP=%p; ", ((struct k_thread *)$arg0)->callee_saved.psp + 32
  7.  
  8. set $stack_start = ((struct k_thread *)$arg0)->stack_info.start
  9. set $stack_size = ((struct k_thread *)$arg0)->stack_info.size
  10. printf "Stack: %p <- %p (%u bytes)", $stack_start, $stack_start + $stack_size, $stack_size
  11. end
  12.  
  13. define zephyr_list_threads
  14. set $current_thread = _kernel.threads
  15. set $idx = 0
  16.  
  17. while ($current_thread != 0)
  18. printf "Thread %02d (%p) ", $idx, $current_thread
  19.  
  20. zephyr_show_thread $current_thread
  21.  
  22. if ($current_thread == _kernel->current)
  23. printf " <- RUNNING"
  24. end
  25. printf "\n"
  26.  
  27. set $PC = *(((struct k_thread *)$current_thread)->callee_saved.psp + 20)
  28. printf "\t"
  29. info line *$PC
  30.  
  31. set $idx = $idx + 1
  32. set $current_thread = $current_thread->next_thread
  33. end
  34. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement