The altera_mem_if_sequencer_cpu_no_ifdef_params_sim_cpu_instr.tr file is a trace file that can be used to debug the embedded Nios II processor in the UniPHY-based memory controllers. The trace file comes in three parts: a header, a description section, and a trace frame section with binary data.
The header has the form
\x7fTRACE0\n. The first byte is
0x7f so as to indicate that the file contains binary data, while the
0 is a version number that may have different values in the future.
The description section consists of multiple lines of ascii text separated by newline characters (
0xa). The lines may include a variety of optional descriptive or context-setting information, such as tracepoint definitions or register set size. The GNU Project Debugger (GDB) will ignore any line that it does not recognize. An empty line marks the end of this section.
The trace frame section consists of a number of consecutive frames. Each frame begins with a two-byte tracepoint number, followed by a four-byte size giving the amount of data in the frame. The data in the frame consists of a number of blocks, each introduced by a character indicating its type (at least register, memory, and trace state variable). The data in this section is raw binary, not a hexadecimal or other encoding; its endianness matches the target's endianness.
- Register block. The number and ordering of bytes matches that of a
gpacket in the remote protocol. Note that these are the actual bytes, in target order and GDB register order, not a hexadecimal encoding.
Maddress length bytes
- Memory block. This is a contiguous block of memory, at the 8-byte address address, with a 2-byte length length, followed by length bytes.
- Trace state variable block. This records the 8-byte signed value value of trace state variable numbered number.
The trace file format is just the GNU GDB normal trace file format. The GNU debugger tools can use it.