You can run GDB, the GNU Debugger, on your host system to debug programs running remotely on a target board or system.
When starting GDB, give it the pathname to the program you want to debug as a command-line argument. For example, if you have built the factorial program as described in Section 4.1, “Building an Application”, enter:
> arm-none-eabi-gdb factorial
While this section explains the alternatives for using GDB to run and debug application programs, explaining the use of the GDB command-line interface is beyond the scope of this document. Please refer to the GDB manual for further instructions.
From within GDB, you can connect to a running gdbserver
or other debugging stub that uses the GDB remote protocol using:
(gdb) target remotehost
:port
where host
is the host name or IP address of the
machine the stub is running on, and port
is the
port number it is listening on for TCP connections.
Connecting to a bare-metal target or simulator from GDB does not cause your program to be loaded into target memory. You must do this explicitly from GDB after you connect:
(gdb) load
Alternatively, you can use third-party tools to load your application into flash memory before starting GDB.
To begin execution of your application, you should generally use the
continue
command:
(gdb) continue