How do I get a backtrace from a crashing program ?
Here's how to get a backtrace from a crashing program :
- Make sure you have gdb installed.
- Compile the program with debugging options (usually -g). If the program uses autoconf :
./configure --enable-debug ; make clean ; make
Or simply add "-g" to the compiler options (these options are usually contained in an environment variable called CFLAGS for C or CXXFLAGS for C++).
- Run your program under gdb :
gdb ./program run
- Produce the crash.
- Type "bt" in the gdb console, this will output a backtrace showing exactly where the crash happens.
