Differences

This shows you the differences between two versions of the page.

doc:devel:gdb [2012/11/08 12:36]
jow add alternative approach to recompile package with debugging
doc:devel:gdb [2013/07/24 14:15] (current)
jow use build_dir in example, staging_dir is since as it is stripped
Line 14: Line 14:
===== Add debugging to a package ===== ===== Add debugging to a package =====
-Add CFLAGS to the package Makefile+Add CFLAGS to the package Makefile and recompile it.
| TARGET_CFLAGS += -ggdb3 | | TARGET_CFLAGS += -ggdb3 |
Alternatively recompile the package with ''CONFIG_DEBUG'' set Alternatively recompile the package with ''CONFIG_DEBUG'' set
| make package/busybox/{clean,compile} V=99 CONFIG_DEBUG=y | | make package/busybox/{clean,compile} V=99 CONFIG_DEBUG=y |
- +Or you can enable debug info in [[doc:howto:build#configuration|menuconfig]] 
-===== Compile ===== +| Global build settings > Compile packages with debugging info |
-Clean +
-| make dirclean | +
-and recompile +
-| make | +
===== Starting GNU Debugger ===== ===== Starting GNU Debugger =====
Line 31: Line 26:
Start gdb on host (in compiling tree) Start gdb on host (in compiling tree)
-| ./scripts/remote-gdb 192.168.1.1:9000 ./staging_dir/target-*/root-*/bin/ping |+| ./scripts/remote-gdb 192.168.1.1:9000 ./build_dir/target-*/busybox-*/busybox |
now you have a gdb shell. Set breakpoints, start program, backtrace etc. now you have a gdb shell. Set breakpoints, start program, backtrace etc.

Back to top

doc/devel/gdb.1352374619.txt.bz2 · Last modified: 2012/11/08 12:36 by jow