Hi
I am trying to develop a debug script to list all the task names in the various task lists at any particular time, by using the ListItem_t->pxIndex->pvOwner to point to the TCB to get the required information
I noticed that memory is overlapping between two different task lists.
(gdb) p/x &pxReadyTasksLists[0]->pxIndex->pvOwner
$4 = 0x3ff01038
(gdb) p/x &pxReadyTasksLists[1]->uxNumberOfItems
$5 = 0x3ff01038
(gdb) p/x &pxReadyTasksLists[0]->uxNumberOfItems
$6 = 0x3ff01010
(gdb) p/x &pxReadyTasksLists[1]->pxIndex->pvOwner
$7 = 0x3ff01060
(gdb) p/x &pxReadyTasksLists[2]->uxNumberOfItems
$8 = 0x3ff01060
(gdb) p/x &pxReadyTasksLists[2]->pxIndex->pvOwner
$9 = 0x3ff01088
(gdb) p/x &pxReadyTasksLists[3]->uxNumberOfItems
$10 = 0x3ff01088
The data element uxNumberOfItems of any list is overlapping with pxIndex->pvOwner of the previous list. Note the address above, and this is consistent with all task lists
The impact is the variable pvOwner of list 0 is getting corrupted whenever the uxNumberOfItems of list 1 gets updated
While debugging I came across this code snippet in list.c:void vListInitialise( List_t * const pxList )
pxList->pxIndex = ( ListItem_t * ) &( pxList->xListEnd ); /*lint !e826 !e740 !e9087 The mini list structure is used as the list end to save RAM. This is checked and valid. */
Here we are trying to map a 24 bytes structure onto a 40 byte structure and hence the memory overlap
I want to know why we are doing this, apart from the savings in terms of RAM Memory, and how should I accomplish my task at hand. What other areas this could impact and how ?