# Linux Kernel Module Cheat

##### 23.9.8.5. gem5 tracing internals

As of gem5 16eeee5356585441a49d05c78abc328ef09f7ace the default tracer is `ExeTracer`. It is set at:

    src/cpu/BaseCPU.py:63:default_tracer = ExeTracer()

which then gets used at:

    class BaseCPU(ClockedObject):
        [...]
        tracer = Param.InstTracer(default_tracer, "Instruction tracer")

All tracers derive from the common `InstTracer` base class:

    git grep ': InstTracer'

gives:

    src/arch/arm/tracers/tarmac_parser.hh:218:    TarmacParser(const Params *p) : InstTracer(p), startPc(p->start_pc),
    src/arch/arm/tracers/tarmac_tracer.cc:57:  : InstTracer(p),
    src/cpu/exetrace.hh:67:    ExeTracer(const Params *params) : InstTracer(params)
    src/cpu/inst_pb_trace.cc:72:    : InstTracer(p), buf(nullptr), bufSize(0), curMsg(nullptr)
    src/cpu/inteltrace.hh:63:    IntelTrace(const IntelTraceParams *p) : InstTracer(p)

As mentioned at gem5 TARMAC traces, there appears to be no way to select those currently without hacking the config scripts.

TARMAC is described at: gem5 TARMAC traces.

TODO: are `IntelTrace` and `TarmacParser` useful for anything or just relics?

Then there is also the `NativeTrace` class:

    src/cpu/nativetrace.hh:68:class NativeTrace : public ExeTracer

which gets implemented in a few different ISAs, but not all:

    src/arch/arm/nativetrace.hh:40:class ArmNativeTrace : public NativeTrace
    src/arch/sparc/nativetrace.hh:41:class SparcNativeTrace : public NativeTrace
    src/arch/x86/nativetrace.hh:41:class X86NativeTrace : public NativeTrace

TODO: I can’t find any usages of those classes from in-tree configs.