var i;\r
var a = new Array();\r
\r
- var current_task;\r
-\r
- current_task = Debug.evaluate("pxCurrentTCB");\r
-\r
- if( current_task == 0 )\r
- return;\r
-\r
sp += 4; /* skip stored ulCriticalNesting */\r
+\r
a[16] = Debug.evaluate("*(unsigned long*)" + sp); \r
\r
for (i = 0; i <= 15; i++)\r
\r
function add_task(task, state)\r
{\r
- var tcb, task_name;\r
-\r
- var current_task;\r
+ var tcb, task_name, current_task, regs;\r
\r
current_task = Debug.evaluate("pxCurrentTCB");\r
-\r
- if( current_task == 0 )\r
- return;\r
-\r
tcb = Debug.evaluate("*(tskTCB *)" + task);\r
+\r
task_name = Debug.evaluate("(char*)&(*(tskTCB *)" + task + ").pcTaskName[0]");\r
- Threads.add("#" + tcb.uxTCBNumber + " \"" + task_name + "\"", tcb.uxPriority, state, decode_stack(tcb.pxTopOfStack));\r
-}\r
+ task_name = "#" + tcb.uxTCBNumber + " \"" + task_name + "\"";\r
\r
-function add_list(list, state, current_task)\r
-{\r
- var i, index, item, end;\r
- var current_task;\r
+ if (task == current_task)\r
+ {\r
+ state = "executing";\r
+ regs = [];\r
+ }\r
+ else\r
+ {\r
+ regs = decode_stack(tcb.pxTopOfStack);\r
+ }\r
\r
- current_task = Debug.evaluate("pxCurrentTCB");\r
+ Threads.add(task_name, tcb.uxPriority, state, regs);\r
+}\r
\r
- if( current_task == 0 )\r
- return;\r
+function add_list(list, state)\r
+{\r
+ var i, index, item, task;\r
\r
- if (list.uxNumberOfItems)\r
+ if (list && list.uxNumberOfItems>0)\r
{\r
- index = list.pxIndex;\r
- end = list.xListEnd;\r
+ index = list.xListEnd.pxNext;\r
+\r
for (i = 0; i < list.uxNumberOfItems; i++)\r
{\r
item = Debug.evaluate("*(xListItem *)" + index);\r
- if (index != end)\r
- {\r
- task = item.pvOwner;\r
- if (task) add_task(task, (task == current_task) ? "executing" : state);\r
- }\r
+\r
+ task = item ? item.pvOwner : 0;\r
+\r
+ if (task)\r
+ add_task(task, state);\r
+\r
index = item.pxNext;\r
}\r
}\r
\r
function update() \r
{\r
- var i, current_task, list, lists, max_priority;\r
+ var i, list, lists, max_priority;\r
\r
Threads.clear();\r
\r
- current_task = Debug.evaluate("pxCurrentTCB");\r
-\r
- if( current_task == 0 )\r
+ if( Debug.evaluate("pxCurrentTCB") == 0 )\r
return;\r
\r
- Threads.newqueue("Ready");\r
- lists = Debug.evaluate("pxReadyTasksLists");\r
- if (lists)\r
- { \r
- max_priority = Debug.evaluate("uxTopUsedPriority");\r
- max_priority = Debug.evaluate("*(long *)" + max_priority);\r
+ max_priority = Debug.evaluate("uxTopUsedPriority");\r
\r
- for (i = 0; i <= max_priority; i++)\r
- {\r
- list = Debug.evaluate("((xList*)" + lists + ")[" + (max_priority - i) + "]");\r
- add_list(list, "ready", current_task);\r
- }\r
+ Threads.newqueue("Ready");\r
+ for (i = max_priority; i >= 0; i--)\r
+ {\r
+ list = Debug.evaluate("pxReadyTasksLists[" + i + "]");\r
+ add_list(list, "ready");\r
}\r
\r
Threads.newqueue("Blocked");\r
-\r
list = Debug.evaluate("pxDelayedTaskList");\r
if (list)\r
{\r
- list = Debug.evaluate("**(xList **)" + list);\r
+ list = Debug.evaluate("*(xList *)" + list);\r
add_list(list, "blocked");\r
}\r
\r
list = Debug.evaluate("pxOverflowDelayedTaskList");\r
if (list)\r
{\r
- list = Debug.evaluate("**(xList **)" + list);\r
+ list = Debug.evaluate("*(xList *)" + list);\r
add_list(list, "blocked");\r
}\r
\r
Threads.newqueue("Suspended");\r
-\r
list = Debug.evaluate("xSuspendedTaskList");\r
if (list)\r
{\r
- list = Debug.evaluate("*(xList *)" + list);\r
add_list(list, "suspended");\r
}\r
+\r
}\r
\r