The GNU debugger allows for C/C++ debugging similar to an IDE based debugger. It allows setting of breakpoints, single stepping, stepping over functions, and multiple hit counts on breakpoints. For AI Engine kernel development the x86 simulator enables single step debugging of kernel code using GDB.
The target
argument for the AI Engine compiler must be set to x86sim
to use GDB.
aiecompiler --target=x86sim graph.cpp
Additionally, compiling with the preprocessor directive -O0
minimizes optimizations which improves debug
visibility. If additional debug visibility is required it is possible to reduce the
compiler optimization level. Passing the optimization parameter to the preprocessor can
be done as follows.
aiecompiler --target=x86sim --Xpreproc=-O0 graph.cpp