rtel wrote on Sunday, September 11, 2011:
When the task that is “stuck” gets stuck, does the rest of the system continue executing? If so, then the stuck task cannot itself be in the Running state. You could then use the traceTASK_SWITCHED_OUT() macro to log some data about each task as it is switched out of the Running state - how useful that is would be debatable though. For example:
1) If the task is switched out because it yields, the last instruction it executes will always be in the yield function, and that tells you nothing about why it was yielding. You could get around that by using more trace macros to also log data about why yield was called (for example, was it a block on a queue, or because vTaskDelay() was called, etc.).
2) If a task no longer runs it might be because a completely different task is using all the CPU time, and starving it of any time itself.