Skip to content

Commit

Permalink
Debug/NuttX: small changes to make it work with the current stable br…
Browse files Browse the repository at this point in the history
…anch. Debug/NuttX made existing code work with python3 in gdb. Added some new features
  • Loading branch information
mazahner committed Nov 10, 2014
1 parent 8dc165b commit d15203d
Show file tree
Hide file tree
Showing 2 changed files with 416 additions and 55 deletions.
38 changes: 30 additions & 8 deletions Debug/NuttX
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ end
################################################################################

define showfiles
set $task = (struct _TCB *)$arg0
set $task = (struct tcb_s *)$arg0
set $nfiles = sizeof((*(struct filelist*)0).fl_files) / sizeof(struct file)
printf "%d files\n", $nfiles
set $index = 0
Expand All @@ -102,7 +102,7 @@ end
################################################################################

define _showtask_oneline
set $task = (struct _TCB *)$arg0
set $task = (struct tcb_s *)$arg0
printf " %p %.2d %.3d %s\n", $task, $task->pid, $task->sched_priority, $task->name
end

Expand Down Expand Up @@ -139,7 +139,7 @@ end
# Print task registers for a NuttX v7em target with FPU enabled.
#
define _showtaskregs_v7em
set $task = (struct _TCB *)$arg0
set $task = (struct tcb_s *)$arg0
set $regs = (uint32_t *)&($task->xcp.regs[0])

printf " r0: 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x\n", $regs[27], $regs[28], $regs[29], $regs[30], $regs[2], $regs[3], $regs[4], $regs[5]
Expand All @@ -162,7 +162,7 @@ end
define _showsemaphore
printf "count %d ", $arg0->semcount
if $arg0->holder.htcb != 0
set $_task = (struct _TCB *)$arg0->holder.htcb
set $_task = (struct tcb_s *)$arg0->holder.htcb
printf "held by %s", $_task->name
end
printf "\n"
Expand All @@ -172,7 +172,7 @@ end
# Print information about a task's stack usage
#
define showtaskstack
set $task = (struct _TCB *)$arg0
set $task = (struct tcb_s *)$arg0

if $task == &g_idletcb
printf "can't measure idle stack\n"
Expand All @@ -189,7 +189,7 @@ end
# Print details of a task
#
define showtask
set $task = (struct _TCB *)$arg0
set $task = (struct tcb_s *)$arg0

printf "%p %.2d ", $task, $task->pid
_showtaskstate $task
Expand All @@ -204,7 +204,7 @@ define showtask
if $task->task_state != TSTATE_TASK_RUNNING
_showtaskregs_v7em $task
else
_showcurrentregs_v7em
_showtaskregs_v7em $task
end

# XXX print registers here
Expand Down Expand Up @@ -247,8 +247,10 @@ define showtasks
_showtasklist &g_pendingtasks
printf "RUNNABLE\n"
_showtasklist &g_readytorun
printf "WAITING\n"
printf "WAITING for Semaphore\n"
_showtasklist &g_waitingforsemaphore
printf "WAITING for Signal\n"
_showtasklist &g_waitingforsignal
printf "INACTIVE\n"
_showtasklist &g_inactivetasks
end
Expand All @@ -257,3 +259,23 @@ document showtasks
. showtasks
. Print a list of all tasks in the system, separated into their respective queues.
end

define my_mem

set $start = $arg0
set $end = $arg1
set $cursor = $start

if $start < $end
while $cursor != $end
set *$cursor = 0x0000
set $cursor = $cursor + 4
printf "0x%x of 0x%x\n",$cursor,$end
end
else
while $cursor != $end
set *$cursor = 0x0000
set $cursor = $cursor - 4
end
end
end
Loading

0 comments on commit d15203d

Please sign in to comment.