D e b u g g i n g a p p l i c a t i o n s
Debugging applications
The purpose of a debugger is to allow you to see what is going on his own programs while they execute. For that purpose the GDB debugger is used by means of the gdbserver application that runs on the target side and communicates with the host computer. This communication can happen on the serial port or through Ethernet (the latter is preferred for being much faster).
The use of the GDB debugger is out of the scope of this manual. You can get more information about it in the standard GDB man pages.
In order to debug an application it has to be rebuilt with debug information. To do that, enter the target binary build directory (e.g. "apps/mem") and rebuild the application with the following command:
~/LxNETES3.2$ rm apps/mem/*.o apps/mem/mem
~/LxNETES3.2$ make apps DEBUG=1 install
A binary mem will be created and copied to the rootfs. Restart the target with the new rootfs.
Run the debug server on the target with the following commands:
#gdbserver localhost:2001 /usr/bin/mem Process /mem created; pid = 39 Listening on port 2001
Remote debugging from host 192.168.42.1
Port number 2001 was selected randomly.
Now start the debug client on the host and connect to the target with
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as
...
(gdb)
3 4 | L x N E T E S U s e r ’ s G u i d e |