Created
December 22, 2014 20:12
-
-
Save plesiv/4bb88a175c86b119f8c7 to your computer and use it in GitHub Desktop.
Remote debugging of embedded system with GDB/GDBSERVER over the network
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Debugging embedded system over ethernet with GDB (and gdbserver) | |
Prerequisite: host and target should be connected over network. | |
I - on target | |
* needed: | |
- compiled program that needs to be debugged (doesn't need | |
debugging symbols in it), | |
- gdbserver executable | |
* procedure: | |
0) determine the IP address ("inet addr") of the target with | |
bash> ifconfig | |
(let's assume target's IP is 192.168.0.80) | |
1) go to directory where program is located, | |
2) start gdbserver: | |
bash> gdbserver host:2345 program | |
II - on host | |
* needed: | |
- compiled program that needs to be debugged (has to have | |
debugging symbols in it!), | |
- gdb executable - must correspond to gdbserver executable on | |
the target (from the same gdb distribution) | |
- whole filesystem from the target (libraries for running | |
program are needed on correct locations) | |
* procedure: | |
1) go to directory where program is located, | |
2) start gdb as root (lets assume corresponding gdb program is | |
arm-xilinx-linux-gdb): | |
bash# arm-xilinx-linux-gdb program | |
3) connect to the remote gdbserver with: | |
gdb# target remote 192.168.0.80:2345 | |
4) change sysroot to the location of target's filesystem (we | |
assume it's in "~/target-fs") on the host: | |
gdb# set sysroot /home/zplesivcak/target-fs | |
5) set gdb path to shared libraries (e.g.): | |
gdb# set solib-search-path /opt/CodeSourcery/Sourcery_CodeBench_Lite_for_Xilinx_GNU_Linux/2011.09-50/arm-xilinx-linux-gnueabi/libc/lib:/home/zplesivcak/target-fs/lib:/home/zplesivcak/target-fs/usr/lib:/home/zplesivcak/target-fs/mnt/qt/lib | |
[6) optional] set breakpoints etc.: | |
gdb# b dfb_surface_pools_negotiate | |
gdb# b dfb_surface_pools_allocate | |
7) start debugging of the program ("c" is short for | |
"continue"): | |
gdb# c |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment