Using gdb with MinGW
Post date: May 17, 2011 6:57:42 PM
gdb should be installed by default with the MinGW development tools.
When you compile using gcc, include the -g option to enable debugging symbols. It's better to avoid optimization flags as well.
A custom program is needed to break into a program running with gdb.
http://www.mingw.org/wiki/Workaround_for_GDB_Ctrl_C_Interrupt
This is a useful introduction to debugging with GCC:
http://www.cprogramming.com/gdbtutorial.html
In Windows programs run from the console, you might automatically have several threads created, even though your program is only single threaded. Use "info threads" to list them. Use "thread 1" to switch to the first thread, which is probably the one you really want to see. Use "bt" to print the backtrace.