Table of Contents
GNU Debugger
Note:This guide is by no means a Howto, just some short instructions to use GDB on OpenWrt.
Please look upstream for multilingual instructions and manuals, like e.g. here: http://sourceware.org/gdb/current/onlinedocs/gdb/
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 |
doc/devel/gdb.txt · Last modified: 2011/12/17 01:58 by cybjit