mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-19 15:23:34 +08:00
Break out the task stack usage sniffer so we can use it on systems where the task layout has been shrunk (e.g. PX4IO)
This commit is contained in:
+17
-5
@@ -168,17 +168,29 @@ define _showsemaphore
|
|||||||
printf "\n"
|
printf "\n"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#
|
||||||
|
# Print information about a task's stack usage
|
||||||
|
#
|
||||||
|
define showtaskstack
|
||||||
|
set $task = (struct _TCB *)$arg0
|
||||||
|
|
||||||
|
set $stack_free = 0
|
||||||
|
while ($stack_free < $task->adj_stack_size) && *(uint8_t *)($task->stack_alloc_ptr + $stack_free)
|
||||||
|
set $stack_free = $stack_free + 1
|
||||||
|
end
|
||||||
|
printf" stack 0x%08x-0x%08x (%d) %d free\n", $task->stack_alloc_ptr, $task->adj_stack_ptr, $task->adj_stack_size, $stack_free
|
||||||
|
end
|
||||||
|
|
||||||
|
#
|
||||||
|
# Print details of a task
|
||||||
|
#
|
||||||
define showtask
|
define showtask
|
||||||
set $task = (struct _TCB *)$arg0
|
set $task = (struct _TCB *)$arg0
|
||||||
|
|
||||||
printf "%p %.2d ", $task, $task->pid
|
printf "%p %.2d ", $task, $task->pid
|
||||||
_showtaskstate $task
|
_showtaskstate $task
|
||||||
printf " %s\n", $task->name
|
printf " %s\n", $task->name
|
||||||
set $stack_free = 0
|
showtaskstack $task
|
||||||
while ($stack_free < $task->adj_stack_size) && *(uint8_t *)($task->stack_alloc_ptr + $stack_free)
|
|
||||||
set $stack_free = $stack_free + 1
|
|
||||||
end
|
|
||||||
printf" stack 0x%08x-0x%08x (%d) %d free\n", $task->stack_alloc_ptr, $task->adj_stack_ptr, $task->adj_stack_size, $stack_free
|
|
||||||
|
|
||||||
if $task->task_state == TSTATE_WAIT_SEM
|
if $task->task_state == TSTATE_WAIT_SEM
|
||||||
printf " waiting on %p ", $task->waitsem
|
printf " waiting on %p ", $task->waitsem
|
||||||
|
|||||||
Reference in New Issue
Block a user