# Linux Kernel Module Cheat

##### 23.9.8.1. gem5 trace internals

gem5 traces are generated from `DPRINTF(<trace-id>` calls scattered throughout the code, except for `ExecAll` instruction traces, which uses `Debug::ExecEnable` directly..

The trace IDs are themselves encoded in `SConscript` files, e.g.:

    DebugFlag('Event'

in `src/cpu/SConscript`.

The build system then automatically adds the options to the `--debug-flags`.

For this entry, the build system then generates a file `build/ARM/debug/ExecEnable.hh`, which contains:

    namespace Debug {
    class SimpleFlag;
    extern SimpleFlag ExecEnable;
    }

and must be included in from callers of `DPRINTF(` as `<debug/ExecEnable.hh>`.

Tested in b4879ae5b0b6644e6836b0881e4da05c64a6550d.