
Arcom Embedded Linux Technical Manual Developing software for AEL
Debugging applications on the target
The AEL host environment includes the GNU Debugger (GDB). GDB enables you to
control the execution of your application, examine program state and view the
application code. GDB is a symbolic debugger. This means that you can debug your
application using the function and variable names that were used in the source code.
The main GDB application binary is automatically installed on your host system as part
of the host environment. The recommended method of debugging target applications
using GDB is over an Ethernet connection using the gdbserver utility, which is present
on the target by default.
It is possible to run GDB directly on the target board by installing the GDB package from
the Development Kit CD. We do not recommend this because GDB is relatively large
and memory-hungry. Furthermore, you would not benefit from full symbolic debugging
as your application source code is not available on the target.
This section describes the basics of how you can use GDB to debug an application
running on a remote target. Please consult the GDB manual for more information about
using GDB. The manual is available on the Development Kit CD in /manuals/gdb.pdf, or
from the GDB website at www.gnu.org/software/gdb
.
Compiling an application for debugging
Before you can debug a program using the full symbolic information, you must compile
and link the application with full symbolic information. This is done by adding the –g
option to both compile and link commands. For example, to compile a simple hello
world application, enter the following:
$ arm-linux-gcc –g –o hello hello.c
Once compiled, copy the binary to your target system using scp:
It is possible to debug optimized programs with GDB, but you may find that
optimizations such as those performed when using the –O2 option interfere with GDB’s
understanding of program flow and variable location. We recommend that you disable
optimizations in your application while you are debugging it either by using –O0 or by
leaving out the –O options all together.
© 2006 Arcom Issue G 42
Comentarios a estos manuales