
Arcom Embedded Linux Technical Manual Developing software for AEL
Starting GDB and GDB server
Now that the binary has been compiled with debugging information and copied to the
board, you can start the gdbserver and initiate a GDB session on your target system. To
do this, follow these steps:
1 Start the gdbserver process on your target system, giving a port number to listen
on (9000 in the following example) followed by the program to be debugged:
$ gdbserver :9000 /tmp/hello “hello world”
Arguments can be passed to the application by adding them to the gdbserver
command line. The above command starts gdbserver listening on port 9000,
which then loads /tmp/hello, passing the string “hello world” as an argument. It
then stops before running the application and waits for a remote GDB session to
be initiated.
2 Initiate a GDB session on the host and pass the application binary as a parameter
to GDB:
$ arm-linux-gdb hello
GDB starts, displaying a banner followed by a (gdb) prompt.
3 Connect to the remote system, assuming it is 192.168.1.4, by typing:
(gdb) target remote 192.168.1.4:9000
This connects to the gdbserver process you started in step 1.
Once the remote connection is established any of the normal GDB commands
may be used to debug the application, such as setting a breakpoint on the main()
function and continuing:
(gdb) b main
(gdb) c
When the application exits you'll need to repeat step 1 (i.e. starting gdbserver) and
reconnect with the target command.
You may need to tell GDB where to find the target libraries by setting the GDB
variable solib-search-path (a comma separated list of paths to search) before
connecting to the target. For example:
(gdb) set solib-search-path /opt/arcom/arm-linux/lib
© 2006 Arcom Issue G 43
Kommentare zu diesen Handbüchern