GNU Debugger

Compiling Tools

in menuconfig enable gdb

Advanced configuration options (for developers) → Toolchain Options → Build gdb

and gdbserver

Utilities → gdbserver

Add debugging to a package

Add CFLAGS to the package Makefile

TARGET_CFLAGS += -ggdb3

Compile

Clean

make dirclean

and recompile

make

Starting GNU Debugger

Start gdbserver on target (router)

gdbserver :9000 /bin/ping example.org

Start gdb on host (in compiling tree)

./scripts/remote-gdb 192.168.1.1:9000 ./staging_dir/target-*/root-*/bin/ping

now you have a gdb shell. Set breakpoints, start program, backtrace etc.

(gdb) b source-file.c:123
(gdb) c
(gdb) bt

Back to top

doc/devel/gdb.txt · Last modified: 2011/12/17 01:58 by cybjit