Trace with task details


so I am building some sort of tracing app to visually display context switches. As the documentation states I included my macros at the end of FreeRTOSConfig.h.
It worked for some trace macros but I don’t get how you are supposed to use trace macros like this one:

xTask is an opaque pointer because the struct is private. How am I supposed to get the tag like in Example 1 (pxCurrentTCB->pxTaskTag)?


The macro is inlined within the tasks.c source file, so you have full access to the internals of the structure to which the opaque pointer points. traceMOVED_TASK_TO_READY_STATE appears inside prvAddTaskToReadyList() - which appears in multiple places, but using this occurrence as an example: you will see the task handle is passed into the function using the opaque TaskHandle_t parameter, but the parameter passed into prvAddTaskToReadyList() is of the non-opaque TCB_t type.

Okay thanks.
Initially I wanted to wire them to my custom trace handler. The macros would just relay the calls to those handlers but then I would lose the context where TCB_t is defined. I will just expand the information I need before the trace handler call.

Before (what i wanted to do):
#define traceMOVED_TASK_TO_READY_STATE(xTask) handleTaskMoveToRdy(xTask)
void handleTaskMoveToRdy(TaskHandle* xTask) {
//get task info with vTaskGetInfo

#define traceMOVED_TASK_TO_READY_STATE(xTask) {
handleTaskMoveToRdy(xTask->pcTaskName, … );