After successful compilation with the appropriate target you can launch
the simulation and automatically attach a GDB instance to it. To launch an interactive
GDB session run the command with the switch
By default, when running the x86 simulator with the
--gdb command line switch it breaks immediately before entering
main() in graph.cpp.
This pauses execution before any AI Engine kernels
have started because the graph has not been run. To exit GDB type
help for more
Setting a breakpoint can be done in multiple ways. One method uses the following syntax:
c) the debugger runs until the breakpoint in
<kernel function name> is reached. When the
breakpoint is reached it is possible to examine local stack variables and function
arguments. The following table shows some commonly used GDB instructions to allow
examination of these variables.
|Reports the function call stack at the current breakpoint.
|Shows the current status of local variables within the scope of the function call shown in the call stack.
|Prints the current value of a single variable.
|Exits the current function call but keeps the simulation paused.
|Causes the debugger to run to completion.
GDB is a very powerful debugger with many features. Complete documentation of GDB is beyond the scope of this document. For GDB documentation, see https://sourceware.org/gdb/current/onlinedocs/gdb.pdf and https://sourceware.org/gdb/current/onlinedocs/refcard.pdf.