Axis Area
Public Area
Special pages
NOTE
Please note that you should always set the correct paths when debugging an application which uses shared libraries.
To be able to debug a program, you must build it with debugging in mind. With the Axis software distribution there is a make target that does this for you, called 'debug' (check tools/build/rules/common.mak for details).
To build your application for debugging, go to the subsystem you want to debug and:
make debug && make clean && make install
(and 'make nodebug' to turn off debug).
Below follows a summary of what 'make debug' does (and what you need to do if you don't use it).
Return to the top-level of the build system and:
make images
Flash load your target as described in the section on flash loading.
Note: The gdbserver must be installed on the target. If not, see gdb-server for instructions.
Telnet, or log in via the serial port (if you have agetty on that port) to your board. The preferred way to communicate with gdb on the host side is over TCP/IP. On the target:
gdbserver [<hostname/ip address>]:<port> <program> [<arguments for program>]
Example: gdbserver hostname:1234 /tmp/hello_world
Now start gdb-cris on the host.
gdb-cris [<program>]
Example: gdb-cris ~/axis/devboard/apps/hello/hello_world
If you don't load the program in gdb-cris you must make sure that the current cris-version is correct before connecting to the target. Axis Etrax 100LX har cris version 10 and Axis Etrax FS has cris-version 32.
(gdb) show cris-version The current CRIS version is 10. (gdb) set cris-version 32 (gdb) show cris-version The current CRIS version is 32. (gdb)
To connect to the target:
target <hostname/ip address>:<port> (make sure you specify the same port number)
Example: (gdb) target remote 10.13.8.122:2345
To debug over a serial connection, make sure it is enabled in the kernel configuration (under “Drivers for Etrax built-in interfaces”) and not used for anything else. One of the ports is often used by the kernel for debug printouts, or agetty might be using it (check your /etc/inittab). On the target:
gdbserver <device> <program>
Example: gdbserver /dev/ttyS2 /tmp/hello_world
Then start gdb-cris on the host. To connect you need to specify what device on the host you have connected the serial cable to:
target remote <device>
Example: (gdb) target remote /dev/ttyS0
After you have connected to the target, you will end up in the startup routine for the C library the application is using (often called _start). To get to the main function of your application, simply set a breakpoint at main and continue:
(gdb) break main
Breakpoint 1 at 0x80342: file hello.c, line 3.
(gdb) continue
Continuing.
Breakpoint 1, main (argc=1, argv=0xaf897ec4) at hello.c:3
3 printf("Hello World!\n");
(gdb)
You may attach to an already running process by giving the process id as an argument to the gdbserver:
gdbserver [<hostname/ip address/device>]:<port> <pid>
Example: gdbserver hostname:2345 32