Gdb remote debugging :
Gdb cross compilation:
Gdb source can be download from hereextract the source,
$ tar -xvf gdb-7.4.tar.gz
enter into the gdbserver folder,
$ cd gdb-7.4/gdb/gdbserver
cross compiling the gdbserver, make sure that arm toolchain should be in binany path.
$ CC=arm-none-linux-gnueabi-gcc ./configure --host=arm-linux
$ make
copy the gdbserver binary to the target machine.
Cross compiling the application:
$ arm-none-linux-gnueabi-gcc -g test.c -o test
transfer the binary to the target machine
Running gdb server in target:
# gdbserver :2345 ./test
output is like,
Process ./test created, pid = 57
Listening on port 2345
Running gdb in host machine:
$ arm-none-linux-gnueabi-gdb ./testafter gdt prompt appers,
(gdb) set sysroot /path/to/rootfs
(gdb) set solib-search-path /path/to/arm/toolchain/lib
example toolchain path is like,
"/home/abdul/em_linux/arm-2011.09/arm-none-linux-gnueabi/libc/lib"
(gdb) target remote 192.168.1.2:2345
replace the ipaddress with target ipaddress
(gdb) b main
after this we can step through and debug the application in remote machine.