User Tools

Site Tools


GNU Debugger

Compiling Tools

in menuconfig enable gdb

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

and gdbserver

Development → gdbserver

Add debugging to a package

Add CFLAGS to the package Makefile and recompile it.


Alternatively recompile the package with CONFIG_DEBUG set

make package/busybox/{clean,compile} V=99 CONFIG_DEBUG=y

Or you can enable debug info in menuconfig

Global build settings > Compile packages with debugging info

Starting GNU Debugger

Start gdbserver on target (router)

gdbserver :9000 /bin/ping

Start gdb on host (in compiling tree)

./scripts/remote-gdb ./build_dir/target-*/busybox-*/busybox

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

(gdb) b source-file.c:123
(gdb) c
(gdb) bt
docs/guide-developer/gdb.txt · Last modified: 2018/06/08 18:45 by tmomas