gem5 version:v21.2.0.0,add a new debugflag in src/mem/cache/SConscript,
recompile with scons/build/ARM/gem.opt,
and in build/ARM/debug file still don’t have new debugflag.hh
in this version, how to define a new debugflag to show the details about addr, pc addr, cacheline’s index, cacheline’s offset, write/read, access lenth, L1 hit/miss and index, L2 hit/miss and index
2
Answers
Se.py is not the right file to add your debugging flags. Go to options.py, and add as many as you want in there so that you can pass them in the command line when you run simulations. You could check for these flags in cache.cc to do your data (hits, misses, address and pc on l1d cache).
Per the gem5 documentation, to add a DebugFlag you have to "add new debug flags simply by adding DebugFlag() command to any SConscript file (preferably the one nearest where you are using the new flag). If you use a debug flag in a C++ source file, you would need to include the header file debug/.hh in that file."
For example, if you wanted to add the flag to
src/mem/cache/SConscript
, you could addDebugFlag("SampleFlag")
to the SConscript. To compile, you cannot use thegem5.fast
compilation target (the documentation states that DebugFlags are not included to optimize compilation), but thedebug/SampleFlag.hh
should be created automatically in thebuild/<ISA>/
directory (where the path would bebuild/ISA/debug/SampleFlag.hh
).Then, to add
SampleFlag
to thesrc/mem/cache/cache.cc
file, you need to includedebug/SampleFlag.hh
at the beginning of the file, and can then use the syntaxDPRINTF(SampleFlag, "<formatting string of addr, pc addr, cacheline's index, cacheline's offset, write/read, access lenth, L1 hit/miss and index, L2 hit/miss and index>")
.