Hello,
I have a tiny hint in addition to Christian's perfect guide, which can be added in your build directory to the file etc/tools.conf:
CC_OLEVEL = -O0 -fno-omit-frame-pointer -gdwarf-2
The first two options instruct the compiler to optimize less and make backtraces better reproducible. The last option is required for older versions of GDB (for me it's 7.4 on Ubuntu 12.04), which do not support more recent versions of the DWARF debugging information.
Regards