gem5 is huge suggest decide which architecture you want (eg X86) build only part you want make sure have upto date compiler (eg gcc version 10.2.1) python (eg 3.7.3) scons (eg v4.5.2) m4 (eg 1.4.16) make sure something like the following works build/ALL/gem5.opt ssbse-challenge-examples/hello-custom-binary.py --isa X86 --binary ../hello64-static hello-custom-binary.py avoid SSH network problems by using local only --isa X86 which CPU type you are interested in --binary name of X86 executable ../hello64-static small example executable binary compiled for X86 gem5 statistics goes into separate files (not stdout)
scons build/X86/libgem5_opt.so --no-colors --verbose
To get gem5 scons to reflect command lines (like make V=1) use something like:
scons build/X86/gem5.opt --verboseThis will be very verbose.
See How to set scons to output full expanded command line? and manpage
After deleting these, scons gave totally confusing error messages. Such as:
Info: Using Python config: python3-config Checking for C header file Python.h... (cached) yes Checking Python version... no Error: Can't find a working Python installationand exited with status code 1 (There was nothing wrong with python or python3-config).
If you are lucky it may be possible to restore these .o files and get scons running again.
Perhaps something like:
AddOption('--gcov', action='store_true', help='Enable support for the gcov coverage of gem5 tool')
if GetOption('gcov'): env.Append(CCFLAGS=['-g', '-O0', '--coverage'], LINKFLAGS=['--coverage'])
scons build/X86/gem5.debug --gcov --no-colors --verbosewill generate 1724 .do object files and 2098 .gcno The .gcno files "contain information to reconstruct the basic block graphs and assign source line numbers to blocks".
build/X86/gem5.debug gem5-ssbse-challenge-2023/ssbse-challenge-examples/hello-custom-binary.py --isa X86 --binary hello64-static
NB running the gcov version of gem5 again will update the .gcda files (rather than replace them).
gcov `find -iname '*.gcda'`will generate 1932 .gcov text output files in the current directory (gcov takes several minutes). However be wary that different gem5 directories contain files with the same name and hence gcov will generate overlapping output files of the same name.
Having thousands of files scattered over 129 different directories is bound to cause confusion.
gcov by itself effectively gives a command line syntax error and produces gcov help text.
gcov . .gcno:cannot open notes file .gcda:cannot open data file, assuming not executedgcov needs to be given an .gcda on its command line (see above).
gcov ./build/X86/arch/x86/decoder.gcda ./build/X86/arch/x86/decoder.gcno:version 'B02R', prefer '408R' ./build/X86/arch/x86/decoder.gcno:no functions found
Did you fail to set up $PATH the same as when gem5 was run?
GCOV_PREFIX GCOV_PREFIX_STRIP
W.B.Langdon 7 August 2023 (last update 28 August 2023)