Search code examples
trace32

Log struct variable to file in trace32


I am trying to log the contents of a structure to a file with a practice script.

I would rather not use Var.VALUE for every field of the struct and so far I have found the Var.PRINT command which displays all the information contained in the struct.

However I do not know if I can output this to a file, or if there is any other solution I'm not aware of for logging the values of a struct.


Solution

  • These three scripts can log the contents of a structure.

    cmm1

    PRinTer.FILE c:\temp\temp1.txt
    WinPrint.v.v struct_name
    TYPE c:\temp\temp1.txt
    ENDDO
    

    cmm2

    PRinTer.FILE c:\temp\temp2.txt
    WinPrint.v.v %all struct_name
    TYPE c:\temp\temp2.txt
    ENDDO
    

    cmm3

    PRinTer.FILE c:\temp\temp3.txt
    WinPrint.v.v %m.4 %r.5 struct_name
    TYPE c:\temp\temp3.txt
    ENDDO
    

    The cmm1 script will save the first level content.

    The cmm2 script will save the first level content along with data type.

    The cmm3 script will save the pointer value recursively.

    m stands for multiline. It displays the structure elements in multiple line format. If the elements are in a multidimensional array, the numeric parameter defines the number of levels displayed.

    r stands for recursive. This optional number defines the depth of recursion to be displayed. The command SETUP.VarPtr defines the valid address range for pointers. The contents of pointers outside this range are not displayed.