12.3. Tracer

A sample implementation of a tracer is provided. This can trace instructions, memory accesses, and events to an RDI log window or a file (in text or binary format). See the source file, tracer.c, and Configuring the Tracer below, for details of the formats used in these files. The configuration file armul.cnf controls what is traced.

Alternatively, you can link your own tracing code onto the Tracer module, allowing real-time tracing. No examples are supplied, but the required functions are documented here. The formats of Trace_State and Trace_Packet are documented in tracer.h.

unsigned Tracer_Open(Trace_State *ts)

This is called when the tracer is initialized. The implementation in tracer.c opens the output file from this function, and writes a header.

void Tracer_Dispatch(Trace_State *ts, Trace_Packet *packet)

This is called on each traced event for every instruction, event, or memory access. In tracer.c, this function writes the packet to the trace file.

void Tracer_Close(Trace_State *ts)

This is called at the end of tracing. The file tracer.c uses this to close the trace file.

extern void Tracer_Flush(Trace_State *ts)

This is called when tracing is disabled. The file tracer.c uses this to flush output to the trace file.

The default implementations of these functions can be changed by compiling tracer.c with EXTERNAL_DISPATCH defined.

Copyright © 1997, 1998 ARM Limited. All rights reserved.ARM DUI 0040D