HOWTO: Debug programs with gdb on Mac OS X

a) Launch program in gdb:

gdb -ex run ./program

b) Check for double free in C:

set environment MALLOC_CHECK_ 2

c) Print out trace information

backtrace

d) Print out information about OpenMP threads:

info threads