1. tracing
printf()是很好的工具,同时gem5在自己代码里面就有很多已经做好的输出信息,可以通过flag制定来选择。
输出flags:
Fetch, Decode, Ethernet, Exec, TLB, DMA, Bus, Cache, Loader, O3CPUAll,
要想知道所有的flags,运行的时候加上--debug-help选项就可以。
调试方法
1. 选择flags;
--debug-flags=Cache,Bus
--debug-flags=Exec,-ExecTicks
2. 选择输出文件:
--trace-file=my_trace.out
3. 选择初始点:
--trace-start=3000000
./build/X86/gem5.debug --debug-flags=MemoryAccess configs/example/se.py -c tests/test-progs/hello/bin/x86/linux/hello --cpu-type=detailed --caches --l2cache --mem-type=nvmain --nvmain-config=../zgl_nv_main/nvmain/Config/Hybrid_example.config > myout
添加调试输出
在源代码中
Adding an extra tracing statement:
#include “debug/MyFlag.h”
DPRINTF(MyFlag, “normal printf %snn”, “arguments”);
Adding a new debug flags (in a SConscript):
DebugFlag(’MyFlag’)
2. 使用gdb调试gem5
setDebugFlag()/clearDebugFlag()
dumpDebugStatus()
eventqDump()
SimObject::find()
takeCheckpoint()
3. python 调试