Skip to content

Instantly share code, notes, and snippets.

@plesiv
Created December 22, 2014 20:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save plesiv/4bb88a175c86b119f8c7 to your computer and use it in GitHub Desktop.
Save plesiv/4bb88a175c86b119f8c7 to your computer and use it in GitHub Desktop.
Remote debugging of embedded system with GDB/GDBSERVER over the network
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