F.2 Tracing file format
Every mpatrol tracing output file contains the following components.
- 4 bytes containing the characters `M', `T', `R' and `C'.
- 1 unsigned integer representing the value `1'. This is used by
mptrace to determine the endianness of the processor that produced the
tracing output file so that it can decide whether to perform byte-swapping on
the input data.
- 1 unsigned integer containing the version number of the mpatrol library which
produced the tracing output file.
- One or more of the following event records.
- If the event is a system heap allocation for use by the mpatrol library's
internal data structures then the event record will begin with the character
`I' followed by the start address and size in bytes of the heap allocation
encoded as unsigned LEB128 numbers.
- If the event is a system heap allocation for use by the program's memory
allocations then the event record will begin with the character `H'
followed by the start address and size in bytes of the heap allocation encoded
as unsigned LEB128 numbers.
- If the event is a memory allocation then the event record will begin with the
character `A' followed by the allocation index, start address and size in
bytes of the memory allocation encoded as unsigned LEB128 numbers. From version
1.4.5 of the mpatrol library, the thread identifier, function name, file name
and line number are also written out as part of the event record (see below).
- If the event is a memory reallocation then the event record will begin with the
character `R' followed by the allocation index, start address and size of
the new memory allocation encoded as an unsigned LEB128 number. From version
1.4.5 of the mpatrol library, the thread identifier, function name, file name
and line number are also written out as part of the event record (see below).
- If the event is a memory deallocation then the event record will begin with the
character `F' followed by the allocation index of the memory allocation
encoded as an unsigned LEB128 number. From version 1.4.5 of the mpatrol
library, the thread identifier, function name, file name and line number are
also written out as part of the event record (see below).
- From version 1.4.5 of the mpatrol library, event records contain the following
additional information.
- The thread identifier as an unsigned LEB128 number.
- The cached source function name. If the first byte is zero then there is no
associated function name. If the first byte has the most significant bit set
then the following null-terminated string defines a source function name
associated with the number in the remaining 7 bits. If the first byte does not
have the most significant bit set then it is taken to be the index of a
previously defined source function name.
- The cached source file name. If the first byte is zero then there is no
associated file name. If the first byte has the most significant bit set then
the following null-terminated string defines a source file name associated with
the number in the remaining 7 bits. If the first byte does not have the most
significant bit set then it is taken to be the index of a previously defined
source file name.
- The source line number as an unsigned LEB128 number.
- 4 bytes containing the characters `M', `T', `R' and `C'.